MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / WriteCommStats

Method WriteCommStats

Src/Base/AMReX_BLProfiler.cpp:1165–1337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1163
1164
1165void BLProfiler::WriteCommStats(bool bFlushing, bool memCheck)
1166{
1167 amrex::ignore_unused(bFlushing);
1168 Real wcsStart(amrex::second());
1169 bool bAllCFTypesExcluded(OnExcludeList(AllCFTypes));
1170 if( ! bAllCFTypesExcluded) {
1171 CommStats::cftExclude.insert(AllCFTypes); // temporarily
1172 }
1173
1174 if(memCheck) {
1175 int nCS(vCommStats.size());
1176 ParallelDescriptor::ReduceIntMax(nCS);
1177 if(nCS < csFlushSize) {
1178 if( ! bAllCFTypesExcluded) {
1179 CommStats::cftExclude.erase(AllCFTypes);
1180 }
1181 amrex::Print() << "Bypassing comm stats flush, nCS < csFlushSize: " << nCS
1182 << " " << csFlushSize << "\n";
1183 return;
1184 } else {
1185 amrex::Print() << "Flushing commstats: nCSmax csFlushSize = " << nCS
1186 << " " << csFlushSize << "\n";
1187 }
1188 }
1189
1190 std::string cdir(blProfDirName);
1191 std::string commprofPrefix("bl_comm_prof");
1192 if( ! blProfDirCreated) {
1193 amrex::UtilCreateCleanDirectory(cdir);
1194 blProfDirCreated = true;
1195 }
1196
1197 bool bUseRelativeTimeStamp(true);
1198 if(bUseRelativeTimeStamp) {
1199 for(int ics(0); ics < BLProfiler::vCommStats.size(); ++ics) {
1200 CommStats &cs = BLProfiler::vCommStats[ics];
1201 cs.timeStamp -= startTime;
1202 }
1203 }
1204
1205
1206 const int myProc = ParallelDescriptor::MyProc();
1207 const int nProcs = ParallelDescriptor::NProcs();
1208 const int nOutFiles = std::max(1, std::min(nProcs, nProfFiles));
1209
1210 // ---- write the global header
1211 if(ParallelDescriptor::IOProcessor() && bFirstCommWrite) {
1212 std::string globalHeaderFileName(cdir + '/' + commprofPrefix + "_H");
1213 std::ofstream csGlobalHeaderFile;
1214 csGlobalHeaderFile.open(globalHeaderFileName.c_str(), std::ios::out | std::ios::trunc);
1215 if( ! csGlobalHeaderFile.good()) {
1216 amrex::FileOpenFailed(globalHeaderFileName);
1217 }
1218 csGlobalHeaderFile << "CommProfVersion " << CommStats::csVersion << '\n';
1219 csGlobalHeaderFile << "NProcs " << nProcs << '\n';
1220 csGlobalHeaderFile << "CommStatsSize " << sizeof(CommStats) << '\n';
1221 csGlobalHeaderFile << "NOutFiles " << nOutFiles << '\n';
1222#ifndef BL_AMRPROF

Callers

nothing calls this directly

Calls 15

secondFunction · 0.85
ReduceIntMaxFunction · 0.85
PrintClass · 0.85
IOProcessorFunction · 0.85
ConcatenateFunction · 0.85
BarrierFunction · 0.85
ReadyToWriteMethod · 0.80
SeekPosMethod · 0.80
MyProcFunction · 0.70
NProcsFunction · 0.70
insertMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected