1.安装CUDA和CudNN
略..
2.更新cmake
1)下载cmake源码
wget https://cmake.org/files/v3.13/cmake-3.13.3-Linux-x86_64.tar.gz
2)解压
tar zxvf cmake-3.13.3-Linux-x86_64.tar.gz
3)删除旧的cmake
sudo yum remove cmake
4)添加cmake环境变量
sudo nano /etc/profile # 在最后添加如下内容 export CMAKE_HOME=/home/leo/soft/cmake-3.13.3-Linux-x86_64 export PATH=$PATH:$CMAKE_HOME/bin # 生效 source /etc/profile # 检查版本 cmake -version
3.更新GCC
CentOS7默认的gcc版本是4.8.x,需要更新到5.5.0版本(6.4.0测试时DLIB编译报错)
1)下载gcc 5.5.0
wget ftp://ftp.gnu.org/gnu/gcc/gcc-5.5.0/gcc-5.5.0.tar.gz
2)解压
tar zxvf gcc-5.5.0.tar.gz
3)安装依赖
安装gmp包:
wget https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz tar xvf gmp-6.1.2.tar.xz cd gmp-6.1.2 ./configure --prefix=/usr/local/gmp make && make install
安装mpfr包:
wget https://www.mpfr.org/mpfr-current/mpfr-4.0.2.tar.gz tar -zxvf mpfr-4.0.2.tar.gz cd mpfr-4.0.2 ./configure --prefix=/usr/local/mpfr --with-gmp=/usr/local/gmp make && make install
安装mpc包:
wget ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz tar xvf mpc-1.0.3.tar.gz cd mpc-1.0.3 ./configure --prefix=/usr/local/mpc --with-gmp=/usr/local/gmp --with-mpfr=/usr/local/mpfr make && make install
如果遇到报错:mul.c:175:1: error: conflicting types for ‘mpfr_fmma’
则将 mpc/src/mul.c中的 mpfr_fmma函数改名为mpfr_fmma_mul,一共三处
将库文件加入如下文件:
vi /etc/ld.so.conf # 增加以下三行 /usr/local/gmp/lib /usr/local/mpfr/lib /usr/local/mpc/lib # 保存退出 # 加完后使用如下命令更新 ldconfig -v
4)编译
cd gcc-5.5.0 ./configure --enable-checking=release --enable-languages=c,c++ --disable-multilib --with-gmp=/usr/local/gmp --with-mpfr=/usr/local/mpfr --with-mpc=/usr/local/mpc make -j16 sudo make install
4)删除旧的gcc
sudo yum remove gcc
5)创建软连接
ln -s /usr/local/bin/gcc /bin/cc ln -s /usr/local/bin/c++ /bin/c++
4.编译DLIB
1)下载源码
git clone https://github.com/davisking/dlib.git
2)解压
unzip dlib-master.zip
3)安装python版dlib
cd dlib-master/ # 进入虚拟环境 conda activate leo_env2 # 安装python版 dlib python setup.py install --set USE_AVX_INSTRUCTIONS=1 --set DLIB_USE_CUDA=1
4)安装dlib(可选)
cd dlib-master/ mkdir build cd build cmake .. cmake --build .
= =
标签:tar,--,CentOS7,usr,GPU,gmp,local,dlib,mpfr From: https://www.cnblogs.com/leokale-zz/p/17377980.html