Enabling BLAS Acceleration
BLAS acceleration is used to accelerate linear algebraic operations. Replace the example paths provided in the following procedure with the actual ones.
- Use PuTTY to log in to the server as the root user.
- Install OpenBLAS.
yum install openblas gcc-gfortran
- (Optional) If PyTorch has been installed, clear the existing compilation files.
- Go to the /path/to/pytorch directory.
cd /path/to/pytorch
- Delete the build directory.
rm -rf ./build
- Go to the /path/to/pytorch directory.
- Install PyTorch by following instructions in Basic Installation.
You do not need to set the BLAS library environment variable. The BLAS library in the user environment is automatically detected during PyTorch compilation. Take OpenBLAS as an example. If OpenBLAS is downloaded, you can see that OpenBLAS is enabled for PyTorch after the build.

If the BLAS environment variable is set, the BLAS library is forcibly enabled. If no available BLAS library is found, the compilation fails.
- Check whether the BLAS feature is enabled.
ldd build/lib/libtorch.so | grep blas
If the following information is displayed, BLAS is enabled.

Parent topic: Compiling the Source Code