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

Fixing cmake charm++ and charm4py build with cuda #3836

Merged
merged 5 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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})
Expand Down Expand Up @@ -995,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()

Expand Down Expand Up @@ -1096,6 +1098,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)
Expand Down
2 changes: 1 addition & 1 deletion buildcmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
Loading