MXNetError: [15:25:07] C:\Jenkins\workspace\mxnet-tag\mxnet\src\storage\storage.cc:137: Compile with USE_CUDA=1 to enable GPU usage

Viewed 2691

I'm tried to train my code with gpu in jupyter .But i don't get the right gpu.

my environment is : windows10, cuda8, python3.6, mxnetgpu, jupyter .

my code is:

a = nd.array([1, 2, 3], ctx=mx.gpu())

But my error like this:

MXNetError                                Traceback (most recent call last)
    <ipython-input-6-3c78e5d2ccff> in <module>
    ----> 1 a = nd.array([1, 2, 3], ctx=mx.gpu())
          2 a

    d:\data\python\lib\site-packages\mxnet\ndarray\utils.py in array(source_array, ctx, dtype)
    144         return _sparse_array(source_array, ctx=ctx, dtype=dtype)
    145     else:
--> 146         return _array(source_array, ctx=ctx, dtype=dtype)
    147 
    148 

d:\data\python\lib\site-packages\mxnet\ndarray\ndarray.py in array(source_array, ctx, dtype)
   2432             except:
   2433                 raise TypeError('source_array must be array like object')
-> 2434     arr = empty(source_array.shape, ctx, dtype)
   2435     arr[:] = source_array
   2436     return arr

d:\data\python\lib\site-packages\mxnet\ndarray\ndarray.py in empty(shape, ctx, dtype)
   3818     if dtype is None:
   3819         dtype = mx_real_t
-> 3820     return NDArray(handle=_new_alloc_handle(shape, ctx, False, dtype))
   3821 
   3822 

d:\data\python\lib\site-packages\mxnet\ndarray\ndarray.py in _new_alloc_handle(shape, ctx, delay_alloc, dtype)
    137         ctypes.c_int(int(delay_alloc)),
    138         ctypes.c_int(int(_DTYPE_NP_TO_MX[np.dtype(dtype).type])),
--> 139         ctypes.byref(hdl)))
    140     return hdl
    141 

d:\data\python\lib\site-packages\mxnet\base.py in check_call(ret)
    250     """
    251     if ret != 0:
--> 252         raise MXNetError(py_str(_LIB.MXGetLastError()))
    253 
    254 

MXNetError: [15:25:07] C:\Jenkins\workspace\mxnet-tag\mxnet\src\storage\storage.cc:137: Compile with USE_CUDA=1 to enable GPU usage

I amend my configuration file adding path and USE CUDA.But it don't work!How to solve it?

1 Answers

It looks like you installed the MXNet CPU-only build as a pip package. You'll need to uninstall the CPU build

pip uninstall mxnet

and install the mxnet build with cuda support for your cuda version (8.0)

pip install mxnet-cu80

See http://mxnet.incubator.apache.org/install/index.html?platform=Linux&language=Python&processor=GPU.

If you get errors complaining about CUDA, you may need to follow the instructions regarding setting your CUDA_PATH: https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/

Vishaal

Related