Building Ginkgo with HIP support¶
Ginkgo provides a HIP backend.
This allows to compile optimized versions of the kernels for either AMD or
NVIDIA GPUs. The CMake configuration step will try to auto-detect the presence
of HIP either at /opt/rocm/hip
or at the path specified by HIP_PATH
as a
CMake parameter (-DHIP_PATH=
) or environment variable (export HIP_PATH=
),
unless -DGINKGO_BUILD_HIP=ON/OFF
is set explicitly.
Changing the paths to search for HIP and other packages¶
All HIP installation paths can be configured through the use of environment
variables or CMake variables. This way of configuring the paths is currently
imposed by the HIP
tool suite. The variables are the following:
CMake
-DROCM_PATH=
or environmentexport ROCM_PATH=
: sets theROCM
installation path. The default value is/opt/rocm/
.CMake
-DHIP_CLANG_PATH
or environmentexport HIP_CLANG_PATH=
: sets theHIP
compatibleclang
binary path. The default value is${ROCM_PATH}/llvm/bin
.CMake
-DHIP_PATH=
or environmentexport HIP_PATH=
: sets theHIP
installation path. The default value is${ROCM_PATH}/hip
.CMake
-DHIPBLAS_PATH=
or environmentexport HIPBLAS_PATH=
: sets thehipBLAS
installation path. The default value is${ROCM_PATH}/hipblas
.CMake
-DHIPSPARSE_PATH=
or environmentexport HIPSPARSE_PATH=
: sets thehipSPARSE
installation path. The default value is${ROCM_PATH}/hipsparse
.CMake
-DHIPFFT_PATH=
or environmentexport HIPFFT_PATH=
: sets thehipFFT
installation path. The default value is${ROCM_PATH}/hipfft
.CMake
-DROCRAND_PATH=
or environmentexport ROCRAND_PATH=
: sets therocRAND
installation path. The default value is${ROCM_PATH}/rocrand
.CMake
-DHIPRAND_PATH=
or environmentexport HIPRAND_PATH=
: sets thehipRAND
installation path. The default value is${ROCM_PATH}/hiprand
.environment
export CUDA_PATH=
: wherehipcc
can findCUDA
if it is not in the default/usr/local/cuda
path.
HIP platform detection of AMD and NVIDIA¶
Ginkgo relies on CMake to decide which compiler to use for HIP.
To choose nvcc
instead of the default ROCm clang++
, set the corresponding
environment variable:
export HIPCXX=nvcc
Note that this option is currently not being tested in our CI pipelines.