記錄一下安裝mxnet...使用的服務器上已經有cuda和cudaCNN還有hadoop了,沒有裝cuda和cudnn的可以看我caffe的安裝博客。從github上clone下來mxnet,需要改make下的config.mk。注意事項:
在mxnet的根目錄下make。一定要記得,直接make,直接make,直接make!!!!!! cmake是準備給windows的!!!完了你覆蓋了原本的makefile的話就gg了。。。可以make -j#() 根據自己的配置決定。
改config.mk的時候,主要按照自己的pc配置改USE_CUDA, USE_CUDACNN, 同時我還加了:
# the additional link flags you want to add
ADD_LDFLAGS = -L/home/shixin/local/lib -L/home/shixin/local/lib64
# the additional compile flags you want to add
ADD_CFLAGS = -I/home/shixin/local/include -I/home/shixin/include
重新make的話記得把build文件夾刪掉...或者用別人拷給你的mxnet的話一定要刪掉build文件夾,不然會提示路徑里面有文件找不到什么的。
如果遇到以下錯誤:
Makefile:23: mshadow/make/mshadow.mk: No such file or directory
Makefile:24: dmlc-core/make/dmlc.mk: No such file or directory
Makefile:86: ps-lite/make/ps.mk: No such file or directory
是git clone的時候需要git clone --recursive <url>,因為mxnet依賴于DMLC通用工具包http://dmlc.ml/,--recursive參數可以自動加載mshadow等依賴。
- 我使用的是python接口。注意:執行任何demo都需要import find_mxnet,當然前提要保證執行文件夾下有find_mxnet.py:
try:
import mxnet as mx
except ImportError:
import os, sys
curr_path = os.path.abspath(os.path.dirname(__file__))
sys.path.append(os.path.join(curr_path, ".."))
import mxnet as mx
sys.path.append添加的路徑必須是有安裝mxnet的時候python/mxnet文件夾的。不使用find_mxnet.py的話,需要直接把python/mxnet文件夾放到執行的目錄下。
- 報錯找不到libmxnet.so?解決方案:把安裝目錄/lib下的libmxnet.so復制到python/mxnet中。