Changeset 2576 for XIOS3/trunk/src/mpi_tools.cpp
- Timestamp:
- 09/19/23 09:51:42 (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 {
Note: See TracChangeset
for help on using the changeset viewer.