RTX2080+Ubuntu18.04+cuda9.0+cudnn7+miniconda3+refineDet配置记录

Nvidia driver-410

系统自带440驱动要装cuda10,先将驱动全部卸载,再安装410

卸载

sudo apt-get --purge remove nvidia*
sudo apt autoremove

自带驱动屏蔽

在终端输入

lsmod | grep nouveau

如果有输出需要禁用系统自带的 nouveau 驱动↓,没有就跳过
创建一个配置文件

sudo vim /etc/modprobe.d/blacklist-nouveau.conf

在该配置文件中添加如下内容

blacklist nouveau
options nouveau modeset=0

进行更新

sudo update-initramfs -u

然后重启,在终端输入

lsmod | grep nouveau

无输出则成功

安装

sudo apt-get install nvidia-driver-410

检查

lsmod | grep nvidia

输出类似↓就安装成功了

nvidia_uvm            790528  0
nvidia_drm             40960  0
nvidia_modeset       1040384  1 nvidia_drm
nvidia              16633856  2 nvidia_uvm,nvidia_modeset
drm_kms_helper        172032  2 mgag200,nvidia_drm
drm                   458752  6 drm_kms_helper,mgag200,nvidia_drm,ttm
ipmi_msghandler       102400  4 ipmi_devintf,ipmi_si,nvidia,ipmi_ssif

也可以nvidia-smi查看驱动版本

cuda9.0

GCC & G++

Ubuntu18.04预装GCC7.3,而CUDA9.0支持GCC6.0以下版本。gcc和g++从自带的7降级到6

查看版本

Gcc --version
G++ --version

降级

sudo apt install gcc-6 g++-6
sudo ln -s /usr/bin/gcc-6 /usr/local/bin/gcc
sudo ln -s /usr/bin/g++-6 /usr/local/bin/g++

cuda9.0

安装

官网下载cuda_9.0.176_384.81_linux-run和cuda_9.0.176.1_linux.run文件,cd到目录下

Chmod +x cuda_9.0.176_384.81_linux-run
./ cuda_9.0.176_384.81_linux-run

除了!!!跳过安装驱动!!!,全部选默认,安装完成

#安装补丁
Chmod +x cuda_9.0.176.1_linux-run
./ cuda_9.0.176.1_linux-run

添加环境变量

sudo vim ~/.bashrc

在结尾添加

#cuda9.0
export PATH=$PATH:/usr/local/cuda/bin/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64/

重启

检查是否安装成功

1.查看版本

Nvcc -V

正常结果↓

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Sep__1_21:08:03_CDT_2017
Cuda compilation tools, release 9.0, V9.0.176

2.运行example

cd /usr/local/cuda-9.0/samples/1_Utilities/deviceQuery
sudo make
sudo ./deviceQuery

输出GPU相关信息就对啦,一定要sudo

Cudnn7

官网下载cudnn-9.0-linux-x64-v7.6.4.38.tgz,cd到目录里

tar -zxvf cudnn-9.0-linux-x64-v7.6.4.38.tgz
sudo cp cuda/include/cudnn.h /usr/local/cuda/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*

miniconda3

官网下载Miniconda3-latest-Linux-x86_64.sh,cd到目录里

chmod +x Miniconda3-latest-Linux-x86_64.sh
./ Miniconda3-latest-Linux-x86_64.sh

RefineDet

Base安装(成功)

编译依赖项

sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev
sudo apt-get install libopenblas-dev liblapack-dev libatlas-base-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev

装python2的依赖项:

sudo apt-get install python-pip
sudo apt-get install python-scipy
sudo apt-get install python-matplotlib
sudo apt-get install python-skimage
sudo apt-get install python-dev
sudo apt-get install python-numpy
sudo apt-get install opencv-python

安装RefineDet

Cd到 $RefineDet_ROOT.

git clone https://github.com/sfzhang15/RefineDet.git
cp Makefile.config.example Makefile.config
#修改Makefile.config (opencv3那行取消注释)
make all -j
make py

要用python2运行

cd ****/refinedet/python
python2
>>import caffe

不报错就是成功了,如果报cublas的错↓是因为没安装cuda补丁(见安装cuda部分↑)

F1121 15:56:26.234781 27262 math_functions.cu:26] Check failed: status == CUBLAS_STATUS_SUCCESS (13 vs. 0)  CUBLAS_STATUS_EXECUTION_FAILED
*** Check failure stack trace: ***)

虚拟环境(失败待解决)

创建2.7环境
安装RefineDet后import报错

>>> import caffe
Traceback (most recent call last):
  File "", line 1, in 
  File "caffe/__init__.py", line 1, in 
    from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
  File "caffe/pycaffe.py", line 13, in 
    from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \
ImportError: /usr/lib/libgdal.so.20: undefined symbol: sqlite3_column_table_name

Update sqlite无效,未解决。

你可能感兴趣的:(RTX2080+Ubuntu18.04+cuda9.0+cudnn7+miniconda3+refineDet配置记录)