Skip to content

Latest commit

 

History

History
57 lines (45 loc) · 3.12 KB

directml.md

File metadata and controls

57 lines (45 loc) · 3.12 KB

English | 中文

How to Build DirectML Deployment Environment

Direct Machine Learning (DirectML) is a high-performance, hardware-accelerated DirectX 12 library for machine learning on Windows systems. Currently, Fastdeploy's ONNX Runtime backend has DirectML integrated, allowing users to deploy models on AMD/Intel/Nvidia/Qualcomm GPUs with DirectX 12 support.

More details:

DirectML requirements

  • Compilation requirements: Visual Studio 2017 toolchain and above.
  • Operating system: Windows 10, version 1903, and newer. (DirectML is part of the operating system and does not need to be installed separately)
  • Hardware requirements: DirectX 12 supported graphics cards, e.g., AMD GCN 1st generation and above/ Intel Haswell HD integrated graphics and above/ Nvidia Kepler architecture and above/ Qualcomm Adreno 600 and above.

How to Build and Install DirectML C++ SDK

The DirectML is integrated with the ONNX Runtime backend, so to use DirectML, users need to turn on the option to compile ONNX Runtime. Also, FastDeploy's DirectML supports building programs for x64/x86 (Win32) architectures.

For the x64 example, in the Windows menu, find x64 Native Tools Command Prompt for VS 2019 and open it by executing the following command

git clone https://github.com/PaddlePaddle/FastDeploy.git
cd FastDeploy
mkdir build && cd build

cmake .. -G "Visual Studio 16 2019" -A x64 ^
         -DWITH_DIRECTML=ON ^
         -DENABLE_ORT_BACKEND=ON ^
         -DENABLE_VISION=ON ^
         -DCMAKE_INSTALL_PREFIX="D:\Paddle\compiled_fastdeploy" ^

msbuild fastdeploy.sln /m /p:Configuration=Release /p:Platform=x64
msbuild INSTALL.vcxproj /m /p:Configuration=Release /p:Platform=x64

Once compiled, the C++ inference library is generated in the directory specified by CMAKE_INSTALL_PREFIX If you use CMake GUI, please refer to How to Compile with CMakeGUI + Visual Studio 2019 IDE on Windows

For the x86(Win32) example, in the Windows menu, find x86 Native Tools Command Prompt for VS 2019 and open it by executing the following command

git clone https://github.com/PaddlePaddle/FastDeploy.git
cd FastDeploy
mkdir build && cd build

cmake .. -G "Visual Studio 16 2019" -A Win32 ^
         -DWITH_DIRECTML=ON ^
         -DENABLE_ORT_BACKEND=ON ^
         -DENABLE_VISION=ON ^
         -DCMAKE_INSTALL_PREFIX="D:\Paddle\compiled_fastdeploy" ^

msbuild fastdeploy.sln /m /p:Configuration=Release /p:Platform=Win32
msbuild INSTALL.vcxproj /m /p:Configuration=Release /p:Platform=Win32

Once compiled, the C++ inference library is generated in the directory specified by CMAKE_INSTALL_PREFIX If you use CMake GUI, please refer to How to Compile with CMakeGUI + Visual Studio 2019 IDE on Windows

How to use compiled DirectML SDK.

The DirectML compiled library can be used in the same way as any other hardware on Windows, see the following link.