Skip to content

Commit

Permalink
Cleanup: assume MPI_Init_thread support exists in MPI layer (#3595)
Browse files Browse the repository at this point in the history
Co-authored-by: Ronak Buch <rabuch2@illinois.edu>
  • Loading branch information
stwhite91 and rbuch committed Jun 22, 2022
1 parent d4d2203 commit d88db76
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 35 deletions.
1 change: 0 additions & 1 deletion cmake/detect-features-c.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ check_function_exists(mmap CMK_HAS_MMAP)
check_symbol_exists(MAP_ANON sys/mman.h CMK_HAS_MMAP_ANON)
check_symbol_exists(MAP_NORESERVE sys/mman.h CMK_HAS_MMAP_NORESERVE)
check_function_exists(mprotect CMK_HAS_MPROTECT)
check_symbol_exists(MPI_Init_thread mpi.h CMK_MPI_INIT_THREAD)
check_function_exists(mstats CMK_HAS_MSTATS)
check_function_exists(ntohl CMK_HAS_NTOHL)
check_symbol_exists(offsetof stddef.h CMK_HAS_OFFSETOF)
Expand Down
22 changes: 3 additions & 19 deletions src/arch/mpi/machine.C
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,6 @@ static void registerMPITraceEvents(void) {
}

static const char *thread_level_tostring(int thread_level) {
#if CMK_MPI_INIT_THREAD
switch (thread_level) {
case MPI_THREAD_SINGLE:
return "MPI_THREAD_SINGLE";
Expand All @@ -1362,18 +1361,9 @@ static const char *thread_level_tostring(int thread_level) {
return "MPI_THREAD_SERIALIZED";
case MPI_THREAD_MULTIPLE :
return "MPI_THREAD_MULTIPLE";
default: {
char *str = (char *)malloc(5); // XXX: leaked
sprintf(str,"%d", thread_level);
return str;
default:
return "unknown";
}
}
return "unknown";
#else
char *str = (char *)malloc(5); // XXX: leaked
sprintf(str,"%d", thread_level);
return str;
#endif
}

extern int quietMode;
Expand Down Expand Up @@ -1403,7 +1393,6 @@ void LrtsInit(int *argc, char ***argv, int *numNodes, int *myNodeID) {
*argc = CmiGetArgc(largv); /* update it in case it is out of sync */

if(!CharmLibInterOperate || userDrivenMode) {
#if CMK_MPI_INIT_THREAD
#if CMK_SMP
if (Cmi_smp_mode_setting == COMM_THREAD_SEND_RECV)
thread_level = MPI_THREAD_FUNNELED;
Expand All @@ -1414,11 +1403,6 @@ void LrtsInit(int *argc, char ***argv, int *numNodes, int *myNodeID) {
#endif
MPI_Init_thread(argc, argv, thread_level, &provided);
_thread_provided = provided;
#else
MPI_Init(argc, argv);
thread_level = 0;
_thread_provided = -1;
#endif
}

largc = *argc;
Expand Down Expand Up @@ -1901,7 +1885,7 @@ void CmiTimerInit(char **argv) {
starttimer = MPI_Wtime();
}

#if 0 && CMK_SMP && CMK_MPI_INIT_THREAD
#if 0 && CMK_SMP
if (CmiMyRank()==0 && _thread_provided == MPI_THREAD_SINGLE)
timerLock = CmiCreateLock();
#endif
Expand Down
15 changes: 0 additions & 15 deletions src/scripts/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1672,22 +1672,7 @@ then
fi
fi

if test "$BUILD_MPI" = "1"
then
cat > $t <<EOT
#include "mpi.h"
int main(int argc, char **argv)
{
int thread_level, provided;
thread_level = MPI_THREAD_FUNNELED;
MPI_Init_thread(&argc, &argv, thread_level, &provided);
}
EOT
test_cxx "whether MPI_Init_thread is supported" "yes" "no" ""
AC_DEFINE_UNQUOTED(CMK_MPI_INIT_THREAD, $strictpass, [Allows MPI_Init_thread.])
fi
mv -f ../include/mpi.h.bak ../include/mpi.h 2>/dev/null

fi

if test "$BUILD_MPI" = "1"
Expand Down

0 comments on commit d88db76

Please sign in to comment.