-
Notifications
You must be signed in to change notification settings - Fork 149
How to set up clBLAS and OpenCL
#Install OpenCL driver Visit AMD official website and download the package for your hardware and system. The website provides manual selection process of driver by providing information of your system. http://support.amd.com/en-us/download
#Install OpenCL APPSDK Visit AMD official website and download the package for your system (linux 32-bit or 64-bit system). http://developer.amd.com/tools-and-sdks/opencl-zone/amd-accelerated-parallel-processing-app-sdk/#appsdkdownloads
#Install clBLAS The latest library can be found in https://github.com/clMathLibraries/clBLAS. First follow the wiki page of clBLAS https://github.com/clMathLibraries/clBLAS/wiki to install all the dependencies.
If you have Hawaii, Bonaire or Tahiti device, to get optimal performance, please read the off-line compilation section (clBLAS update notes 04/2015 in README.md ) carefully and follow the instructions. Taking Hawaii GPUs for example, you may install clBLAS as the following:
-
cd src & mkdir build & cd build
-
cmake -DCMAKE_INSTALL_PATHATH=/opt/clBLAS2.7 -DOCL_VERSION TRING=2.0 -DCMAKE_BUILD_TYPE=Release -DPRECOMPILE_GEMM_PRECISION_SGEMM:BOOL=ON-DPRECOMPILE_GEMM_TRANS_NN:BOOL=ON -DPRECOMPILE_GEMM_TRANS_NT:BOOL=ON-DPRECOMPILE_GEMM_TRANS_TN:BOOL=ON -DPRECOMPILE_GEMM_TRANS_TT:BOOL=ON ..
note1, it seems latest clBLAS (clBLAS2.7) install the binary under /usr/local instead of /opt/clBLAS2.7. note2, please use ccmake to make it easier for the option selection.
If some dependencies are not installed properly, you will get some errors in the cmake output such as libacml.so not found, in this case, just set the environment variable, eg "export ACML_ROOT=/opt/acml5.3.1". Fix all the dependency problem until there is no complaint.
-
sudo make
-
sudo make install
#How to switch between different clBLAS binaries?
Suppose you have different clBLAS installed. As we know that DNN performance is depending on DNN model parameters, BLAS optimizations and H/W configurations. It might be worthwhile for you to switch between different version to pick up the best performance for your DNN models. How to switch between them?
- under OpenCL-caffe/build, rm -rf * (this will remove all previous cmake configurations that pointed to previous clBLAS binary)
- export CLBLAS-ROOT
- Then repeat the cmake.. (make sure you check that the clBLAS now points to the version you want to use), then make. Then re-run your performance tests!