Skip to content

Commit

Permalink
CI: fix HIP install script
Browse files Browse the repository at this point in the history
Fix CI HIP install script to support alpaka'S CI base container instead
require native ROCM containers.

- ROCm 6 shipped clang is broken and `clang -v` is failing. Therefore this
PR is changing all compiler `-v` querries to `--version`.
- CMake: set ROCM 6.0 as supported version

CI_FILTER: ^linux_hipcc
  • Loading branch information
psychocoderHPC committed Dec 20, 2023
1 parent 27de8ee commit 375210c
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 14 deletions.
16 changes: 13 additions & 3 deletions cmake/alpakaCommon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -502,12 +502,18 @@ if(alpaka_ACC_GPU_HIP_ENABLE)

# supported HIP version range
set(_alpaka_HIP_MIN_VER 5.0)
set(_alpaka_HIP_MAX_VER 5.5)
set(_alpaka_HIP_MAX_VER 5.7)
set(_alpaka_HIP_NEXT_MAJOR_MIN_VER 6.0)

find_package(hip "${_alpaka_HIP_MIN_VER}...${_alpaka_HIP_MAX_VER}")

if(NOT TARGET hip)
message(WARNING "Could not find HIP <=v${_alpaka_HIP_MAX_VER}. Now searching for unsupported HIP >v${_alpaka_HIP_MAX_VER}")
find_package(hip "${_alpaka_HIP_MAX_VER}")
if(NOT TARGET hip)
message(WARNING "Could not find HIP >=v${_alpaka_HIP_MAX_VER}. Now searching for unsupported HIP >v${_alpaka_HIP_NEXT_MAJOR_MIN_VER}")
find_package(hip "${_alpaka_HIP_NEXT_MAJOR_MIN_VER}")
endif()
endif()

if(NOT TARGET hip)
Expand All @@ -526,7 +532,9 @@ if(alpaka_ACC_GPU_HIP_ENABLE)
# hip::hiprand is currently not expressing this dependency
find_package(rocrand REQUIRED CONFIG
HINTS "${HIP_ROOT_DIR}/rocrand"
HINTS "/opt/rocm/rocrand")
HINTS "${HIP_ROOT_DIR}"
HINTS "/opt/rocm/rocrand"
HINTS "/opt/rocm")
if(rocrand_FOUND)
target_link_libraries(alpaka INTERFACE roc::rocrand)
else()
Expand All @@ -536,7 +544,9 @@ if(alpaka_ACC_GPU_HIP_ENABLE)
# HIP random numbers
find_package(hiprand REQUIRED CONFIG
HINTS "${HIP_ROOT_DIR}/hiprand"
HINTS "/opt/rocm/hiprand")
HINTS "${HIP_ROOT_DIR}/"
HINTS "/opt/rocm/hiprand"
HINTS "/opt/rocm")
if(hiprand_FOUND)
target_link_libraries(alpaka INTERFACE hip::hiprand)
else()
Expand Down
2 changes: 1 addition & 1 deletion script/install_clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ then
fi

which "${CXX}"
${CXX} -v
${CXX} --version
21 changes: 14 additions & 7 deletions script/install_hip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,24 @@ else
travis_retry apt-get -y --quiet update
travis_retry apt-get -y --quiet install wget gnupg2
# AMD container keys are outdated and must be updated
source /etc/os-release
wget -q -O - https://repo.radeon.com/rocm/rocm.gpg.key | sudo apt-key add -
echo "deb https://repo.radeon.com/rocm/apt/${ALPAKA_CI_HIP_VERSION} ${VERSION_CODENAME} main" | sudo tee -a /etc/apt/sources.list.d/rocm.list
travis_retry apt-get -y --quiet update

# AMD container are not shipped with rocrand/hiprand
travis_retry sudo apt-get -y --quiet install rocrand
ALPAKA_CI_ROCM_VERSION=$ALPAKA_CI_HIP_VERSION
# append .0 if no patch level is defined
if ! echo $ALPAKA_CI_ROCM_VERSION | grep -Eq '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+'; then
ALPAKA_CI_ROCM_VERSION="${ALPAKA_CI_ROCM_VERSION}.0"
fi

apt install -y hiprand-dev${ALPAKA_CI_ROCM_VERSION} rocm-llvm${ALPAKA_CI_ROCM_VERSION} hip-runtime-amd${ALPAKA_CI_ROCM_VERSION} rocm-dev${ALPAKA_CI_ROCM_VERSION} rocm-utils${ALPAKA_CI_ROCM_VERSION} rocrand${ALPAKA_CI_ROCM_VERSION} rocminfo${ALPAKA_CI_ROCM_VERSION} rocm-cmake${ALPAKA_CI_ROCM_VERSION} rocm-device-libs${ALPAKA_CI_ROCM_VERSION} rocm-core${ALPAKA_CI_ROCM_VERSION} rocm-smi-lib${ALPAKA_CI_ROCM_VERSION}
export ROCM_PATH=/opt/rocm
fi
# ROCM_PATH required by HIP tools
export HIP_PATH=${ROCM_PATH}/hip

export HIP_LIB_PATH=${HIP_PATH}/lib
export HIP_PLATFORM="amd"
export HIP_DEVICE_LIB_PATH=${ROCM_PATH}/amdgcn/bitcode
export HSA_PATH=$ROCM_PATH

export PATH=${ROCM_PATH}/bin:$PATH
export PATH=${ROCM_PATH}/llvm/bin:$PATH
Expand All @@ -38,8 +45,8 @@ sudo update-alternatives --install /usr/bin/clang++ clang++ ${ROCM_PATH}/llvm/bi
sudo update-alternatives --install /usr/bin/cc cc ${ROCM_PATH}/llvm/bin/clang 50
sudo update-alternatives --install /usr/bin/c++ c++ ${ROCM_PATH}/llvm/bin/clang++ 50

export LD_LIBRARY_PATH=${ROCM_PATH}/lib64:${ROCM_PATH}/hiprand/lib:${LD_LIBRARY_PATH}:${ROCM_PATH}/llvm/lib
export CMAKE_PREFIX_PATH=${ROCM_PATH}:${ROCM_PATH}/hiprand:${CMAKE_PREFIX_PATH:-}
export LD_LIBRARY_PATH=${ROCM_PATH}/lib:${ROCM_PATH}/lib64:${ROCM_PATH}/llvm/lib:${LD_LIBRARY_PATH}
export CMAKE_PREFIX_PATH=${ROCM_PATH}:${CMAKE_PREFIX_PATH:-}

if [[ "$CI_RUNNER_TAGS" =~ .*cpuonly.* ]] ; then
# In cases where the compile-only job is executed on a GPU runner but with different kinds of accelerators
Expand Down
4 changes: 2 additions & 2 deletions script/install_oneapi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ then
fi

which "${CXX}"
${CXX} -v
${CXX} --version
which "${CC}"
${CC} -v
${CC} --version
sycl-ls
2 changes: 1 addition & 1 deletion script/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ then
fi

which "${CXX}"
${CXX} -v
${CXX} --version
fi

if [ "$ALPAKA_CI_OS_NAME" = "Linux" ]
Expand Down

0 comments on commit 375210c

Please sign in to comment.