3#include <AMReX_Config.H>
7#define BL_PROFILE_PASTE2(x, y) x##y
8#define BL_PROFILE_PASTE(x, y) BL_PROFILE_PASTE2(x, y)
35 ProfStats() : nCalls(0), totalTime(0.0), minTime(0.0),
36 maxTime(0.0), avgTime(0.0), variance(0.0) { }
38 Real totalTime, minTime, maxTime, avgTime, variance;
42 CallStats() : callStackDepth(-2), csFNameNumber(-2),
43 nCSCalls(0), totalTime(0.0),
44 stackTime(0.0), callTime(0.0) { }
45 CallStats(
int depth,
int fnamenumber) : callStackDepth(depth),
46 csFNameNumber(fnamenumber),
47 nCSCalls(0), totalTime(0.0),
48 stackTime(0.0), callTime(0.0) { }
49 CallStats(
int depth,
int fnamenumber,
int ncalls, Real totaltime,
50 Real stacktime, Real calltime) : callStackDepth(depth),
51 csFNameNumber(fnamenumber),
52 nCSCalls(ncalls), totalTime(totaltime),
53 stackTime(stacktime), callTime(calltime) { }
54 int callStackDepth, csFNameNumber;
56 Real totalTime, stackTime, callTime;
58 static int cstatsVersion;
59 static Real minCallTime, maxCallTime;
62 struct CallStatsStack {
63 CallStatsStack() : bFlushed(
false), index(-1) { }
64 CallStatsStack(
int idx) : bFlushed(
false), index(idx) { }
69 struct CallStatsPatch {
70 CallStatsPatch() : seekPos(-1), callStats(), fileName(
"") { }
71 CallStatsPatch(Long spos,
const CallStats &cs,
const std::string &fname)
72 : seekPos(spos), callStats(cs), fileName(fname) { }
80 : rssTime(0.0), rssRNumber(-2), rssStart(
false) { }
81 RStartStop(Real t,
int r,
bool s)
82 : rssTime(t), rssRNumber(r), rssStart(
s) { }
137 CommStats() : cfType(InvalidCFT), size(-2), commpid(-2), tag(-2),
139 CommStats(CommFuncType cft,
int sz,
int cpid,
int tg, Real ts)
140 : cfType(cft), size(sz), commpid(cpid), tag(tg),
143 static std::string CFTToString(CommFuncType cft);
144 static CommFuncType StringToCFT(
const std::string &
s);
145 static void Filter(CommFuncType cft);
146 static void UnFilter(CommFuncType cft);
148 static std::map<std::string, CommFuncType> cftNames;
149 static std::set<CommFuncType> cftExclude;
150 static int barrierNumber;
151 static int reductionNumber;
152 static int tagWrapNumber;
155 static Vector<std::pair<std::string,int> > barrierNames;
156 static Vector<std::pair<int,int> > nameTags;
157 static Vector<std::string> nameTagNames;
158 static Vector<int> tagWraps;
159 static int csVersion;
162 int size, commpid, tag;
166 static std::map<std::string, BLProfiler *> mFortProfs;
167 static Vector<std::string> mFortProfsErrors;
168 static Vector<BLProfiler *> mFortProfsInt;
169 static Vector<std::string> mFortProfsIntNames;
171 explicit BLProfiler(
const std::string &funcname);
172 BLProfiler(
const std::string &funcname,
bool bstart);
178 static void Finalize(
bool bFlushing =
false,
bool memCheck =
false);
180 static void WriteBaseProfile(
bool bFlushing =
false,
bool memCheck =
false);
181 static void WriteCallTrace(
bool bFlushing =
false,
bool memCheck =
false);
182 static void WriteCommStats(
bool bFlushing =
false,
bool memCheck =
false);
183 static void WriteFortProfErrors();
185 static void AddCommStat(
const CommFuncType cft,
const int size,
186 const int pid,
const int tag);
187 static void AddWait(
const CommFuncType cft,
const MPI_Request &reqs,
188 const MPI_Status &status,
const bool bc);
189 static void AddWaitsome(
const CommFuncType cft,
const Vector<MPI_Request> &reqs,
190 const int completed,
const Vector<MPI_Status> &status,
192 static void AddBarrier(
const std::string &message,
const bool bc);
193 static void AddNameTag(
const std::string &name);
194 static void AddAllReduce(
const CommFuncType cft,
const int size,
const bool bc);
195 static void TagRange(
const int tagmin,
const int tagmax);
196 static void AddTagWrap();
198 static void InitAMR(
const int flev,
const int mlev,
const Vector<IntVect> &rr,
199 const Vector<Box> pd);
206 static void ChangeFortIntName(
const std::string &fname,
int intname);
209 const bool writefabs);
210 static void AddStep(
const int snum);
211 static Real GetRunTime() {
return calcRunTime; }
212 static void SetRunTime(
Real rtime) { calcRunTime = rtime; }
214 static void RegionStart(
const std::string &rname);
215 static void RegionStop(
const std::string &rname);
217 static inline int NoTag() {
return -3; }
218 static inline int BeforeCall() {
return -5; }
219 static inline int AfterCall() {
return -7; }
221 static inline int ProcNumber() {
return procNumber; }
222 static void SetBlProfDirName(
const std::string &name) { blProfDirName = name; }
223 static void SetNoOutput() { bNoOutput =
true; }
225 static int GetBaseFlushSize() {
return baseFlushSize; }
226 static void SetBaseFlushSize(
int fsize) { baseFlushSize = fsize; }
227 static int GetCSFlushSize() {
return csFlushSize; }
228 static void SetCSFlushSize(
int fsize) { csFlushSize = fsize; }
229 static int GetTraceFlushSize() {
return traceFlushSize; }
230 static void SetTraceFlushSize(
int fsize) { traceFlushSize = fsize; }
232 static int GetFlushInterval() {
return flushInterval; }
233 static void SetFlushInterval(
int finterval) { flushInterval = finterval; }
234 static Real GetFlushTimeInterval() {
return flushTimeInterval; }
235 static void SetFlushTimeInterval(
Real ftinterval) { flushTimeInterval = ftinterval; }
237 static void SetNFiles(
int nfiles) { nProfFiles = nfiles; }
238 static int GetNFiles() {
return nProfFiles; }
241 Real bltstart, bltelapsed;
245 static bool bWriteAll, bWriteFabs, groupSets;
246 static bool bFirstCommWrite;
247 static bool bInitialized, bNoOutput;
248 static bool bFlushPrint;
249 static int currentStep, nProfFiles;
250 static int baseFlushSize, csFlushSize, traceFlushSize;
251 static int baseFlushCount, csFlushCount, traceFlushCount, flushInterval;
252 static int finestLevel, maxLevel;
253 static Real pctTimeLimit;
254 static Real calcRunTime;
255 static Real startTime;
256 static Real timerTime;
257 static Real flushTimeInterval;
259 static Vector<IntVect> refRatio;
260 static Vector<Box> probDomain;
262 static std::stack<Real> nestedTimeStack;
263 static std::map<int, Real> mStepMap;
264 static std::map<std::string, ProfStats> mProfStats;
265 static Vector<CommStats> vCommStats;
266 static std::string procName;
267 static int procNumber;
268 static bool blProfDirCreated;
269 static std::string blProfDirName;
270 static int BLProfVersion;
272 static bool OnExcludeList(CommFuncType cft);
273 static int NameTagNameIndex(
const std::string &name);
275 static std::map<std::string, int> mFNameNumbers;
276 static Vector<CallStats> vCallTrace;
279 static std::map<std::string, int> mRegionNameNumbers;
280 static int inNRegions;
281 static Vector<RStartStop> rStartStop;
282 static const std::string noRegionName;
284 static bool bFirstTraceWrite;
286 static Vector<CallStatsStack> callIndexStack;
287 static Vector<CallStatsPatch> callIndexPatch;
289#ifdef BL_TRACE_PROFILING
290 static int callStackDepth;
291 static int prevCallStackDepth;
294 using RIpair = std::pair<Real, int>;
296 bool operator()(
const RIpair &lhs,
const RIpair &rhs)
const {
297 return lhs.first > rhs.first;
308 BLProfileRegion (
const std::string& a_regname)
311 BLProfiler::RegionStart(regname);
314 ~BLProfileRegion () { BLProfiler::RegionStop(regname); }
320namespace BLProfilerUtils {
321 void WriteHeader(std::ostream &os,
const int colWidth,
322 const Real maxlen,
const bool bwriteavg);
324 void WriteRow(std::ostream &os,
const std::string &fname,
325 const BLProfiler::ProfStats &pstats,
const Real percent,
326 const int colWidth,
const Real maxlen,
327 const bool bwriteavg);
329 void WriteStats(std::ostream &os,
330 const std::map<std::string, BLProfiler::ProfStats> &mpStats,
331 const std::map<std::string, int> &fnameNumbers,
332 const Vector<BLProfiler::CallStats> &callTraces,
333 bool bwriteavg =
false,
bool bwriteinclusivetimes =
false);
337std::ostream &
operator<< (std::ostream &os,
const BLProfiler::CommStats &cs);
340inline std::string BLProfiler::CommStats::CFTToString(CommFuncType cft) {
342 case InvalidCFT:
return "InvalidCFT";
343 case AllReduceT:
return "AllReduceT";
344 case AllReduceR:
return "AllReduceR";
345 case AllReduceL:
return "AllReduceL";
346 case AllReduceI:
return "AllReduceI";
347 case AsendTsii:
return "AsendTsii";
348 case AsendTsiiM:
return "AsendTsiiM";
349 case AsendvTii:
return "AsendvTii";
350 case SendTsii:
return "SendTsii";
351 case SendvTii:
return "SendvTii";
352 case ArecvTsii:
return "ArecvTsii";
353 case ArecvTsiiM:
return "ArecvTsiiM";
354 case ArecvTii:
return "ArecvTii";
355 case ArecvvTii:
return "ArecvvTii";
356 case RecvTsii:
return "RecvTsii";
357 case RecvvTii:
return "RecvvTii";
358 case ReduceT:
return "ReduceT";
359 case ReduceR:
return "ReduceR";
360 case ReduceL:
return "ReduceL";
361 case ReduceI:
return "ReduceI";
362 case BCastTsi:
return "BCastTsi";
363 case GatherTsT1Si:
return "GatherTsT1Si";
364 case GatherTi:
return "GatherTi";
365 case GatherRiRi:
return "GatherRiRi";
366 case ScatterTsT1si:
return "ScatterTsT1si";
367 case Barrier:
return "Barrier";
368 case Waitsome:
return "Waitsome";
369 case NameTag:
return "NameTag";
370 case AllCFTypes:
return "AllCFTypes";
371 case NoCFTypes:
return "NoCFTypes";
372 case IOStart:
return "IOStart";
373 case IOEnd:
return "IOEnd";
374 case TagWrap:
return "TagWrap";
375 case Allgather:
return "Allgather";
376 case Alltoall:
return "Alltoall";
377 case Alltoallv:
return "Alltoallv";
378 case Gatherv:
return "Gatherv";
379 case Get_count:
return "Get_count";
380 case Iprobe:
return "Iprobe";
381 case Test:
return "Test";
382 case Wait:
return "Wait";
383 case Waitall:
return "Waitall";
384 case Waitany:
return "Waitany";
385 case NUMBER_OF_CFTS:
return "NUMBER_OF_CFTS";
387 return "*** Error: Bad CommFuncType.";
392#define BL_PROFILE_INITIALIZE() amrex::BLProfiler::Initialize();
393#define BL_PROFILE_INITPARAMS() amrex::BLProfiler::InitParams(); amrex::BLProfileSync::InitParams()
394#define BL_PROFILE_FINALIZE() amrex::BLProfiler::Finalize();
396#define BL_TINY_PROFILE_INITIALIZE()
397#define BL_TINY_PROFILE_FINALIZE()
399#define BL_TINY_PROFILE_MEMORYINITIALIZE()
400#define BL_TINY_PROFILE_MEMORYFINALIZE()
402#define BL_PROFILE(fname) amrex::BLProfiler bl_profiler_((fname));
403#define BL_PROFILE_T(fname, T) amrex::BLProfiler bl_profiler_((std::string(fname) + typeid(T).name()));
404#ifdef BL_PROFILING_SPECIAL
405#define BL_PROFILE_S(fname) amrex::BLProfiler bl_profiler_((fname));
406#define BL_PROFILE_T_S(fname, T) amrex::BLProfiler bl_profiler_((std::string(fname) + typeid(T).name()));
408#define BL_PROFILE_S(fname)
409#define BL_PROFILE_T_S(fname, T)
412#define BL_PROFILE_VAR(fname, vname) amrex::BLProfiler bl_profiler_##vname((fname));
413#define BL_PROFILE_VAR_NS(fname, vname) amrex::BLProfiler bl_profiler_##vname(fname, false);
414#define BL_PROFILE_VAR_START(vname) bl_profiler_##vname.start();
415#define BL_PROFILE_VAR_STOP(vname) bl_profiler_##vname.stop();
417#define BL_PROFILE_GPU_SYNC(fname) \
418 AMREX_WARNING_PUSH_COUNTER \
419 BL_PROFILE_GPU_SYNC_IMPL(fname, __COUNTER__) \
421#define BL_PROFILE_GPU_SYNC_IMPL(funame, counter) amrex::BLProfiler BL_PROFILE_PASTE(bl_profiler_, counter)((funame));
422#define BL_PROFILE_VAR_GPU_SYNC(fname, vname) BL_PROFILE_VAR(fname, vname)
423#define BL_PROFILE_VAR_NS_GPU_SYNC(fname, vname) BL_PROFILE_VAR_NS(fname, vname)
425#define BL_PROFILE_INIT_PARAMS(ptl,wall,wfabs) \
426 amrex::BLProfiler::InitParams(ptl,wall, wfabs);
427#define BL_PROFILE_ADD_STEP(snum) amrex::BLProfiler::AddStep(snum);
428#define BL_PROFILE_SET_RUN_TIME(rtime) amrex::BLProfiler::SetRunTime(rtime);
430#define BL_PROFILE_REGION(rname) \
431 AMREX_WARNING_PUSH_COUNTER \
432 amrex::BLProfileRegion BL_PROFILE_PASTE(bl_profile_region_, __COUNTER__)((rname)); \
434#define BL_PROFILE_REGION_GPU_SYNC(rname) BL_PROFILE_REGION(rname)
436#define BL_PROFILE_REGION_START(rname) amrex::BLProfiler::RegionStart(rname);
437#define BL_PROFILE_REGION_STOP(rname) amrex::BLProfiler::RegionStop(rname);
440#define BL_PROFILE_REGION_VAR(fname, rvname) amrex::BLProfiler::RegionStart(fname); \
441 amrex::BLProfiler bl_profiler_##rvname((fname));
442#define BL_PROFILE_REGION_VAR_START(fname, rvname) amrex::BLProfiler::RegionStart(fname); \
443 bl_profiler_##rvname.start();
444#define BL_PROFILE_REGION_VAR_STOP(fname, rvname) bl_profiler_##rvname.stop(); \
445 amrex::BLProfiler::RegionStop(fname);
447#define BL_PROFILE_TINY_FLUSH()
448#define BL_PROFILE_FLUSH() { amrex::BLProfiler::Finalize(true); }
450#define BL_TRACE_PROFILE_FLUSH() { amrex::BLProfiler::WriteCallTrace(true, true); }
451#define BL_TRACE_PROFILE_SETFLUSHSIZE(fsize) { amrex::BLProfiler::SetTraceFlushSize(fsize); }
453#define BL_PROFILE_CHANGE_FORT_INT_NAME(fname, intname) { amrex::BLProfiler::ChangeFortIntName(fname, intname); }
455#ifdef BL_COMM_PROFILING
457#define BL_COMM_PROFILE(cft, size, pid, tag) { \
458 amrex::BLProfiler::AddCommStat(cft, size, pid, tag); \
460#define BL_COMM_PROFILE_BARRIER(message, bc) { amrex::BLProfiler::AddBarrier(message, bc); }
461#define BL_COMM_PROFILE_ALLREDUCE(cft, size, bc) { amrex::BLProfiler::AddAllReduce(cft, size, bc); }
462#define BL_COMM_PROFILE_REDUCE(cft, size, pid) { \
463 amrex::BLProfiler::AddCommStat(cft, size, pid, amrex::BLProfiler::NoTag()); }
464#define BL_COMM_PROFILE_WAIT(cft, reqs, status, bc) { \
465 amrex::BLProfiler::AddWait(cft, reqs, status, bc); \
467#define BL_COMM_PROFILE_WAITSOME(cft, reqs, completed, status, bc) { \
468 amrex::BLProfiler::AddWaitsome(cft, reqs, completed, status, bc); \
470#define BL_COMM_PROFILE_NAMETAG(message) { amrex::BLProfiler::AddNameTag(message); }
471#define BL_COMM_PROFILE_FILTER(cft) { amrex::BLProfiler::CommStats::Filter(cft); }
472#define BL_COMM_PROFILE_UNFILTER(cft) { amrex::BLProfiler::CommStats::UnFilter(cft); }
473#define BL_COMM_PROFILE_FLUSH() { amrex::BLProfiler::WriteCommStats(true, true); }
474#define BL_COMM_PROFILE_SETFLUSHSIZE(fsize) { amrex::BLProfiler::SetCSFlushSize(fsize); }
475#define BL_COMM_PROFILE_TAGRANGE(tagmin, tagmax) { \
476 amrex::BLProfiler::TagRange(tagmin, tagmax); }
477#define BL_COMM_PROFILE_TAGWRAP() { amrex::BLProfiler::AddTagWrap(); }
478#define BL_COMM_PROFILE_INITAMR(flev, mlev, rr, pd) { \
479 amrex::BLProfiler::InitAMR(flev, mlev, rr, pd); \
486#elif defined(AMREX_TINY_PROFILING)
491#define BL_PROFILE_INITIALIZE()
492#define BL_PROFILE_INITPARAMS()
493#define BL_PROFILE_FINALIZE()
495#define BL_TINY_PROFILE_INITIALIZE() amrex::TinyProfiler::Initialize(); amrex::BLProfileSync::InitParams()
496#define BL_TINY_PROFILE_FINALIZE() amrex::TinyProfiler::Finalize()
498#define BL_TINY_PROFILE_MEMORYINITIALIZE() amrex::TinyProfiler::MemoryInitialize()
499#define BL_TINY_PROFILE_MEMORYFINALIZE() amrex::TinyProfiler::MemoryFinalize()
501#define BL_PROFILE(fname) \
502 AMREX_WARNING_PUSH_COUNTER \
503 BL_PROFILE_IMPL(fname, __COUNTER__) \
505#define BL_PROFILE_IMPL(funame, counter) amrex::TinyProfiler BL_PROFILE_PASTE(tiny_profiler_, counter)((funame)); \
506 amrex::ignore_unused(BL_PROFILE_PASTE(tiny_profiler_, counter));
508#define BL_PROFILE_T(a, T)
509#define BL_PROFILE_S(fname)
510#define BL_PROFILE_T_S(fname, T)
512#define BL_PROFILE_VAR(fname, vname) amrex::TinyProfiler tiny_profiler_##vname((fname))
513#define BL_PROFILE_VAR_NS(fname, vname) amrex::TinyProfiler tiny_profiler_##vname(fname, false)
514#define BL_PROFILE_VAR_START(vname) tiny_profiler_##vname.start()
515#define BL_PROFILE_VAR_STOP(vname) tiny_profiler_##vname.stop()
517#define BL_PROFILE_GPU_SYNC(fname) \
518 AMREX_WARNING_PUSH_COUNTER \
519 BL_PROFILE_GPU_SYNC_IMPL(fname, __COUNTER__) \
521#define BL_PROFILE_GPU_SYNC_IMPL(funame, counter) amrex::TinyProfiler BL_PROFILE_PASTE(tiny_profiler_, counter)((funame), true, true); \
522 amrex::ignore_unused(BL_PROFILE_PASTE(tiny_profiler_, counter));
523#define BL_PROFILE_VAR_GPU_SYNC(fname, vname) amrex::TinyProfiler tiny_profiler_##vname((fname), true, true)
524#define BL_PROFILE_VAR_NS_GPU_SYNC(fname, vname) amrex::TinyProfiler tiny_profiler_##vname((fname), false, true)
526#define BL_PROFILE_GPU_SYNC(fname) BL_PROFILE(fname)
527#define BL_PROFILE_VAR_GPU_SYNC(fname, vname) BL_PROFILE_VAR(fname, vname)
528#define BL_PROFILE_VAR_NS_GPU_SYNC(fname, vname) BL_PROFILE_VAR_NS(fname, vname)
530#define BL_PROFILE_INIT_PARAMS(ptl,wall,wfabs)
531#define BL_PROFILE_ADD_STEP(snum)
532#define BL_PROFILE_SET_RUN_TIME(rtime)
533#define BL_PROFILE_REGION(rname) \
534 AMREX_WARNING_PUSH_COUNTER \
535 amrex::TinyProfileRegion BL_PROFILE_PASTE(tiny_profile_region_, __COUNTER__)((rname)); \
538#define BL_PROFILE_REGION_GPU_SYNC(rname) \
539 AMREX_WARNING_PUSH_COUNTER \
540 amrex::TinyProfileRegion BL_PROFILE_PASTE(tiny_profile_region_, __COUNTER__)((rname), true); \
543#define BL_PROFILE_REGION_GPU_SYNC(rname) BL_PROFILE_REGION(rname)
545#define BL_PROFILE_REGION_START(rname)
546#define BL_PROFILE_REGION_STOP(rname)
549#define BL_PROFILE_REGION_VAR(fname, rvname)
550#define BL_PROFILE_REGION_VAR_START(fname, rvname)
551#define BL_PROFILE_REGION_VAR_STOP(fname, rvname)
552#define BL_PROFILE_TINY_FLUSH() amrex::TinyProfiler::Finalize(true); amrex::TinyProfiler::MemoryFinalize(true)
553#define BL_PROFILE_FLUSH()
554#define BL_TRACE_PROFILE_FLUSH()
555#define BL_TRACE_PROFILE_SETFLUSHSIZE(fsize)
556#define BL_PROFILE_CHANGE_FORT_INT_NAME(fname, intname)
583#define BL_PROFILE_INITIALIZE()
584#define BL_PROFILE_INITPARAMS()
585#define BL_PROFILE_FINALIZE()
587#define BL_TINY_PROFILE_INITIALIZE()
588#define BL_TINY_PROFILE_FINALIZE()
590#define BL_TINY_PROFILE_MEMORYINITIALIZE()
591#define BL_TINY_PROFILE_MEMORYFINALIZE()
594#define BL_PROFILE_T(a, T)
595#define BL_PROFILE_S(fname)
596#define BL_PROFILE_T_S(fname, T)
597#define BL_PROFILE_TIMER(var, a)
598#define BL_PROFILE_START(var)
599#define BL_PROFILE_STOP(var)
600#define BL_PROFILE_THIS_NAME()
602#define BL_PROFILE_VAR(fname, vname)
603#define BL_PROFILE_VAR_NS(fname, vname)
604#define BL_PROFILE_VAR_START(vname)
605#define BL_PROFILE_VAR_STOP(vname)
606#define BL_PROFILE_GPU_SYNC(fname)
607#define BL_PROFILE_VAR_GPU_SYNC(fname, vname)
608#define BL_PROFILE_VAR_NS_GPU_SYNC(fname, vname)
609#define BL_PROFILE_INIT_PARAMS(ptl,wall,wfabs)
610#define BL_PROFILE_ADD_STEP(snum)
611#define BL_PROFILE_SET_RUN_TIME(rtime)
612#define BL_PROFILE_REGION(rname)
613#define BL_PROFILE_REGION_GPU_SYNC(rname)
614#define BL_PROFILE_REGION_START(rname)
615#define BL_PROFILE_REGION_STOP(rname)
616#define BL_PROFILE_REGION_VAR(fname, rvname)
617#define BL_PROFILE_REGION_VAR_START(fname, rvname)
618#define BL_PROFILE_REGION_VAR_STOP(fname, rvname)
619#define BL_PROFILE_TINY_FLUSH()
620#define BL_PROFILE_FLUSH()
621#define BL_TRACE_PROFILE_FLUSH()
622#define BL_TRACE_PROFILE_SETFLUSHSIZE(fsize)
623#define BL_PROFILE_CHANGE_FORT_INT_NAME(fname, intname)
632#ifndef AMREX_TINY_PROFILING
639 [[nodiscard]]
static const char*
CurrentName () noexcept {
return nullptr; }
649#ifndef BL_COMM_PROFILING
651#define BL_COMM_PROFILE(cft, size, pid, tag)
652#define BL_COMM_PROFILE_BARRIER(message, bc)
653#define BL_COMM_PROFILE_ALLREDUCE(cft, size, bc)
654#define BL_COMM_PROFILE_REDUCE(cft, size, pid)
655#define BL_COMM_PROFILE_WAIT(cft, reqs, status, bc)
656#define BL_COMM_PROFILE_WAITSOME(cft, reqs, completed, status, bc)
657#define BL_COMM_PROFILE_NAMETAG(message)
658#define BL_COMM_PROFILE_FILTER(cft)
659#define BL_COMM_PROFILE_UNFILTER(cft)
660#define BL_COMM_PROFILE_FLUSH()
661#define BL_COMM_PROFILE_SETFLUSHSIZE(fsize)
662#define BL_COMM_PROFILE_TAGRANGE(tagmin, tagmax)
663#define BL_COMM_PROFILE_TAGWRAP()
664#define BL_COMM_PROFILE_INITAMR(flev, mlev, rr, pd)
672#if (defined(BL_PROFILING) || defined(AMREX_TINY_PROFILING))
676 class BLProfileSync {
679 static void Sync()
noexcept;
680 static void Sync(
const std::string& name)
noexcept;
681 static void Sync(
const char* name)
noexcept;
683 static void InitParams();
685 static void StartSyncRegion()
noexcept;
686 static void StartSyncRegion(
const std::string& name)
noexcept;
687 static void StartSyncRegion(
const char* name)
noexcept;
688 static void EndSyncRegion()
noexcept;
691 static int sync_counter;
692 static int use_prof_syncs;
697#define BL_PROFILE_SYNC() amrex::BLProfileSync::Sync()
698#define BL_PROFILE_SYNC_TIMED(fname) amrex::BLProfileSync::Sync(fname)
699#define BL_PROFILE_SYNC_START() amrex::BLProfileSync::StartSyncRegion()
700#define BL_PROFILE_SYNC_START_TIMED(fname) amrex::BLProfileSync::StartSyncRegion(fname)
701#define BL_PROFILE_SYNC_STOP() amrex::BLProfileSync::EndSyncRegion()
705#define BL_PROFILE_SYNC()
706#define BL_PROFILE_SYNC_TIMED(fname)
707#define BL_PROFILE_SYNC_START()
708#define BL_PROFILE_SYNC_START_TIMED(fname)
709#define BL_PROFILE_SYNC_STOP()
720#if defined(AMREX_VTUNE)
722#define BL_TP_PROFILE_REGION_START() __itt_resume(); \
723amrex::Print() << "VTune regional recording has begun.\n";
724#define BL_TP_PROFILE_REGION_STOP() __itt_pause(); \
725amrex::Print() << "VTune regional recording has been stopped.\n";
727#elif defined(AMREX_CRAYPAT)
729#define BL_TP_PROFILE_REGION_START() PAT_record(PAT_STATE_ON); \
730amrex::Print() << "CrayPat regional recording has begun.\n";
731#define BL_TP_PROFILE_REGION_STOP() PAT_record(PAT_STATE_OFF); \
732amrex::Print() << "CrayPat regional recording has been stopped.\n";
734#elif defined(AMREX_FORGE)
736#define BL_TP_PROFILE_REGION_START() allinea_start_sampling(); \
737amrex::Print() << "MAP regional recording has begun.\n";
738#define BL_TP_PROFILE_REGION_STOP() allinea_stop_sampling(); \
739amrex::Print() << "MAP regional recording has begun.\n";
743#define BL_TP_PROFILE_REGION_START()
744#define BL_TP_PROFILE_REGION_STOP()
Runtime initialization/finalization helpers and global diagnostics.
Fixed-size array types for use on GPU and CPU.
Integer-lattice boxes and helpers for defining index-space regions.
Compiler- and backend-specific extension macros (e.g., restrict, SIMD, inline).
GpuArray< MultiArray4< Real const >, 3 > s
Definition AMReX_MLEBNodeFDLaplacian.cpp:214
Definition AMReX_BLProfiler.H:566
BLProfiler(const std::string &)
Definition AMReX_BLProfiler.H:568
void start()
Definition AMReX_BLProfiler.H:574
static void Initialize()
Definition AMReX_BLProfiler.H:569
static void InitParams(const Real, const bool, const bool)
Definition AMReX_BLProfiler.H:576
static void WriteCommStats()
Definition AMReX_BLProfiler.H:573
static void AddStep(const int)
Definition AMReX_BLProfiler.H:578
static void Finalize()
Definition AMReX_BLProfiler.H:571
void stop()
Definition AMReX_BLProfiler.H:575
static void WriteStats(std::ostream &)
Definition AMReX_BLProfiler.H:572
static void InitParams()
Definition AMReX_BLProfiler.H:570
A simple profiler that returns basic performance information (e.g. min, max, and average running time...
Definition AMReX_BLProfiler.H:636
static const char * CurrentName() noexcept
Without the tiny profiler, there is no active profiler.
Definition AMReX_BLProfiler.H:639
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:80
int MPI_Request
Definition AMReX_ccse-mpi.H:54
Definition AMReX_Amr.cpp:50
std::ostream & operator<<(std::ostream &os, AmrMesh const &amr_mesh)
Stream helper; forwards to the friend declared inside AmrMesh.
Definition AMReX_AmrMesh.cpp:1372