根据Paddle依赖库环境要求(https://www.paddlepaddle.org.cn/documentation/docs/zh/install/pip/linux-pip.html),统一图像识别算法环境Python3.9、CUDA 11.7 、 cuDNN v8.4.1、 TensorRT8.4.2.4
目前Paddle统一使用2.5,安装命令为:
1 2 |
$conda install paddlepaddle-gpu==2.5.0 cudatoolkit=11.7 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/Paddle/ -c conda-forge |
Linux
安装Cuda
1 2 3 4 5 6 7 8 9 10 11 12 |
$wget https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda_11.7.0_515.43.04_linux.run $sudo sh cuda_11.7.0_515.43.04_linux.run # 添加环境变量 $vim ~/.bashrc # CUDA PATh export PATH=/usr/local/cuda-11.7/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda-11.7/lib64:$LD_LIBRARY_PATH export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/cuda-11.7/lib64 # 保存 $source ~/.bashrc $nvcc -V |
安装Cudnn
https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#installlinux-tar
1 2 3 4 5 6 7 |
# 下载https://developer.nvidia.com/rdp/cudnn-archive $tar -xvf cudnn-linux-$arch-8.x.x.x_cudaX.Y-archive.tar.xz # https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html $sudo cp cudnn-*-archive/include/cudnn*.h /usr/local/cuda/include $sudo cp -P cudnn-*-archive/lib/libcudnn* /usr/local/cuda/lib64 $sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn* |
安装TensorRT
https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
$tar -xzvf TensorRT-${version}.Linux.${arch}-gnu.${cuda}.tar.gz $cd TensorRT-${version}/python #当前Python环境下 $python3 -m pip install tensorrt-*-cp3x-none-linux_x86_64.whl #Optionally, install the TensorRT lean and dispatch runtime wheel files: $python3 -m pip install tensorrt_lean-*-cp3x-none-linux_x86_64.whl $python3 -m pip install tensorrt_dispatch-*-cp3x-none-linux_x86_64.whl #Install the Python UFF wheel file. This is only required if you plan to use TensorRT with TensorFlow in UFF format. $cd TensorRT-${version}/uff $python3 -m pip install uff-0.6.9-py2.py3-none-any.whl #Check the installation with: $which convert-to-uff #Install the Python graphsurgeon wheel file. $cd TensorRT-${version}/graphsurgeon $python3 -m pip install graphsurgeon-0.4.6-py2.py3-none-any.whl #Install the Python onnx-graphsurgeon wheel file. $cd TensorRT-${version}/onnx_graphsurgeon $python3 -m pip install onnx_graphsurgeon-0.3.12-py2.py3-none-any.whl $vim ~/.bashrc $export LD_LIBRARY_PATH=/root/Downloads/tensorrt/TensorRT-8.4.2.4/lib:$LD_LIBRARY_PATH $source ~/.bashrc |
windows
安装Cuda
https://developer.nvidia.com/cuda-11-7-0-download-archive?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exe_local
下载exe安装程序直接安装
Cuda默认安装路径C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7
安装Cudnn
1 2 3 4 |
1. 将include中头文件copy到CUDA安装目录include目录下 2. 将lib中所有lib文件copy到CUDA安装目录lib\x64目录下 3. 将bin中所有dll文件copy到CUDA安装目录bin目录下 |
安装TensorRT
1 2 3 4 |
1. 将 include中头文件copy到CUDA安装目录include目录下 2. 将lib中所有lib文件copy到CUDA安装目录lib\x64目录下 3. 将lib中所有dll文件copy到CUDA安装目录bin目录下 |