1.修改Makefile.config,放开USE_CUDNN:=1 ,注释掉 CPU_ONLY:=1

2:查看下cuda 版本
# For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.
# For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
# For CUDA >= 9.0, comment the *_20 and *_21 lines for compatibility.
注释掉相应的不支持的版本

3:修改下环境变量
cd caffe
vim ~/.bashrc
添加环境变量
export CUDAHOME=/usr/local/cuda-9.0
export CUDA_INSTALL_PATH=/usr/local/cuda-9.0
export PATH=$PATH:$CUDA_INSTALL_PATH/bin
export LD_LIBRARY_PATH=$CUDA_INSTALL_PATH/lib64:$LD_LIBRARY_PATH
4:如果在运行模型中出错,有可能是因为没有使用GPU,可以用nvidia-smi命令查看一下有没有在用GPU。
在caffe-xxx模型包下,根据模型的代码使用步骤,设置Makefile.config,然后make all,make pycaffe。
make all -j8
make pycaffe
网友评论