From bebc9ad28930e807573d75aea2518d1d00a4a3f8 Mon Sep 17 00:00:00 2001 From: mtaylo12 Date: Thu, 8 Aug 2024 07:47:45 -0500 Subject: [PATCH 1/2] fixing cmake cuda build: renaming cuda cmake option --- CMakeLists.txt | 9 ++++----- buildcmake | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b6f699574..a90cbf042b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -209,8 +209,7 @@ endif() option(BUILD_SHARED "Build Charm++ dynamic libraries" OFF) # Other options -option(CUDA "Build with CUDA support" OFF) - +option(BUILD_CUDA "Build with CUDA support" OFF) option(PXSHM "Build with PXSHM" OFF) # LRTS PMI options @@ -224,8 +223,6 @@ string(REPLACE ";" " " MY_EXTRA_OPTS "${MY_EXTRA_OPTS}") set(OPTS "${OPTS} ${MY_EXTRA_OPTS}") set(OPTSATBUILDTIME "${OPTSATBUILDTIME} ${MY_EXTRA_OPTS}") -# We need both BUILD_CUDA and CUDA -set(BUILD_CUDA ${CUDA}) # Also build shared Charm++ libraries in lib_so/ if(BUILD_SHARED) @@ -689,7 +686,8 @@ configure_file(src/scripts/conv-config.sh include/ COPYONLY) configure_file(src/arch/${VDIR}/conv-mach.sh include/ COPYONLY) set(CUDA_DIR "") -if(CUDA) +if(BUILD_CUDA) + file(GLOB_RECURSE hybridAPI-h-sources ${CMAKE_SOURCE_DIR}/src/arch/cuda/*.h) file(GLOB_RECURSE hybridAPI-cxx-sources ${CMAKE_SOURCE_DIR}/src/arch/cuda/*.cpp) foreach(file ${hybridAPI-h-sources}) @@ -1096,6 +1094,7 @@ foreach(l CUDA_DIR BUILD_CUDA CMK_AMPI_WITH_ROMIO CMK_MACOSX CMK_BUILD_PYTHON endforeach(l) # Add options +set(CUDA ${BUILD_CUDA}) # need CUDA to match conv-mach file name foreach(opt SMP OMP TCP PTHREADS SYNCFT PXSHM PERSISTENT OOC CUDA PAPI CXI) if(${opt}) string(TOLOWER ${opt} optl) diff --git a/buildcmake b/buildcmake index ab65c2407b..e7071b7fe4 100755 --- a/buildcmake +++ b/buildcmake @@ -647,7 +647,7 @@ CC=$opt_CC CXX=$opt_CXX FC=$opt_FC cmake "$my_srcdir" \ -DCCS="$opt_ccs" \ -DCHARMDEBUG="$opt_charmdebug" \ -DCONTROLPOINT="$opt_controlpoint" \ - -DCUDA="$opt_cuda" \ + -DBUILD_CUDA="$opt_cuda" \ -DDISABLE_TLS="$opt_disabletls" \ -DDRONE_MODE="$opt_drone_mode" \ -DENABLE_FORTRAN=$opt_enable_fortran \ From 2a07a17a984dcd82edc8a89697718af56a642a8c Mon Sep 17 00:00:00 2001 From: mtaylo12 Date: Mon, 12 Aug 2024 07:32:09 -0500 Subject: [PATCH 2/2] linking cudart into charmlib.so --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a90cbf042b..50fcd28a0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -993,6 +993,10 @@ if(${TARGET} STREQUAL "charm4py") target_link_libraries(charm ck converse memory-default threads-default ldb-rand "-Llib/ -standalone -whole-archive -c++stl -shared") endif() + if (${BUILD_CUDA}) + target_link_libraries(charm cudart cudahybridapi) + endif() + add_dependencies(charm hwloc) endif()