From 627f6ebe112d4c881b61e1dede27086a7187a687 Mon Sep 17 00:00:00 2001 From: David Rohr Date: Tue, 12 Mar 2024 23:25:11 +0100 Subject: [PATCH] GPU CMake: Don't create hipified source files in source tree but in CMake files folder --- Detectors/ITSMFT/ITS/tracking/GPU/hip/.gitignore | 3 --- GPU/GPUbenchmark/hip/.gitignore | 2 -- cmake/O2AddHipifiedExecutable.cmake | 8 ++++++-- cmake/O2AddHipifiedLibrary.cmake | 8 ++++++-- 4 files changed, 12 insertions(+), 9 deletions(-) delete mode 100644 Detectors/ITSMFT/ITS/tracking/GPU/hip/.gitignore delete mode 100644 GPU/GPUbenchmark/hip/.gitignore diff --git a/Detectors/ITSMFT/ITS/tracking/GPU/hip/.gitignore b/Detectors/ITSMFT/ITS/tracking/GPU/hip/.gitignore deleted file mode 100644 index 74255eaece87c..0000000000000 --- a/Detectors/ITSMFT/ITS/tracking/GPU/hip/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Don't track generated hip sources -*.hip.cxx -*.hip \ No newline at end of file diff --git a/GPU/GPUbenchmark/hip/.gitignore b/GPU/GPUbenchmark/hip/.gitignore deleted file mode 100644 index d8bb96de21414..0000000000000 --- a/GPU/GPUbenchmark/hip/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.hip.cxx -*.hip \ No newline at end of file diff --git a/cmake/O2AddHipifiedExecutable.cmake b/cmake/O2AddHipifiedExecutable.cmake index 1152273b1256f..dc633ec0cafff 100644 --- a/cmake/O2AddHipifiedExecutable.cmake +++ b/cmake/O2AddHipifiedExecutable.cmake @@ -33,7 +33,7 @@ function(o2_add_hipified_executable baseTargetName) set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${file}) get_filename_component(CUDA_SOURCE ${file} NAME) string(REPLACE ".cu" ".hip" HIP_SOURCE ${CUDA_SOURCE}) - set(OUTPUT_HIP_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${A_DEST_SRC_REL_PATH}/${HIP_SOURCE}") + set(OUTPUT_HIP_FILE "${CMAKE_CURRENT_BINARY_DIR}/${A_DEST_SRC_REL_PATH}/${HIP_SOURCE}") list(APPEND HIP_SOURCES ${OUTPUT_HIP_FILE}) add_custom_command( @@ -41,6 +41,10 @@ function(o2_add_hipified_executable baseTargetName) COMMAND ${HIPIFY_EXECUTABLE} --quiet-warnings ${ABS_CUDA_SORUCE} | sed '1{/\#include \"hip\\/hip_runtime.h\"/d}' > ${OUTPUT_HIP_FILE} DEPENDS ${file} ) + + set_source_files_properties(${OUTPUT_HIP_FILE} PROPERTIES + INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}" + ) else() list(APPEND HIP_SOURCES ${file}) endif() @@ -74,4 +78,4 @@ function(o2_add_hipified_executable baseTargetName) o2_add_executable("${baseTargetName}" SOURCES ${HIP_SOURCES} ${FORWARD_ARGS}) -endfunction() \ No newline at end of file +endfunction() diff --git a/cmake/O2AddHipifiedLibrary.cmake b/cmake/O2AddHipifiedLibrary.cmake index 0c75f8723a435..24652344343be 100644 --- a/cmake/O2AddHipifiedLibrary.cmake +++ b/cmake/O2AddHipifiedLibrary.cmake @@ -33,7 +33,7 @@ function(o2_add_hipified_library baseTargetName) set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${file}) get_filename_component(CUDA_SOURCE ${file} NAME) string(REPLACE ".cu" ".hip" HIP_SOURCE ${CUDA_SOURCE}) - set(OUTPUT_HIP_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${HIP_SOURCE}") + set(OUTPUT_HIP_FILE "${CMAKE_CURRENT_BINARY_DIR}/${HIP_SOURCE}") list(APPEND HIP_SOURCES ${OUTPUT_HIP_FILE}) add_custom_command( @@ -41,6 +41,10 @@ function(o2_add_hipified_library baseTargetName) COMMAND ${HIPIFY_EXECUTABLE} --quiet-warnings ${ABS_CUDA_SORUCE} | sed '1{/\#include \"hip\\/hip_runtime.h\"/d}' > ${OUTPUT_HIP_FILE} DEPENDS ${file} ) + + set_source_files_properties(${OUTPUT_HIP_FILE} PROPERTIES + INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}" + ) else() list(APPEND HIP_SOURCES ${file}) endif() @@ -68,4 +72,4 @@ function(o2_add_hipified_library baseTargetName) o2_add_library("${baseTargetName}" SOURCES ${HIP_SOURCES} ${FORWARD_ARGS}) -endfunction() \ No newline at end of file +endfunction()