Skip to content

Commit

Permalink
GPU: Move GPUReconstructionHIP to hip language (#12255)
Browse files Browse the repository at this point in the history
* Move GPUReconstructionHIP to hip language

* Apply @davidrohr 's patch
  • Loading branch information
mconcas authored Nov 28, 2023
1 parent 16fa364 commit 6cc46bd
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Detectors/ITSMFT/ITS/tracking/GPU/hip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

if(HIP_ENABLED)
message(STATUS "Building ITS HIP tracker")
set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} ${O2_HIP_CMAKE_CXX_FLAGS} -fgpu-rdc")
set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} -fgpu-rdc")
o2_add_hipified_library(ITStrackingHIP
SOURCES ../cuda/ClusterLinesGPU.cu
../cuda/Context.cu
Expand Down
9 changes: 3 additions & 6 deletions GPU/GPUTracking/Base/hip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,15 @@

set(MODULE GPUTrackingHIP)

set(CMAKE_CXX_COMPILER ${hip_HIPCC_EXECUTABLE})
set(CMAKE_CXX_EXTENSIONS OFF)

#setting flags as a global option for all HIP targets.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${O2_HIP_CMAKE_CXX_FLAGS} -fno-gpu-rdc")
# Setting flags as a global option for all HIP targets.
set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} -fno-gpu-rdc")
if(DEFINED HIP_AMDGPUTARGET)
set(TMP_TARGET "(GPU Target ${HIP_AMDGPUTARGET})")
endif()

message(STATUS "Building GPUTracking with HIP support ${TMP_TARGET}")

set(SRCS GPUReconstructionHIP.hip.cxx)
set(SRCS GPUReconstructionHIP.hip)
set(HDRS GPUReconstructionHIP.h GPUReconstructionHIPInternals.h GPUReconstructionHIPIncludes.h HIPThrustHelpers.h)

if(ALIGPU_BUILD_TYPE STREQUAL "O2")
Expand Down
2 changes: 1 addition & 1 deletion GPU/GPUbenchmark/hip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# or submit itself to any jurisdiction.

message(STATUS "Building GPU HIP benchmark")
set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} ${O2_HIP_CMAKE_CXX_FLAGS} -fgpu-rdc -isystem /opt/rocm/include -fPIC")
set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} -fgpu-rdc -isystem /opt/rocm/include -fPIC")

o2_add_hipified_executable(gpu-memory-benchmark-hip
SOURCES ../cuda/benchmark.cu
Expand Down
8 changes: 4 additions & 4 deletions dependencies/FindO2GPU.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ function(set_target_hip_arch target)
endfunction()

# Detect and enable CUDA
STRING(REGEX REPLACE "\-std=[^ ]*" "" O2_GPU_CMAKE_CXX_FLAGS_NOSTD ${CMAKE_CXX_FLAGS}) # Need to strip c++17 imposed by alidist defaults
if(ENABLE_CUDA)
set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CUDA_STANDARD_REQUIRED TRUE)
Expand Down Expand Up @@ -106,9 +107,7 @@ if(ENABLE_CUDA)
endif()
endif()
if(CMAKE_CUDA_COMPILER)
# Forward CXX flags to CUDA C++ Host compiler (for warnings, gdb, etc.)
STRING(REGEX REPLACE "\-std=[^ ]*" "" CMAKE_CXX_FLAGS_NOSTD ${CMAKE_CXX_FLAGS}) # Need to strip c++17 imposed by alidist defaults
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler \"${CMAKE_CXX_FLAGS_NOSTD}\" --expt-relaxed-constexpr --extended-lambda --allow-unsupported-compiler -Xptxas -v")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler \"${O2_GPU_CMAKE_CXX_FLAGS_NOSTD}\" --expt-relaxed-constexpr --extended-lambda --allow-unsupported-compiler -Xptxas -v")
set(CMAKE_CUDA_FLAGS_DEBUG "${CMAKE_CUDA_FLAGS_DEBUG} -lineinfo -Xcompiler \"${CMAKE_CXX_FLAGS_DEBUG}\" -Xptxas -O0 -Xcompiler -O0")
if(NOT CMAKE_BUILD_TYPE STREQUAL "DEBUG")
set(CMAKE_CUDA_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_CUDA_FLAGS_${CMAKE_BUILD_TYPE}} -Xcompiler \"${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}\" -Xptxas -O4 -Xcompiler -O4")
Expand Down Expand Up @@ -262,7 +261,8 @@ if(ENABLE_HIP)
string(REGEX REPLACE "(.*)bin/c\\+\\+\$" "\\1" HIP_GCC_TOOLCHAIN_PATH "${CMAKE_CXX_COMPILER}")
set(O2_HIP_CMAKE_CXX_FLAGS "${O2_HIP_CMAKE_CXX_FLAGS} --gcc-toolchain=${HIP_GCC_TOOLCHAIN_PATH}") # -ffast-math disabled, since apparently it leads to miscompilation and crashes in FollowLooper kernel
endif()
set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} ${O2_HIP_CMAKE_CXX_FLAGS}")
set(CMAKE_HIP_FLAGS "${O2_GPU_CMAKE_CXX_FLAGS_NOSTD} ${CMAKE_HIP_FLAGS} ${O2_HIP_CMAKE_CXX_FLAGS}")
set(CMAKE_HIP_FLAGS_${CMAKE_BUILD_TYPE} "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}} ${CMAKE_HIP_FLAGS_${CMAKE_BUILD_TYPE}}")
else()
set(HIP_ENABLED OFF)
endif()
Expand Down

0 comments on commit 6cc46bd

Please sign in to comment.