Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix link errors in edge cases and restore HIP testing #1042

Merged
merged 8 commits into from
Jan 23, 2024
Merged
34 changes: 34 additions & 0 deletions .jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,40 @@ pipeline {
stages {
stage('Build') {
parallel {
stage('rocm-ndebug-orange') {
agent {
docker {
image 'celeritas/ci-centos7-rocm5:2022-12-14.2'
label 'AMD_Radeon_Instinct_MI100 && rocm-docker'
args '--device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined'
}
}
steps {
sh 'entrypoint-shell ./scripts/ci/run-ci.sh centos-rocm ndebug-orange'
}
post {
always {
xunit reduceLog: false, tools:[CTest(deleteOutputFiles: true, failIfNotNew: true, pattern: 'build/Testing/**/*.xml', skipNoTestFiles: false, stopProcessingIfError: true)]
}
}
}
stage('rocm-ndebug-orange-float') {
agent {
docker {
image 'celeritas/ci-centos7-rocm5:2022-12-14.2'
label 'AMD_Radeon_Instinct_MI100 && rocm-docker'
args '--device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined'
}
}
steps {
sh 'entrypoint-shell ./scripts/ci/run-ci.sh centos-rocm ndebug-orange-float'
}
post {
always {
xunit reduceLog: false, tools:[CTest(deleteOutputFiles: true, failIfNotNew: true, pattern: 'build/Testing/**/*.xml', skipNoTestFiles: false, stopProcessingIfError: true)]
}
}
}
stage('cuda-debug-orange') {
agent {
docker {
Expand Down
22 changes: 19 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,18 @@ elseif(CELERITAS_USE_HIP)
set(CELERITAS_HAVE_ROCTX ON)
target_link_libraries(celeritas_device_toolkit INTERFACE ${ROCTX_LIBRARY})
endif()
# TODO: downstream libs don't link against correct HIP dependencies when using
# static libraries
if(NOT BUILD_SHARED_LIBS)
# Downstream libs don't link against correct HIP dependencies when using
# static libraries, and even though the code below propagates the library
# names (-lamdhip64) CMake fails to include the link directories
# (/opt/rocm/lib)
target_link_libraries(celeritas_device_toolkit
INTERFACE "$<INSTALL_INTERFACE:${CMAKE_HIP_IMPLICIT_LINK_LIBRARIES}>"
)
target_link_directories(celeritas_device_toolkit
INTERFACE "$<INSTALL_INTERFACE:${CMAKE_HIP_IMPLICIT_LINK_DIRECTORIES}>"
)
endif()
endif()

install(TARGETS celeritas_device_toolkit
Expand Down Expand Up @@ -610,6 +620,12 @@ message(WARNING \"The Celeritas version was not detected during configuration.
provenance data in output results.\")
")
endif()

if(CELERITAS_USE_HIP AND NOT BUILD_SHARED_LIBS)
# See celeritas_device_toolkit above
install(CODE "
message(WARNING \"CMake may not be able to correctly propagate implicit HIP
libraries: downstream executables may fail to link.\")
")
endif()

#----------------------------------------------------------------------------#
1 change: 0 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
"hidden": true,
"description": "Build with optimizations and without debug assertions",
"cacheVariables": {
"BUILD_SHARED_LIBS":{"type": "BOOL", "value": "OFF"},
"CELERITAS_DEBUG": {"type": "BOOL", "value": "OFF"},
"CMAKE_BUILD_TYPE": {"type": "STRING", "value": "Release"},
"CMAKE_CUDA_FLAGS_RELEASE": "-O3 -DNDEBUG",
Expand Down
2 changes: 1 addition & 1 deletion example/accel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ project(CeleritasAccelExample VERSION 0.0.1 LANGUAGES CXX)
cmake_policy(VERSION 3.12...3.22)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/..")
find_package(Celeritas 0.4 REQUIRED)
find_package(Celeritas 0.5 REQUIRED)
find_package(Geant4 REQUIRED)

if(NOT CELERITAS_USE_Geant4 OR CELERITAS_CORE_GEO STREQUAL "ORANGE")
Expand Down
2 changes: 1 addition & 1 deletion example/minimal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ project(CeleritasMinimalExample VERSION 0.0.1 LANGUAGES CXX)
cmake_policy(VERSION 3.12...3.22)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/..")
find_package(Celeritas 0.4 REQUIRED)
find_package(Celeritas 0.5 REQUIRED)

add_executable(minimal minimal.cc)

Expand Down
2 changes: 1 addition & 1 deletion scripts/cmake-presets/ci-ubuntu-cuda.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"description": "Build with release ORANGE",
"inherits": [".ndebug", "base"],
"cacheVariables": {
"BUILD_SHARED_LIBS": {"type": "BOOL", "value": "OFF"},
"CELERITAS_USE_ROOT": {"type": "BOOL", "value": "OFF"}
}
},
Expand All @@ -82,7 +83,6 @@
"description": "Build release with vecgeom for testing *only* demos",
"inherits": [".ndebug", ".vecgeom", "base"],
"cacheVariables": {
"BUILD_SHARED_LIBS": {"type": "BOOL", "value": "ON"},
"BUILD_TESTING": {"type": "BOOL", "value": "ON"},
"CELERITAS_BUILD_DEMOS": {"type": "BOOL", "value": "ON"},
"CELERITAS_BUILD_TESTS": {"type": "BOOL", "value": "OFF"}
Expand Down
16 changes: 9 additions & 7 deletions src/celeritas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,15 @@ if(CELERITAS_USE_VecGeom)
ext/VecgeomParams.surface.cu
)
endif()
endif()

if(CELERITAS_USE_VecGeom AND CELERITAS_USE_CUDA)
# This needs to be public because its might be needed
# to resolve the symbols generate by the `nvcc -dlink` of
# one of the executable.
list(APPEND PUBLIC_DEPS VecGeom::vecgeom)
if(CELERITAS_USE_CUDA)
# This needs to be public because its might be needed
# to resolve the symbols generate by the `nvcc -dlink` of
# one of the executable.
list(APPEND PUBLIC_DEPS VecGeom::vecgeom)
elseif(VecGeom_CUDA_FOUND)
# VecGeom is built with CUDA but Celeritas is not
list(APPEND PRIVATE_DEPS VecGeom::vecgeomcuda)
endif()
endif()

if(CELERITAS_CORE_GEO STREQUAL "VecGeom")
Expand Down