[docs][win] update windows gpu build docs (#149)

update windows gpu build docs
This commit is contained in:
DefTruth
2022-08-24 09:57:28 +08:00
committed by GitHub
parent 2f854ddab0
commit 7afbe20945

View File

@@ -8,39 +8,86 @@
- cudnn >= 11.2 (当WITH_GPU=ON)
- TensorRT >= 8.4 (当ENABLE_TRT_BACKEND=ON)
## 获取代码
```bat
git clone https://github.com/PaddlePaddle/FastDeploy.git
cd FastDeploy
git checkout develop
```
## 编译C++ SDK
## 编译CPU版本 C++ SDK
Windows菜单打开`x64 Native Tools Command Prompt for VS 2019`命令工具,其中`CMAKE_INSTALL_PREFIX`用于指定编译后生成的SDK路径
```bat
mkdir build
cd build
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=D:\Paddle\FastDeploy\build\fastdeploy-win-x64-0.2.0 -DENABLE_ORT_BACKEND=ON -DENABLE_VISION=ON ..
git clone https://github.com/PaddlePaddle/FastDeploy.git
cd FastDeploy && git checkout develop
mkdir build && cd build
cmake .. -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=D:\Paddle\FastDeploy\build\fastdeploy-win-x64-0.2.0 -DENABLE_ORT_BACKEND=ON -DENABLE_VISION=ON -DENABLE_VISION_VISUALIZE=ON
msbuild fastdeploy.sln /m /p:Configuration=Release /p:Platform=x64
msbuild INSTALL.vcxproj /m /p:Configuration=Release /p:Platform=x64
```
编译后C++ SDK即在`D:\Paddle\FastDeploy\build\fastdeploy-win-x64-0.2.0`目录下
编译后,FastDeploy CPU C++ SDK即在`D:\Paddle\FastDeploy\build\fastdeploy-win-x64-0.2.0`目录下
## 编译Python Wheel包
## 编译GPU版本 C++ SDK
Windows菜单打开`x64 Native Tools Command Prompt for VS 2019`命令工具,其中`CMAKE_INSTALL_PREFIX`用于指定编译后生成的SDK路径
Python编译时通过环境变量获取编译选项
```bat
git clone https://github.com/PaddlePaddle/FastDeploy.git
cd FastDeploy
git checkout develop
cd FastDeploy && git checkout develop
mkdir build && cd build
cmake .. -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=D:\Paddle\FastDeploy\build\fastdeploy-win-x64-gpu-0.2.0 -DWITH_GPU=ON -DENABLE_ORT_BACKEND=ON -DENABLE_VISION=ON -DENABLE_VISION_VISUALIZE=ON -DENABLE_PADDLE_FRONTEND=ON -DCUDA_DIRECTORY=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2
msbuild fastdeploy.sln /m /p:Configuration=Release /p:Platform=x64
msbuild INSTALL.vcxproj /m /p:Configuration=Release /p:Platform=x64
% 附加说明:%
% (1) -DCUDA_DIRECTORY指定CUDA所在的目录 %
% (2) 若编译Paddle后端设置-DENABLE_PADDLE_BACKEND=ON %
% (3) 若编译TensorRT后端需要设置-DENABLE_TRT_BACKEND=ON并指定TRT_DIRECTORY %
% (4) 如-DTRT_DIRECTORY=D:\x64\third_party\TensorRT-8.4.1.5 %
```
编译后FastDeploy GPU C++ SDK即在`D:\Paddle\FastDeploy\build\fastdeploy-win-x64-gpu-0.2.0`目录下
## 编译CPU版本 Python Wheel包
Windows菜单打开x64 Native Tools Command Prompt for VS 2019命令工具。Python编译时通过环境变量获取编译选项在命令行终端运行以下命令
```bat
git clone https://github.com/PaddlePaddle/FastDeploy.git
cd FastDeploy && git checkout develop
set ENABLE_ORT_BACKEND=ON
set ENABLE_VISION=ON
python setup.py build
python setup.py bdist_wheel
% 这里指定用户自己的python解释器 以ptyhon3.8为例 %
C:\Python38\python.exe setup.py build
C:\Python38\python.exe setup.py bdist_wheel
```
编译好的wheel文件在dist目录下pip安装编译好的wheel包命令如下
```bat
C:\Python38\python.exe -m pip install dist\fastdeploy_python-0.2.0-cp38-cp38-win_amd64.whl
```
## 编译GPU版本 Python Wheel包
Windows菜单打开x64 Native Tools Command Prompt for VS 2019命令工具。Python编译时通过环境变量获取编译选项在命令行终端运行以下命令
```bat
% 说明CUDA_DIRECTORY 为用户自己的CUDA目录 以下为示例 %
set CUDA_DIRECTORY=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2
% 说明TRT_DIRECTORY 为下载的TensorRT库所在的目录 以下为示例 如果不编译TensorRT后端 可以不设置 %
set TRT_DIRECTORY=D:\x64\third_party\TensorRT-8.4.1.5
set WITH_GPU=ON
set ENABLE_ORT_BACKEND=ON
% 说明如果不编译TensorRT后端 此项为OFF %
set ENABLE_TRT_BACKEND=ON
set ENABLE_PADDLE_BACKEND=ON
set ENABLE_PADDLE_FRONTEND=ON
set ENABLE_VISION=ON
set ENABLE_VISION_VISUALIZE=ON
git clone https://github.com/PaddlePaddle/FastDeploy.git
cd FastDeploy && git checkout develop
% 说明这里指定用户自己的python解释器 以ptyhon3.8为例 %
C:\Python38\python.exe setup.py build
C:\Python38\python.exe setup.py bdist_wheel
```
编译好的wheel文件在dist目录下pip安装编译好的wheel包命令如下
```bat
C:\Python38\python.exe -m pip install dist\fastdeploy_gpu_python-0.2.0-cp38-cp38-win_amd64.whl
```
更多编译选项说明参考[编译指南](./README.md)