提前编译安装好对应版本的CUDA
源码下载
https://gitee.com/paddlepaddle/Paddle/tree/release%2F2.0/
解压
unzip paddlepaddle-Paddle-release-2.0.zip
cd Paddle
mkdir build && cd build
编译配置
PADDLE_ROOT=/usr/local/paddle
cmake -DFLUID_INFERENCE_INSTALL_DIR=$PADDLE_ROOT \
-DCMAKE_BUILD_TYPE=Release \
-DWITH_PYTHON=OFF \
-DWITH_MKL=ON \
-DWITH_GPU=ON \
-DON_INFER=ON \
-DWITH_NCCL=OFF \
..
遇到问题
CMake Error at CMakeLists.txt:48 (enable_language):
No CMAKE_CUDA_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable "CUDACXX" or the CMake cache entry CMAKE_CUDA_COMPILER to
the full path to the compiler, or to the compiler name if it is in the PATH.
解决问题
#查看cuda的安装路径
find -name cuda
...
./usr/local/cuda
#执行以下指令后重新配置
export PATH=/usr/local/cuda/bin:$PATH
编译
make -j8
遇到的问题
...
fatal: unable to access 'https://github.com/dmlc/dlpack.git/': Protocol "https" not supported or disabled in libcurl
...
解决问题
https://blog.csdn.net/yujuan110/article/details/80939311
#下载新版openssll并上传到指定目录
#解压
tar -zxvf openssl-1.1.1k.tar.gz
cd openssl-1.1.1k/
#配置
./config --prefix=/usr/local/curl
#编译
make -j8
#安装
make install
参考链接
https://www.paddlepaddle.org.cn/documentation/docs/zh/guides/05_inference_deployment/inference/build_and_install_lib_cn.html