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 theROCMinstallation path. The default value is/opt/rocm/.CMake
-DHIP_CLANG_PATHor environmentexport HIP_CLANG_PATH=: sets theHIPcompatibleclangbinary path. The default value is${ROCM_PATH}/llvm/bin.CMake
-DHIP_PATH=or environmentexport HIP_PATH=: sets theHIPinstallation path. The default value is${ROCM_PATH}/hip.CMake
-DHIPBLAS_PATH=or environmentexport HIPBLAS_PATH=: sets thehipBLASinstallation path. The default value is${ROCM_PATH}/hipblas.CMake
-DHIPSPARSE_PATH=or environmentexport HIPSPARSE_PATH=: sets thehipSPARSEinstallation path. The default value is${ROCM_PATH}/hipsparse.CMake
-DHIPFFT_PATH=or environmentexport HIPFFT_PATH=: sets thehipFFTinstallation path. The default value is${ROCM_PATH}/hipfft.CMake
-DROCRAND_PATH=or environmentexport ROCRAND_PATH=: sets therocRANDinstallation path. The default value is${ROCM_PATH}/rocrand.CMake
-DHIPRAND_PATH=or environmentexport HIPRAND_PATH=: sets thehipRANDinstallation path. The default value is${ROCM_PATH}/hiprand.environment
export CUDA_PATH=: wherehipcccan findCUDAif it is not in the default/usr/local/cudapath.
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.