ubuntu 16.04 x64如何安裝mxnet GPU
阿新 • • 發佈:2019-01-30
1,cuda 8.0和cudnn安裝
注意下載cuda8.0的時候,不要下載deb格式,有坑,要下載run 格式的
可以使用ubuntu 命令列中的wget下載,速度比較快,不會斷鏈,使用瀏覽器下載發現會斷鏈:
cudnn 百度雲連結:https://pan.baidu.com/s/1o8HVgxW
2,安裝預編譯好的gpu mxnet
使用GPU
預設安裝的MXNet只支援CPU。有一些教程需要GPU來執行。假設電腦有N卡而且CUDA7.5或者8.0已經安裝了,那麼先解除安裝CPU版本
pip uninstall mxnet
然後選擇安裝下面版本之一:
pip install --pre mxnet-cu75 # CUDA 7.5 pip install --pre mxnet-cu80 # CUDA 8.0
【可選項】國內使用者可使用豆瓣pypi映象加速下載:
pip install --pre mxnet-cu75 -i https://pypi.douban.com/simple # CUDA 7.5
如果想在anaconda2中使用mxnet gpu(因為在jupyter-notebook會使用)
將上面的pip改為:/home/mm/anaconda2/bin/pip 這樣就可以把 mxnet安裝在anaconda2中了
安裝完成之後一定要重啟
驗證是否安裝成功:
(1)使用系統python驗證,命令列中輸入:python
1,cpu:
from mxnet import nd x = nd.array([1,2,3]) x.context
cpu(0)
2,GPU
from mxnet import nd
a = nd.array([1,2,3], ctx=mx.gpu())
a
[ 1. 2. 3.] <NDArray 3 @gpu(0)>,
(2)使用anaconda2 python驗證,命令列中輸入:/home/mm/anaconda2/bin/python
1,cpu:
from mxnet import nd x = nd.array([1,2,3]) x.context
cpu(0)
2,GPU
from mxnet import nd
a = nd.array([1,2,3], ctx=mx.gpu())
a
[ 1. 2. 3.] <NDArray 3 @gpu(0)>,