【问题标题】:MXNetError: [15:25:07] C:\Jenkins\workspace\mxnet-tag\mxnet\src\storage\storage.cc:137: Compile with USE_CUDA=1 to enable GPU usageMXNetError: [15:25:07] C:\Jenkins\workspace\mxnet-tag\mxnet\src\storage\storage.cc:137: 使用 USE_CUDA=1 编译以启用 GPU 使用
【发布时间】:2019-01-11 07:47:09
【问题描述】:

我尝试在 jupyter 中使用 gpu 训练我的代码。但我没有得到正确的 gpu。

我的环境是: 窗户10, cuda8, python3.6, mxnetgpu, jupyter .

我的代码是:

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

但我的错误是这样的:

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

我修改我的配置文件添加路径并使用CUDA。但是它不起作用!如何解决它?

【问题讨论】:

    标签: jupyter mxnet


    【解决方案1】:

    您似乎将 MXNet CPU-only 构建安装为 pip 包。您需要卸载 CPU 版本

    pip uninstall mxnet

    并为您的 cuda 版本 (8.0) 安装带有 cuda 支持的 mxnet 构建

    pip install mxnet-cu80

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

    如果您收到抱怨 CUDA 的错误,您可能需要按照有关设置 CUDA_PATH 的说明进行操作:https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/

    维沙尔

    【讨论】:

      猜你喜欢
      • 2018-04-06
      • 2020-02-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多