Skip to content

Commit d17744e

Browse files
Fixing cmake charm++ and charm4py build with cuda (#3836)
* fixing cmake cuda build: renaming cuda cmake option * linking cudart into charmlib.so --------- Co-authored-by: Ritvik Rao <rsrao2@illinois.edu>
1 parent 3305b91 commit d17744e

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,7 @@ endif()
209209
option(BUILD_SHARED "Build Charm++ dynamic libraries" OFF)
210210

211211
# Other options
212-
option(CUDA "Build with CUDA support" OFF)
213-
212+
option(BUILD_CUDA "Build with CUDA support" OFF)
214213
option(PXSHM "Build with PXSHM" OFF)
215214

216215
# LRTS PMI options
@@ -224,8 +223,6 @@ string(REPLACE ";" " " MY_EXTRA_OPTS "${MY_EXTRA_OPTS}")
224223
set(OPTS "${OPTS} ${MY_EXTRA_OPTS}")
225224
set(OPTSATBUILDTIME "${OPTSATBUILDTIME} ${MY_EXTRA_OPTS}")
226225

227-
# We need both BUILD_CUDA and CUDA
228-
set(BUILD_CUDA ${CUDA})
229226

230227
# Also build shared Charm++ libraries in lib_so/
231228
if(BUILD_SHARED)
@@ -689,7 +686,8 @@ configure_file(src/scripts/conv-config.sh include/ COPYONLY)
689686
configure_file(src/arch/${VDIR}/conv-mach.sh include/ COPYONLY)
690687

691688
set(CUDA_DIR "")
692-
if(CUDA)
689+
if(BUILD_CUDA)
690+
693691
file(GLOB_RECURSE hybridAPI-h-sources ${CMAKE_SOURCE_DIR}/src/arch/cuda/*.h)
694692
file(GLOB_RECURSE hybridAPI-cxx-sources ${CMAKE_SOURCE_DIR}/src/arch/cuda/*.cpp)
695693
foreach(file ${hybridAPI-h-sources})
@@ -995,6 +993,10 @@ if(${TARGET} STREQUAL "charm4py")
995993
target_link_libraries(charm ck converse memory-default threads-default ldb-rand "-Llib/ -standalone -whole-archive -c++stl -shared")
996994
endif()
997995

996+
if (${BUILD_CUDA})
997+
target_link_libraries(charm cudart cudahybridapi)
998+
endif()
999+
9981000
add_dependencies(charm hwloc)
9991001
endif()
10001002

@@ -1096,6 +1098,7 @@ foreach(l CUDA_DIR BUILD_CUDA CMK_AMPI_WITH_ROMIO CMK_MACOSX CMK_BUILD_PYTHON
10961098
endforeach(l)
10971099

10981100
# Add options
1101+
set(CUDA ${BUILD_CUDA}) # need CUDA to match conv-mach file name
10991102
foreach(opt SMP OMP TCP PTHREADS SYNCFT PXSHM PERSISTENT OOC CUDA PAPI CXI)
11001103
if(${opt})
11011104
string(TOLOWER ${opt} optl)

buildcmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ CC=$opt_CC CXX=$opt_CXX FC=$opt_FC cmake "$my_srcdir" \
647647
-DCCS="$opt_ccs" \
648648
-DCHARMDEBUG="$opt_charmdebug" \
649649
-DCONTROLPOINT="$opt_controlpoint" \
650-
-DCUDA="$opt_cuda" \
650+
-DBUILD_CUDA="$opt_cuda" \
651651
-DDISABLE_TLS="$opt_disabletls" \
652652
-DDRONE_MODE="$opt_drone_mode" \
653653
-DENABLE_FORTRAN=$opt_enable_fortran \

0 commit comments

Comments
 (0)