You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by zh...@apache.org on 2019/07/19 03:42:27 UTC

[incubator-mxnet] 07/28: add better warning about cuda device

This is an automated email from the ASF dual-hosted git repository.

zhasheng pushed a commit to tag v1.1
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git

commit ab2776fe77c6d5de8eb3972297ed833876382fff
Author: antinucleon <an...@gmail.com>
AuthorDate: Tue Apr 15 10:36:03 2014 -0600

    add better warning about cuda device
---
 mshadow/tensor_gpu-inl.hpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mshadow/tensor_gpu-inl.hpp b/mshadow/tensor_gpu-inl.hpp
index 4eaf514..a2c1fc4 100644
--- a/mshadow/tensor_gpu-inl.hpp
+++ b/mshadow/tensor_gpu-inl.hpp
@@ -28,7 +28,7 @@ namespace mshadow {
         int device_id = 0;
         int device_count = 0;
         cudaGetDeviceCount(&device_count);
-
+        utils::Assert(device_count > 0, "Cannot find CUDA device. Please check CUDA-Configuration");
         if (dev_id < 0) {
             #if (MSHADOW_USE_NVML)
             device_id = AutoSelectDevice(device_count);
@@ -131,7 +131,7 @@ namespace mshadow{
         EShape eshape = ShapeCheck< ExpInfo<E>::kDim, E >::Check( exp.self() );
         utils::Assert( eshape[dimkeep] == dst.shape[0], "reduction dimension do not match" );
         // use equvalent form
-        Shape<4> pshape = Shape4( eshape.ProdShape(dimkeep+1,EShape::kMaxShape), eshape[dimkeep], 
+        Shape<4> pshape = Shape4( eshape.ProdShape(dimkeep+1,EShape::kMaxShape), eshape[dimkeep],
                                   eshape.ProdShape(1,dimkeep), eshape[0] );
         // call equavalent map red dim 2
         cuda::MapReduceKeepDim2<Saver,Reducer>( dst, MakePlan( exp.self() ), scale, pshape );