Skip to content

Commit

Permalink
Patch hipcc environment variables in ROCm 3.X
Browse files Browse the repository at this point in the history
In ROCm 3.0 and 3.1, environment variables for hipcc and hcc are
overriden by incorrect paths (espressomd/docker#156). This causes
CMake to generate an incorrect linking command for EspressoCore.so:
in `/opt/rocm/bin/hipcc_cmake_linker_helper /opt/rocm -fPIC ...`,
either path `/opt/rocm` is an empty string, or both the linker path
and path `/opt/rocm` are empty strings. Calling `find_package()`
twice with an overriden `HCC_PATH` fixes the linking command.
  • Loading branch information
jngrad committed Mar 13, 2020
1 parent f9914cd commit 2a77d04
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,9 @@ if(WITH_CUDA)
set(ROCM_HOME "/opt/rocm" CACHE FILEPATH "Path to AMD ROCm")
list(APPEND CMAKE_MODULE_PATH "${ROCM_HOME}/hip/cmake")
find_package(HIP 1.5.18494 MODULE REQUIRED)
# patch HCC_PATH environment variable and reload HIP (for ROCm 3.0/3.1)
set(HCC_PATH "${HIP_ROOT_DIR}")
find_package(HIP 1.5.18494 MODULE REQUIRED)
find_package(CUDACompilerHIP 6.0 REQUIRED)
elseif (WITH_CUDA_COMPILER STREQUAL "clang")
set(CMAKE_CUDA_STANDARD 8.0)
Expand Down
2 changes: 0 additions & 2 deletions cmake/FindCUDACompilerHIP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ string(REGEX
CMAKE_CUDA_COMPILER_VERSION
"${HIPCC_VERSION_STRING}")

set(HCC_PATH "${HIP_ROOT_DIR}")

list(APPEND HIP_HCC_FLAGS "-I${HIP_ROOT_DIR}/include -I${ROCM_HOME}/include -Wno-c99-designator -Wno-macro-redefined -Wno-duplicate-decl-specifier -std=c++${CMAKE_CXX_STANDARD}")
list(APPEND HIP_HCC_FLAGS "-pedantic -Wall -Wextra -Wno-sign-compare -Wno-unused-function -Wno-unused-variable -Wno-unused-parameter -Wno-missing-braces -Wno-gnu-anonymous-struct -Wno-nested-anon-types -Wno-gnu-zero-variadic-macro-arguments")
if(WARNINGS_ARE_ERRORS)
Expand Down

0 comments on commit 2a77d04

Please sign in to comment.