diff --git a/README.md b/README.md index 30b45a7970..eaa146d4b2 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,10 @@ ```bash pip install numpy opencv-python fastdeploy-gpu-python -f https://www.paddlepaddle.org.cn/whl/fastdeploy.html ``` - +##### [Anaconda配置GPU环境(推荐)](docs/quick_start/Python_prebuilt_wheels.md) +```bash +conda config --add channels conda-forge && conda install cudatoolkit=11.2 cudnn=8.2 +``` ##### 安装CPU版本 ```bash diff --git a/docs/compile/how_to_build_windows.md b/docs/compile/how_to_build_windows.md index 0e6dff82e7..65b8d1ea76 100644 --- a/docs/compile/how_to_build_windows.md +++ b/docs/compile/how_to_build_windows.md @@ -17,7 +17,7 @@ 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 +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_PADDLE_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 ``` @@ -32,7 +32,7 @@ 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-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 +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_PADDLE_BACKEND=ON -DENABLE_VISION=ON -DENABLE_VISION_VISUALIZE=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 @@ -52,9 +52,11 @@ git clone https://github.com/PaddlePaddle/FastDeploy.git cd FastDeploy && git checkout develop set ENABLE_ORT_BACKEND=ON +set ENABLE_PADDLE_BACKEND=ON set ENABLE_VISION=ON +set ENABLE_VISION_VISUALIZE=ON -% 这里指定用户自己的python解释器 以ptyhon3.8为例 % +% 这里指定用户自己的python解释器 以python3.8为例 % C:\Python38\python.exe setup.py build C:\Python38\python.exe setup.py bdist_wheel ``` @@ -75,14 +77,13 @@ 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为例 % +% 说明:这里指定用户自己的python解释器 以python3.8为例 % C:\Python38\python.exe setup.py build C:\Python38\python.exe setup.py bdist_wheel ``` diff --git a/docs/compile/how_to_use_sdk_on_windows.md b/docs/compile/how_to_use_sdk_on_windows.md index de3d076ad8..1da91671d6 100644 --- a/docs/compile/how_to_use_sdk_on_windows.md +++ b/docs/compile/how_to_use_sdk_on_windows.md @@ -40,6 +40,8 @@ cmake .. -G "Visual Studio 16 2019" -A x64 -DFASTDEPLOY_INSTALL_DIR=%cd%\..\..\. ```bat msbuild infer_demo.sln /m:4 /p:Configuration=Release /p:Platform=x64 ``` +## 配置依赖库路径 +#### 方式一:命令行设置环境变量 编译好的exe保存在Release目录下,在运行demo前,需要将模型和测试图片拷贝至该目录。另外,需要在终端指定DLL的搜索路径。请在build目录下执行以下命令。 ```bat set FASTDEPLOY_PATH=%cd%\..\..\..\..\..\..\..\fastdeploy-win-x64-gpu-0.2.0 @@ -49,11 +51,26 @@ set PATH=%FASTDEPLOY_PATH%\lib;%FASTDEPLOY_PATH%\third_libs\install\onnxruntime\ ```bat copy /Y %FASTDEPLOY_PATH%\third_libs\install\onnxruntime\lib\onnxruntime* Release\ ``` -由于较新的Windows在System32系统目录下自带了onnxruntime.dll,因此就算设置了PATH,系统依然会出现onnxruntime的加载冲突。因此需要先拷贝demo用到的onnxruntime.dll到exe所在的目录。 +由于较新的Windows在System32系统目录下自带了onnxruntime.dll,因此就算设置了PATH,系统依然会出现onnxruntime的加载冲突。因此需要先拷贝demo用到的onnxruntime.dll到exe所在的目录。如下 ```bat where onnxruntime.dll C:\Windows\System32\onnxruntime.dll # windows自带的onnxruntime.dll ``` +#### 方式二:拷贝依赖库到exe的目录下 +手动拷贝,或者在build目录下执行以下命令: +```bat +set FASTDEPLOY_PATH=%cd%\..\..\..\..\..\..\..\fastdeploy-win-x64-gpu-0.2.0 +copy /Y %FASTDEPLOY_PATH%\lib\*.dll Release\ +copy /Y %FASTDEPLOY_PATH%\third_libs\install\onnxruntime\lib\*.dll Release\ +copy /Y %FASTDEPLOY_PATH%\third_libs\install\opencv-win-x64-3.4.16\build\x64\vc15\bin\*.dll Release\ +copy /Y %FASTDEPLOY_PATH%\third_libs\install\paddle_inference\paddle\lib\*.dll Release\ +copy /Y %FASTDEPLOY_PATH%\third_libs\install\paddle_inference\third_party\install\mkldnn\lib\*.dll Release\ +copy /Y %FASTDEPLOY_PATH%\third_libs\install\paddle_inference\third_party\install\mklml\lib\*.dll Release\ +copy /Y %FASTDEPLOY_PATH%\third_libs\install\paddle2onnx\lib\*.dll Release\ +copy /Y %FASTDEPLOY_PATH%\third_libs\install\tensorrt\lib\*.dll Release\ +copy /Y %FASTDEPLOY_PATH%\third_libs\install\yaml-cpp\lib\*.dll Release\ +``` + ## 运行 demo ```bat cd Release diff --git a/docs/quick_start/Python_prebuilt_wheels.md b/docs/quick_start/Python_prebuilt_wheels.md index 8952ffe592..c0ad4924f4 100644 --- a/docs/quick_start/Python_prebuilt_wheels.md +++ b/docs/quick_start/Python_prebuilt_wheels.md @@ -5,7 +5,7 @@ FastDeploy提供了在Windows/Linux/Mac上的预先编译Python Wheel包,开 目前各平台支持情况如下 - Linux 支持Python3.6~3.9 -- Windows 支持Python3.8~3.9 +- Windows 支持Python3.6~3.9 - Mac 支持Python3.6~3.9 ## 安装 CPU Python 版本 @@ -17,6 +17,30 @@ pip install fastdeploy-python -f https://www.paddlepaddle.org.cn/whl/fastdeploy. pip install fastdeploy-gpu-python -f https://www.paddlepaddle.org.cn/whl/fastdeploy.html ``` +## Anaconda 快速配置 GPU 环境 +使用Anaconda的用户可在命令运行以下命令,快速配置GPU环境。如果是Windows用户,需要先打开`Anaconda Prompt (anaconda3)`命令行终端。 +- 增加 conda-forge 源 +```bash +conda config --add channels conda-forge +# 国内用户可以增加国内的源,如 +conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ +conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ +conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/ +``` +- 新建 python 环境 +```bash +conda create -n py38 python=3.8 +conda activate py38 +``` +- 安装 cudatoolkit 11.x 和 cudnn 8.x +```bash +conda install cudatoolkit=11.2 cudnn=8.2 +``` +- 安装 FastDeploy GPU 版本 Python 包 +```bash +pip install fastdeploy-gpu-python -f https://www.paddlepaddle.org.cn/whl/fastdeploy.html +``` + ## 注意事项 - 不要重复安装`fastdeploy-python`和`fastdeploy-gpu-python` - 如已安装CPU版本的`fastdeploy-python`后,在安装GPU版本的`fastdeploy-gpu-python`,请先执行`pip uninstall fastdeploy-python`卸载已有版本