Skip to content

Commit

Permalink
Merge branch 'main' into ofi-cxi-aurora
Browse files Browse the repository at this point in the history
  • Loading branch information
ericjbohm authored Nov 13, 2024
2 parents 76f3d85 + 55b1360 commit d711b35
Show file tree
Hide file tree
Showing 12 changed files with 192 additions and 9 deletions.
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
23 changes: 23 additions & 0 deletions src/arch/verbs-linux-arm8/conv-mach-ibud.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#undef CMK_USE_IBUD
#define CMK_USE_IBUD 1

#undef CMK_USE_IBVERBS
#define CMK_USE_IBVERBS 1

// FIXME: See if I need to include any of these flags
#undef CMK_NETPOLL
#define CMK_NETPOLL 1

#undef CMK_MALLOC_USE_GNU_MALLOC
#define CMK_MALLOC_USE_GNU_MALLOC 0

#undef CMK_MALLOC_USE_OS_BUILTIN
#define CMK_MALLOC_USE_OS_BUILTIN 1

#undef CMK_IMMEDIATE_MSG
#define CMK_IMMEDIATE_MSG 0

#undef CMK_DISABLE_SYNC
#define CMK_DISABLE_SYNC 1


18 changes: 18 additions & 0 deletions src/arch/verbs-linux-arm8/conv-mach-ibud.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#default ibverbs path for openib
if test -z "$CMK_INCDIR"
then
#openib-1.1
if test -f /opt/ofed/include/infiniband/verbs.h
then
CMK_INCDIR="-I/opt/ofed/include/"
CMK_LIBDIR="-L/opt/ofed/lib64"
fi
if test -f /usr/local/ofed/include/infiniband/verbs.h
then
CMK_INCDIR="-I/usr/local/ofed/include/"
CMK_LIBDIR="-L/usr/local/ofed/lib64"
fi
fi

CMK_LIBS="$CMK_LIBS -libverbs"

3 changes: 3 additions & 0 deletions src/arch/verbs-linux-arm8/conv-mach-pxshm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#undef CMK_USE_PXSHM
#define CMK_USE_PXSHM 1
#define PXSHM_LOCK 1
2 changes: 2 additions & 0 deletions src/arch/verbs-linux-arm8/conv-mach-pxshm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CMK_SYSLIBS="$CMK_SYSLIBS -lrt -lpthread"

20 changes: 20 additions & 0 deletions src/arch/verbs-linux-arm8/conv-mach-smp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

#define CMK_SMP 1


#undef CMK_SHARED_VARS_UNAVAILABLE
#undef CMK_SHARED_VARS_POSIX_THREADS_SMP
#define CMK_SHARED_VARS_UNAVAILABLE 0
#define CMK_SHARED_VARS_POSIX_THREADS_SMP 1

#undef CMK_MALLOC_USE_GNU_MALLOC
#undef CMK_MALLOC_USE_OS_BUILTIN
#define CMK_MALLOC_USE_GNU_MALLOC 0
#define CMK_MALLOC_USE_OS_BUILTIN 1

/*#define CMK_MMAP_PROBE 1 */

/*#define CMK_PCQUEUE_LOCK 1 */
/*#define CMK_USE_MFENCE 1 */
/* Replaced by CMK_NOT_USE_TLS_THREAD as default */
/*#define CMK_USE_TLS_THREAD 1*/
3 changes: 3 additions & 0 deletions src/arch/verbs-linux-arm8/conv-mach-smp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CMK_DEFS="$CMK_DEFS -D_REENTRANT"
CMK_LIBS="-lpthread $CMK_LIBS "
CMK_SMP='1'
72 changes: 72 additions & 0 deletions src/arch/verbs-linux-arm8/conv-mach.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@

#ifndef _CONV_MACH_H
#define _CONV_MACH_H

#define CMK_USE_IBVERBS 1
#define CMK_NETPOLL 1

#define CMK_ARM 1

#define CMK_ASYNC_NOT_NEEDED 0
#define CMK_ASYNC_USE_FIOASYNC_AND_FIOSETOWN 0
#define CMK_ASYNC_USE_FIOASYNC_AND_SIOCSPGRP 0
#define CMK_ASYNC_USE_FIOSSAIOSTAT_AND_FIOSSAIOOWN 0
#define CMK_ASYNC_USE_F_SETFL_AND_F_SETOWN 1

#define CMK_DLL_CC "g++ -shared -O3 -o "

#define CMK_GETPAGESIZE_AVAILABLE 1

#define CMK_MALLOC_USE_GNU_MALLOC 0
#define CMK_MALLOC_USE_OS_BUILTIN 1

#define CMK_MEMORY_PAGESIZE 4096
#define CMK_MEMORY_PROTECTABLE 0


#define CMK_SSH_IS_A_COMMAND 1
#define CMK_SSH_NOT_NEEDED 0

#define CMK_SHARED_VARS_UNAVAILABLE 1

#define CMK_THREADS_USE_CONTEXT 0
#define CMK_THREADS_USE_FCONTEXT 1
#define CMK_THREADS_USE_PTHREADS 0
#define CMK_THREADS_ARE_WIN32_FIBERS 0

