Changeset 2576
- Timestamp:
- 09/19/23 09:51:42 (16 months ago)
- Location:
- XIOS3/trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS3/trunk/src/client.cpp
r2547 r2576 521 521 522 522 CXios::getMpiGarbageCollector().release() ; // release unfree MPI ressources 523 CCommTrack::dumpComm() ; 523 524 if (!is_MPI_Initialized) 524 525 { -
XIOS3/trunk/src/mpi.hpp
r1759 r2576 31 31 #include "mpi_tools.hpp" 32 32 33 inline int MPI_Comm_dup(MPI_Comm comm, MPI_Comm * newcomm) 34 { 35 int ret=PMPI_Comm_dup(comm, newcomm) ; 36 xios::CCommTrack::registerComm(*newcomm) ; 37 return ret ; 38 } 39 40 inline int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader, 41 MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm * newintercomm) 42 { 43 int ret=PMPI_Intercomm_create(local_comm, local_leader, peer_comm, remote_leader, tag, newintercomm) ; 44 xios::CCommTrack::registerComm(*newintercomm) ; 45 return ret ; 46 } 47 48 inline int MPI_Intercomm_merge(MPI_Comm intercomm, int high, MPI_Comm * newintracomm) 49 { 50 int ret=PMPI_Intercomm_merge(intercomm, high, newintracomm) ; 51 xios::CCommTrack::registerComm(*newintracomm) ; 52 return ret ; 53 } 54 55 inline int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm * newcomm) 56 { 57 int ret=PMPI_Comm_split(comm, color, key,newcomm) ; 58 xios::CCommTrack::registerComm(*newcomm) ; 59 return ret ; 60 } 61 62 inline int MPI_Comm_create(MPI_Comm comm, MPI_Group group, MPI_Comm *newcomm) 63 { 64 int ret=PMPI_Comm_create(comm, group, newcomm) ; 65 xios::CCommTrack::registerComm(*newcomm) ; 66 return ret ; 67 } 68 69 inline int MPI_Comm_free(MPI_Comm *comm) 70 { 71 xios::CCommTrack::releaseComm(*comm) ; 72 return PMPI_Comm_free(comm) ; 73 } 74 75 33 76 #endif -
XIOS3/trunk/src/mpi_tools.cpp
r2507 r2576 1 1 #include "mpi.hpp" 2 #include " mpi_tools.hpp"3 4 2 #include "backtrace.hpp" 3 #include "exception.hpp" 4 #include "log.hpp" 5 5 #include <string> 6 #include <sstream> 6 7 7 8 namespace xios 8 9 { 10 std::map<MPI_Comm,string> CCommTrack::commTrack_ ; 11 void CCommTrack::registerComm(const MPI_Comm& comm) 12 { 13 auto it = commTrack_.find(comm) ; 14 if (it == commTrack_.end()) commTrack_[comm] = MemTrack::backTrace(3); 15 else ERROR("CCommtrack::registerComm", << "Communicator already allocated : " << endl<<it->second) 16 } 17 18 void CCommTrack::releaseComm(const MPI_Comm& comm) 19 { 20 auto it = commTrack_.find(comm) ; 21 if (it == commTrack_.end()) ERROR("CCommtrack::releaseComm", << "Communicator not allocated : " << endl) 22 else commTrack_.erase(it) ; 23 } 24 25 void CCommTrack::dumpComm(void) 26 { 27 ostringstream ostr ; 28 ostr<<" LIST of UNFREED MPI COMMUNICATORS"<<endl ; 29 for(auto& it : commTrack_ ) 30 { 31 ostr<<"---------------------------"<<endl ; 32 ostr<<" -- unfreed communicator --"<<endl ; 33 ostr<<" -- backtrace --"<<endl ; 34 ostr<<it.second<<endl ; 35 } 36 info(100)<<ostr.str() ; 37 } 38 9 39 int MPI_Bcast_string(std::string& str, int root, MPI_Comm comm) 10 40 { -
XIOS3/trunk/src/mpi_tools.hpp
r2118 r2576 3 3 4 4 #include <string> 5 #include <map> 5 6 6 7 namespace xios … … 33 34 MPI_Datatype MPI_GetType<long double>(void); 34 35 36 class CCommTrack 37 { 38 private: 39 static std::map<MPI_Comm,std::string> commTrack_ ; 40 41 public: 42 static void registerComm(const MPI_Comm& comm) ; 35 43 44 static void releaseComm(const MPI_Comm& comm) ; 45 46 static void dumpComm(void) ; 47 48 static const std::map<MPI_Comm,std::string>& getCommTrack(void) {return commTrack_ ;} 49 } ; 36 50 } 37 51 #endif -
XIOS3/trunk/src/server.cpp
r2547 r2576 602 602 603 603 CMemChecker::logMem( "CServer::finalize", true ); 604 605 CCommTrack::dumpComm() ; 606 604 607 if (!is_MPI_Initialized) 605 608 {
Note: See TracChangeset
for help on using the changeset viewer.