Skip to content

Commit

Permalink
Merge branch 'fix/cray-perf' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
theurich committed Aug 3, 2023
2 parents 09dd440 + fb1f870 commit 519fb64
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 25 deletions.
27 changes: 4 additions & 23 deletions src/Infrastructure/VM/src/ESMCI_VMKernel.C
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ typedef DWORD pid_t;
#define VM_MPI_THREAD_LEVEL MPI_THREAD_MULTIPLE
#endif

// Utility macros to get a macro value into a string
#define XSTR(X) STR(X)
#define STR(X) #X

namespace ESMCI {

// Definition of class static data members
Expand Down Expand Up @@ -417,9 +413,6 @@ void VMK::init(MPI_Comm mpiCommunicator, bool globalResourceControl){
// query the MPI thread support level as set by external MPI initialization
MPI_Query_thread(&mpi_thread_level);
}
// initialize the MPI tool interface
int provided_thread_level;
MPI_T_init_thread(VM_MPI_THREAD_LEVEL, &provided_thread_level);
#else
// MPIUNI simply set the thread level
mpi_thread_level = MPI_THREAD_SERIALIZED;
Expand Down Expand Up @@ -686,14 +679,6 @@ void VMK::finalize(int finalizeMpi){
delete [] cid[i];
delete [] cid;
delete [] ssiLocalPetList;
// Special MPI Tool Interface handling for OpenMPI
std::string esmf_comm(XSTR(ESMF_COMM));
bool mpi_t_done = false;
if (esmf_comm == "openmpi"){
// OpenMPI must call MPI_T_finalize() before MPI_Finalize()
mpi_t_done = true;
MPI_T_finalize();
}
// conditionally finalize MPI
int finalized;
MPI_Finalized(&finalized);
Expand All @@ -705,12 +690,6 @@ void VMK::finalize(int finalizeMpi){
if (finalizeMpi)
MPI_Finalize();
}
MPI_Finalized(&finalized);
if (finalized && !mpi_t_done){
// finalize the MPI tool interface
// do this _after_ MPI_Finalize() or else Darshan dies with SEGV (not clear why)
MPI_T_finalize();
}
}


Expand Down Expand Up @@ -765,8 +744,6 @@ struct SpawnArg{


void VMK::abort(){
// finalize the MPI tool interface
MPI_T_finalize();
// abort default (all MPI) virtual machine
int finalized;
MPI_Finalized(&finalized);
Expand Down Expand Up @@ -2802,6 +2779,9 @@ void VMK::logSystem(std::string prefix, ESMC_LogMsgType_Flag msgType){
}
msg.str(""); // clear
#ifndef ESMF_MPIUNI
// initialize the MPI tool interface
int provided_thread_level;
MPI_T_init_thread(VM_MPI_THREAD_LEVEL, &provided_thread_level);
msg << prefix << "--- VMK::logSystem() MPI Control Variables ---------------";
ESMC_LogDefault.Write(msg.str(), msgType);
int num_cvar;
Expand Down Expand Up @@ -2837,6 +2817,7 @@ void VMK::logSystem(std::string prefix, ESMC_LogMsgType_Flag msgType){
msg << prefix << "new MPIR_CVAR_NEMESIS_SHM_EAGER_MAX_SZ=" << eagersize;
ESMC_LogDefault.Write(msg.str(), msgType);
#endif
MPI_T_finalize();
#endif
msg.str(""); // clear
msg << prefix << "--- VMK::logSystem() end ---------------------------------";
Expand Down
18 changes: 16 additions & 2 deletions src/Infrastructure/VM/tests/ESMF_VMUTest.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,20 @@ program ESMF_VMUTest
call ESMF_VMPrint(vm, rc=rc)
call ESMF_Test((rc.eq.ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)

!------------------------------------------------------------------------
!NEX_UTest
write(name, *) "VMLog w/ prefix"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_VMLog(vm, prefix="TestVMLog: ", rc=rc)
call ESMF_Test((rc == ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)

!------------------------------------------------------------------------
!NEX_UTest
write(name, *) "VMLogSystem w/ prefix"
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_VMLogSystem(prefix="TestVMLogSystem: ", rc=rc)
call ESMF_Test((rc == ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)

!------------------------------------------------------------------------
!NEX_UTest
write(failMsg, *) "Did not return ESMF_SUCCESS"
Expand Down Expand Up @@ -1469,10 +1483,10 @@ program ESMF_VMUTest
write(failMsg, *) "Did not return ESMF_SUCCESS"
call ESMF_VMLogMemInfo(prefix="TestPrefix", log=log, rc=rc)
call ESMF_Test((rc == ESMF_SUCCESS), name, failMsg, result, ESMF_SRCLINE)

call ESMF_LogClose(log, rc=rc)
if (rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT)

#endif
call ESMF_TestEnd(ESMF_SRCLINE)

Expand Down

0 comments on commit 519fb64

Please sign in to comment.