Skip to content

Commit

Permalink
Look for the hip runtime and libraries next to the compiler by default
Browse files Browse the repository at this point in the history
  • Loading branch information
ye-luo committed Nov 28, 2022
1 parent 15d499a commit 885eaac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
13 changes: 10 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -790,16 +790,23 @@ endif(USE_NVTX_API)
# set up ROCM compiler options and libraries
#-------------------------------------------------------------------
if(ENABLE_ROCM)
enable_language(HIP)
set(CMAKE_HIP_LINKER_PREFERENCE_PROPAGATES 0)
if(DEFINED ROCM_ROOT)
message(STATUS "Using ROCM_ROOT: ${ROCM_ROOT}")
# explicit ROCM_ROOT takes precedence
list(PREPEND CMAKE_PREFIX_PATH ${ROCM_ROOT})
elseif(CMAKE_HIP_COMPILER_ROCM_ROOT)
list(PREPEND CMAKE_PREFIX_PATH ${CMAKE_HIP_COMPILER_ROCM_ROOT})
endif()
enable_language(HIP)
set(CMAKE_HIP_LINKER_PREFERENCE_PROPAGATES 0)

# use hip package to supply the hip runtime for CXX source code.
find_package(hip CONFIG REQUIRED)
find_package(hip CONFIG)
if(NOT hip_FOUND)
message(FATAL_ERROR "The HIP runtime library cmake configure file hip-config.cmake cannot be found! "
"This happens when the ROCm installation cannot be found by CMake. "
"Rerun cmake with -DROCM_ROOT=<your ROCm installation root directory> added.")
endif()
find_package(hipblas CONFIG REQUIRED)
find_package(rocsolver CONFIG REQUIRED)
find_package(rocthrust CONFIG REQUIRED)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_automation/github-actions/ci/run_step.sh
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,14 @@ case "$1" in
;;
*"ROCm-Clang13-NoMPI-CUDA2HIP"*)
echo 'Configure for building CUDA2HIP with clang compilers shipped with ROCM on AMD hardware'
export ROCM_PATH=/opt/rocm

cmake -GNinja \
-DCMAKE_C_COMPILER=/opt/rocm/llvm/bin/clang \
-DCMAKE_CXX_COMPILER=/opt/rocm/llvm/bin/clang++ \
-DQMC_MPI=0 \
-DENABLE_CUDA=ON \
-DQMC_CUDA2HIP=ON \
-DROCM_ROOT=/opt/rocm \
-DCMAKE_PREFIX_PATH="/opt/OpenBLAS/0.3.18" \
-DQMC_COMPLEX=$IS_COMPLEX \
-DQMC_MIXED_PRECISION=$IS_MIXED_PRECISION \
Expand All @@ -253,6 +253,7 @@ case "$1" in
;;
*"ROCm-Clang13-MPI-Legacy-CUDA2HIP"*)
echo 'Configure for building CUDA2HIP with clang compilers shipped with ROCM on AMD hardware'
export ROCM_PATH=/opt/rocm

export OMPI_CC=/opt/rocm/llvm/bin/clang
export OMPI_CXX=/opt/rocm/llvm/bin/clang++
Expand All @@ -267,7 +268,6 @@ case "$1" in
-DMPIEXEC_EXECUTABLE=/usr/lib64/openmpi/bin/mpirun \
-DQMC_CUDA=1 \
-DQMC_CUDA2HIP=ON \
-DROCM_ROOT=/opt/rocm \
-DCMAKE_PREFIX_PATH="/opt/OpenBLAS/0.3.18" \
-DQMC_COMPLEX=$IS_COMPLEX \
-DQMC_MIXED_PRECISION=$IS_MIXED_PRECISION \
Expand Down

0 comments on commit 885eaac

Please sign in to comment.