Skip to content
Andrew Chapman edited this page Apr 21, 2017 · 31 revisions

hipBLAS is a thin interface that can be called from hcc or nvcc platforms.

Operating Systems

Linux only

Platform, hcc or nvcc

hipBLAS is written with HiP so it can run with AMD's ROCM or NVIDIA's CUDA hardware.

For AMD platform and Ubuntu, ROCM can be installed with sudo apt-get install rocm. For other platforms, see install ROCM. HIP is contained in ROCM.

To verify the installation of ROCM see install ROCM

Alternatively, for either AMD or NVIDIA, install HIP. To check that HIP is installed, enter the command hipconfig. This should output information on the HIP installation.

Dependencies

CMake 2.8 or later

On Ubuntu you can install cmake, cmake-gui, and ccmake with the following:

sudo apt-get update
sudo apt-get install cmake
sudo apt-get install cmake-gui
sudo apt-get install cmake-curses-gui

rocBLAS

hipBLAS needs to access the rocBLAS project. Installation instructions for rocBLAS are at the Wiki. In the hipBLAS configure step below, the rocBLAS install directory is specified with -DCMAKE_PREFIX_PATH=/opt/rocm/rocBLAS-build/library-package/

Download

Clone hipBLAS with the following commands: (Here it is assumed you will clone hipBLAS into the directory ~/repos/hipBLAS. You can choose to clone into any directory of your choice.)

cd ~; mkdir -p repos; cd repos
git clone -b master https://github.com/AMDComputeLibraries/hipBLAS.git

Configure

Configure using ccmake with the following. Note that it is assumed rocBLAS is installed in the directory /opt/rocm/rocBLAS-build/library-package. If you have rocBLAS installed in another directory, change the cmake command.

mkdir ~/repos/hipBLAS-build
cd ~/repos/hipBLAS-build
cmake ../hipBLAS -DBUILD_LIBRARY=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_PREFIX_PATH=/opt/rocm/rocBLAS-build/library-package/-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-fPIC

Build

Build with

cd ~/repos/hipBLAS-build
make VERBOSE=1 2>&1 | tee make.lib.out

Install

Install with the following:

cd ~/repos/hipBLAS-build/library-build
make install

After installing, the library libhipblas-hcc.a will be in the directory ~/repos/hipBLAS-build/library-package/lib. The include file hipblas.h will be in the directory ~/repos/hipBLAS-build/library-package/include. If you need the package installed in /opt/rocm/hipblas, copy with the following commands:

sudo mkdir -p /opt/rocm/hipblas
sudo cp -r ~/repos/hipBLAS-build/library-package /opt/rocm/hipblas

Using hipBLAS

If hipcc is used to compile code that calls hipBLAS the correct platform is automatically detected. If another compiler is used, one and only one of the following macro defines should be added to your compile flags for hcc or nvcc respectively:

-D__HIP_PLATFORM_HCC__
-D__HIP_PLATFORM_NVCC__

Additional information

  • In the hipBLAS configure step the command hipconfig is called to determine if hipBLAS should be built for the platform hcc or the platform nvcc.
  • Code that calls hipBLAS functions will include the header hipblas.h. When compiling code that includes hipblas.h one and only one of the following macros should be defined: __HIP_PLATFORM_HCC__, __HIP_PLATFORM_NVCC__. This tells the compiler if the platform is hcc or nvc respectively. The compiler hipcc automatically defines the correct macro. If you use another compiler add one and only one of the following to your compile flags for hcc or nvcc respectively:
-D__HIP_PLATFORM_HCC__
-D__HIP_PLATFORM_NVCC__

Build hipblas

Clone this wiki locally