Enabling oneDNN and ACL Acceleration
oneDNN and ACL acceleration enables oneDNN and ACL as the backend computing libraries of PyTorch to provide optimal performance for tasks such as deep learning. Replace the example paths provided in the following procedure with the actual ones.
- Obtain the ACL source code.
- Download the ACL source code.
https://github.com/ARM-software/ComputeLibrary/archive/refs/tags/v23.08.tar.gz
- Use an SFTP tool to upload the source package to the server.
If the server is connected to the Internet, you can run the wget command on the server to download the source package.
1wget https://github.com/ARM-software/ComputeLibrary/archive/refs/tags/v23.08.tar.gz --no-check-certificate
- Download the ACL source code.
- Decompress the ACL source package.
1tar -xzvf v23.08.tar.gz
- Go to the /path/to/ComputeLibrary-23.08 directory.
1cd /path/to/ComputeLibrary-23.08
- Build ACL using scons.
1scons Werror=1 -j8 debug=0 neon=1 opencl=0 os=linux arch=armv8a build=native
- Set ACL environment variables.
1export ACL_ROOT_DIR=/path/to/ComputeLibrary-23.08
- Verify the result.
- Go to the build directory.
1cd build
- Set the environment variable of the ACL dynamic library.
1export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/ComputeLibrary-23.08/build/
- Run the example test case.
1./examples/neon_cnn

- Go to the build directory.
- (Optional) If PyTorch has been installed, clear the existing compilation files.
- Go to the /path/to/pytorch directory.
1cd /path/to/pytorch
- Delete the build directory.
1rm -rf ./build
- Go to the /path/to/pytorch directory.
- Install PyTorch by following instructions in Basic Installation. Add the following items to the environment variables to Step 5:
1 2
export USE_MKLDNN=1 export USE_MKLDNN_ACL=1
USE_MKLDNN: Set this parameter to 1, indicating that the oneDNN library is enabled to optimize inference computing.
USE_MKLDNN_ACL: Set this parameter to 1, indicating that ACL is enabled in addition to USE_MKLDNN.
- Check the installation.
- Check whether the directory contains the oneDNN static library file.
1ls build/lib | grep dnnl
The command output shows that the directory contains the oneDNN static library file:

- Check whether the soft link of libtorch.so contains the .so files of ACL.
1ldd build/lib/libtorch.so | grep compute
The command output shows that the soft link contains the .so files of ACL:1 2 3
libarm_compute.so => /path/to/ComputeLibrary-23.08/build/libarm_compute.so (0x0000ffff9ca99000) libarm_compute_graph.so => /path/to/ComputeLibrary-23.08/build/libarm_compute_graph.so (0x0000ffff9c9b7000) libarm_compute_core.so => /path/to/ComputeLibrary-23.08/build/libarm_compute_core.so (0x0000ffff9c996000)
- Check whether the directory contains the oneDNN static library file.
Parent topic: Compiling the Source Code