#define CMK_SIGNAL_NOT_NEEDED 0
#define CMK_SIGNAL_USE_SIGACTION 0
#define CMK_SIGNAL_USE_SIGACTION_WITH_RESTART 1

#define CMK_THREADS_REQUIRE_NO_CPV 0
#define CMK_THREADS_COPY_STACK 0

#define CMK_TIMER_USE_RDTSC 0
#define CMK_TIMER_USE_GETRUSAGE 1
#define CMK_TIMER_USE_SPECIAL 0
#define CMK_TIMER_USE_TIMES 0


#define CMK_64BIT 1

#define CMK_WHEN_PROCESSOR_IDLE_BUSYWAIT 0
#define CMK_WHEN_PROCESSOR_IDLE_USLEEP 1


#define CMK_DEBUG_MODE 0
#define CMK_WEB_MODE 1

#define CMK_LBDB_ON 1

/*
#undef CMK_IMMEDIATE_MSG
#define CMK_IMMEDIATE_MSG 0
*/

#undef CMK_DISABLE_SYNC
#define CMK_DISABLE_SYNC 1

#undef CMK_IBVERBS_FAST_START
#define CMK_IBVERBS_FAST_START 0

#endif
24 changes: 24 additions & 0 deletions src/arch/verbs-linux-arm8/conv-mach.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
. $CHARMINC/cc-gcc.sh

#CMK_DEFS="$CMK_DEFS -DHAVE_USR_INCLUDE_MALLOC_H=1 "
CMK_XIOPTS=''
CMK_LIBS="$CMK_LIBS -libverbs"
CMK_CXX_OPTIMIZE='-O3'

CMK_QT='generic64-light'

#default ibverbs path for openib
if test -z "$CMK_INCDIR"
then
#openib-1.1
if test -f /opt/ofed/include/infiniband/verbs.h
then
CMK_INCDIR='-I/opt/ofed/include/'
CMK_LIBDIR='-L/opt/ofed/lib64'
fi
if test -f /usr/local/ofed/include/infiniband/verbs.h
then
CMK_INCDIR='-I/usr/local/ofed/include/'
CMK_LIBDIR='-L/usr/local/ofed/lib64'
fi
fi
17 changes: 14 additions & 3 deletions src/arch/verbs/machine-ibverbs.C
Original file line number Diff line number Diff line change
Expand Up @@ -2540,7 +2540,9 @@ static inline void *getInfiCmiChunkThread(int dataSize){
if(!PCQueueEmpty(queuePool[CmiMyRank()][i])){
for(j = 0; j < PCQueueLength(queuePool[CmiMyRank()][i]); j++){
pointer = (void *)PCQueuePop(queuePool[CmiMyRank()][i]);
infi_CmiFreeDirect(pointer);
// Check because queue might actually be empty
if(pointer != NULL)
infi_CmiFreeDirect(pointer);
}
}
}
Expand Down Expand Up @@ -2570,8 +2572,12 @@ static inline void *getInfiCmiChunkThread(int dataSize){
hdr = (CmiChunkHeader *)res;

key = ibv_reg_mr(context->pd,res,(allocSize+sizeof(CmiChunkHeader))*count,IBV_ACCESS_REMOTE_READ | IBV_ACCESS_LOCAL_WRITE | IBV_ACCESS_REMOTE_WRITE);
if(key == NULL)
if(key == NULL) {
CmiError("Failed to allocate %d messages in pool %d\n", count, poolIdx);
CmiError("Consider increasing IBVBlockAllocRatio (currently %d) or IBVBlockThreshold (currently %d)\n",
blockAllocRatio, blockThreshold);
CmiAbort("ibv_reg_mr failed to pin memory\n");
}
#if CMK_IBVERBS_STATS
numCurReg++;
numReg++;
Expand Down Expand Up @@ -2672,7 +2678,12 @@ static inline void *getInfiCmiChunk(int dataSize){
hdr = (CmiChunkHeader *)res;

key = ibv_reg_mr(context->pd,res,(allocSize+sizeof(CmiChunkHeader))*count,IBV_ACCESS_REMOTE_READ | IBV_ACCESS_LOCAL_WRITE | IBV_ACCESS_REMOTE_WRITE);
CmiAssert(key != NULL);
if(key == NULL) {
CmiError("Failed to allocate %d messages in pool %d\n", count, poolIdx);
CmiError("Consider increasing IBVBlockAllocRatio (currently %d) or IBVBlockThreshold (currently %d)\n",
blockAllocRatio, blockThreshold);
CmiAbort("ibv_reg_mr failed to pin memory\n");
}
#if CMK_IBVERBS_STATS
numCurReg++;
numReg++;
Expand Down
4 changes: 4 additions & 0 deletions tests/charm++/periodic/periodic.C
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ class main : public CBase_main {
delete msg;

mProxy = thisProxy;
#if CALL_FN_AFTER
startTime = CkWallTimer();
#else
startTime = 0.0;
#endif
gProxy = CProxy_testGroup::ckNew(COUNTER_MAX);
CkPrintf("Testing Converse periodic callbacks on %d PEs for %d seconds\n",
CkNumPes(), COUNTER_MAX);
Expand Down

0 comments on commit d711b35

Please sign in to comment.