4 #ifndef BL_COMMPROFSTATS_H
5 #define BL_COMMPROFSTATS_H
6 #include <AMReX_Config.H>
22 #include <unordered_map>
42 :
number(-1),
name(
"__uninitialized_Barrier_Entry_name__"),
74 DataBlock(
const int p,
const long s,
const std::string &fn,
const long sp,
75 const std::string &pn,
const int nn,
const int si)
100 const int rp,
const int ds,
const int tg,
101 const Real st,
const Real rt,
const Real tt)
118 std::stringstream hss;
120 return atol(hss.str().c_str());
122 inline static long HashLong(
int fp,
int tp,
int t) {
123 return(fp + tp + 64*t);
125 inline static long HashLong(
int fp,
int tp,
int ,
int t) {
138 return(fp + tp + 64*t);
145 const int rp,
const int ds,
const int tg,
146 const Real st,
const Real rt,
const Real tt)
158 void FillSendFAB(
long &totalSends,
long &totalSentData,
166 bool bDoReductions =
false);
167 void ReportStats(
long &totalSentData,
long &totalNCommStats,
170 int &minMsgSize,
int &maxMsgSize,
171 Real &timeMin, Real &timeMax, Real &timerTime,
177 const int rankMin,
const int rankMax,
178 const int rankStride,
182 const double tlo,
const double thi);
183 void SendRecvList(std::multimap<Real, SendRecvPairUnpaired> &srMMap);
185 const std::string &filename,
const long seekpos,
186 const std::string &nodename =
"",
const int nodenumber = -1);
190 virtual void AddBarrier(
long bnum,
const std::string &bname,
long index);
191 virtual void AddReduction(
const long rnum,
const long index);
192 virtual void AddTimeMinMax(
const double tmin,
const double tmax);
194 virtual void AddNameTag(
const long ntnindex,
const long seekindex);
198 virtual void AddTagRange(
const long tmin,
const long tmax);
199 virtual void AddGridLevel(
const int level,
const int ngrids);
200 virtual void AddGrid3D(
int level,
int xlo,
int ylo,
int zlo,
201 int xhi,
int yhi,
int zhi,
202 int xc,
int yc,
int zc,
203 int xn,
int yn,
int zn,
int proc);
216 virtual void AddTopoCoord(
const int nid,
const int node,
217 const int tx,
const int ty,
const int tz,
218 const bool servicenode =
false);
238 int cab,
int row,
int cage,
int slot,
241 bool IsSend(
const amrex::BLProfiler::CommFuncType &cft);
242 bool IsRecv(
const amrex::BLProfiler::CommFuncType &cft);
std::ostream & operator<<(std::ostream &os, const CommProfStats::BarrierEntry &be)
Definition: AMReX_CommProfStats.cpp:1891
Definition: AMReX_BLProfStats.H:30
Definition: AMReX_CommProfStats.H:38
static const amrex::Vector< std::string > & GetHeaderFileNames()
Definition: AMReX_CommProfStats.H:230
const std::map< int, int > & GLSizeMap() const
Definition: AMReX_CommProfStats.H:224
static int GetCSSize()
Definition: AMReX_CommProfStats.H:208
static bool persistentStreams
Definition: AMReX_CommProfStats.H:248
static void CloseAllStreams()
Definition: AMReX_CommProfStats.cpp:412
virtual void SetCSSize(const int css)
Definition: AMReX_CommProfStats.H:207
const amrex::Vector< std::string > & BarrierNames()
Definition: AMReX_CommProfStats.H:197
static amrex::Vector< std::string > commHeaderFileNames
Definition: AMReX_CommProfStats.H:263
virtual void AddProbDomain(const int lev, const amrex::Box &pd)
Definition: AMReX_CommProfStats.cpp:278
friend int yyparse(void *)
void SendRecvList(std::multimap< Real, SendRecvPairUnpaired > &srMMap)
Definition: AMReX_CommProfStats.cpp:1140
amrex::Vector< Real > edisonCPUFab
Definition: AMReX_CommProfStats.H:274
static std::map< std::string, int > commDataFileNames
Definition: AMReX_CommProfStats.H:264
const amrex::Vector< amrex::Box > & GetProbDomain() const
Definition: AMReX_CommProfStats.H:221
void SetProbDomain(const amrex::Vector< amrex::Box > &pd)
Definition: AMReX_CommProfStats.H:220
void TimelineFAB(amrex::FArrayBox &timelineFAB, const amrex::Box &probDomain, const BLProfStats::TimeRange tr, const int rankMin, const int rankMax, const int rankStride, const Real ntnMultiplier, const amrex::Vector< Real > &ntnNumbers, const Real bnMultiplier, const amrex::Vector< Real > &bnNumbers)
Definition: AMReX_CommProfStats.cpp:953
std::map< int, long > glMap
Definition: AMReX_CommProfStats.H:257
virtual void AddBarrier(long bnum, const std::string &bname, long index)
Definition: AMReX_CommProfStats.cpp:181
static bool InitDBlocks()
Definition: AMReX_CommProfStats.H:227
void ReportSyncPointData(amrex::Vector< amrex::Vector< Real > > &barrierExitTimes, amrex::Vector< amrex::Vector< Real > > &barrierWaitTimes, amrex::Vector< amrex::Vector< Real > > &reductionWaitTimes, bool bDoReductions=false)
Definition: AMReX_CommProfStats.cpp:791
static amrex::Vector< int > rankFromProx
Definition: AMReX_CommProfStats.H:260
static int cpVersion
Definition: AMReX_CommProfStats.H:247
static void InitProxMap()
Definition: AMReX_CommProfStats.cpp:314
void InitEdisonTopoMF()
Definition: AMReX_CommProfStats.cpp:1809
std::stack< double > nestedTimeStack
Definition: AMReX_CommProfStats.H:250
void SetRefRatio(const amrex::Vector< amrex::IntVect > &rr)
Definition: AMReX_CommProfStats.H:214
static int GetCPVersion()
Definition: AMReX_CommProfStats.H:206
CommProfStats()
Definition: AMReX_CommProfStats.cpp:110
static amrex::Vector< std::ifstream * > commDataStreams
Definition: AMReX_CommProfStats.H:265
static amrex::Vector< amrex::IntVect > calcRefRatios
Definition: AMReX_CommProfStats.H:254
static bool bProxMapOK
Definition: AMReX_CommProfStats.H:262
const amrex::Vector< amrex::IntVect > & GetRefRatio() const
Definition: AMReX_CommProfStats.H:215
virtual void AddTagRange(const long tmin, const long tmax)
Definition: AMReX_CommProfStats.cpp:220
virtual void AddMaxLevel(const int lev)
Definition: AMReX_CommProfStats.H:211
virtual void AddCommHeaderFileName(const std::string &hfn)
Definition: AMReX_CommProfStats.cpp:304
void WriteEdisonTopoMF()
Definition: AMReX_CommProfStats.cpp:1823
static int GetFinestLevel()
Definition: AMReX_CommProfStats.H:210
void ReportStats(long &totalSentData, long &totalNCommStats, amrex::Vector< long > &totalFuncCalls, int bytesPerSlot, amrex::Vector< long > &msgSizes, int &minMsgSize, int &maxMsgSize, Real &timeMin, Real &timeMax, Real &timerTime, amrex::Vector< int > &rankNodeNumbers)
Definition: AMReX_CommProfStats.cpp:864
const std::map< int, long > & GLMap() const
Definition: AMReX_CommProfStats.H:223
void CheckCommData(amrex::Vector< long > &nBMin, amrex::Vector< long > &nBMax, amrex::Vector< long > &nRMin, amrex::Vector< long > &nRMax)
Definition: AMReX_CommProfStats.cpp:493
virtual void AddEdisonPID(int X, int Y, int Z, int cab, int row, int cage, int slot, int cpu, int pid)
Definition: AMReX_CommProfStats.cpp:1844
bool IsSend(const amrex::BLProfiler::CommFuncType &cft)
Definition: AMReX_CommProfStats.cpp:1110
const amrex::Vector< std::string > & NameTagNames()
Definition: AMReX_CommProfStats.H:196
virtual void AddNameTagName(const std::string &name)
Definition: AMReX_CommProfStats.cpp:206
static bool bInitDataBlocks
Definition: AMReX_CommProfStats.H:259
void FillSendFAB(long &totalSends, long &totalSentData, amrex::Vector< long > &totalSendsPerProc, amrex::Vector< long > &totalSentDataPerProc, amrex::FArrayBox &sendFAB, bool proxmap)
Definition: AMReX_CommProfStats.cpp:642
static int GetMaxLevel()
Definition: AMReX_CommProfStats.H:212
static void OpenAllStreams(const std::string &dirname)
Definition: AMReX_CommProfStats.cpp:387
static int maxLevel
Definition: AMReX_CommProfStats.H:247
virtual void AddFinestLevel(const int lev)
Definition: AMReX_CommProfStats.H:209
virtual void AddReduction(const long rnum, const long index)
Definition: AMReX_CommProfStats.cpp:200
virtual void AddGrid3D(int level, int xlo, int ylo, int zlo, int xhi, int yhi, int zhi, int xc, int yc, int zc, int xn, int yn, int zn, int proc)
Definition: AMReX_CommProfStats.cpp:246
bool IsRecv(const amrex::BLProfiler::CommFuncType &cft)
Definition: AMReX_CommProfStats.cpp:1120
amrex::Vector< DataBlock > dataBlocks
Definition: AMReX_CommProfStats.H:251
virtual void AddTimeMinMax(const double tmin, const double tmax)
Definition: AMReX_CommProfStats.cpp:227
void ClearCommStats(DataBlock &dBlock)
Definition: AMReX_CommProfStats.cpp:479
void SendRecvData(const std::string &filename, const double tlo, const double thi)
Definition: AMReX_CommProfStats.cpp:1179
int tagMin
Definition: AMReX_CommProfStats.H:249
virtual void AddNameTag(const long ntnindex, const long seekindex)
Definition: AMReX_CommProfStats.cpp:214
bool IsBlockingRecv(const amrex::BLProfiler::CommFuncType &cft)
Definition: AMReX_CommProfStats.cpp:1132
void WriteTopoFab()
Definition: AMReX_CommProfStats.cpp:340
std::map< int, int > glSizeMap
Definition: AMReX_CommProfStats.H:258
amrex::Vector< Real > edisonNodeFab
Definition: AMReX_CommProfStats.H:273
static amrex::Vector< amrex::Box > probDomain
Definition: AMReX_CommProfStats.H:256
amrex::Vector< std::map< int, amrex::IntVect > > TopoMap
Definition: AMReX_CommProfStats.H:255
static void SetInitDataBlocks(bool b)
Definition: AMReX_CommProfStats.H:226
virtual void InitCommDataBlock(const int proc, const long ncommstats, const std::string &filename, const long seekpos, const std::string &nodename="", const int nodenumber=-1)
Definition: AMReX_CommProfStats.cpp:135
virtual void AddRefRatio(const int lev, const amrex::IntVect &rr)
Definition: AMReX_CommProfStats.cpp:269
virtual void AddTopoCoord(const int nid, const int node, const int tx, const int ty, const int tz, const bool servicenode=false)
Definition: AMReX_CommProfStats.cpp:287
int tagMax
Definition: AMReX_CommProfStats.H:249
virtual void AddGridLevel(const int level, const int ngrids)
Definition: AMReX_CommProfStats.cpp:241
void ReportSyncPointDataSetup(long &nBMax, long &nRMax)
Definition: AMReX_CommProfStats.cpp:766
int currentDataBlock
Definition: AMReX_CommProfStats.H:246
static amrex::Vector< int > proxFromRank
Definition: AMReX_CommProfStats.H:261
static void InitDataFileNames(const amrex::Vector< std::string > &hfn)
Definition: AMReX_CommProfStats.cpp:125
amrex::Vector< std::string > nameTagNames
Definition: AMReX_CommProfStats.H:252
virtual void AddTimerTime(const double tt)
Definition: AMReX_CommProfStats.cpp:234
amrex::Vector< std::string > barrierNames
Definition: AMReX_CommProfStats.H:253
void FindTimeRange(BLProfStats::TimeRange &tr)
Definition: AMReX_CommProfStats.cpp:944
int AfterBarrier(const int proc, const double t)
Definition: AMReX_CommProfStats.cpp:159
~CommProfStats()
Definition: AMReX_CommProfStats.cpp:120
virtual void SetCPVersion(const int cpv)
Definition: AMReX_CommProfStats.H:205
amrex::Vector< amrex::Vector< amrex::Vector< int > > > edisonNodeXYZ
Definition: AMReX_CommProfStats.H:275
static int finestLevel
Definition: AMReX_CommProfStats.H:247
static int csSize
Definition: AMReX_CommProfStats.H:247
void ReadCommStats(DataBlock &dBlock)
Definition: AMReX_CommProfStats.cpp:430
void ReadCommStatsNoOpen(DataBlock &dBlock)
Definition: AMReX_CommProfStats.cpp:446
A Fortran Array of REALs.
Definition: AMReX_FArrayBox.H:229
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition: AMReX_Vector.H:27
AMREX_GPU_HOST_DEVICE Long size(T const &b) noexcept
integer version
Definition: AMReX_GpuRange.H:26
Definition: AMReX_BLProfStats.H:79
Definition: AMReX_CommProfStats.H:40
BarrierEntry()
Definition: AMReX_CommProfStats.H:41
int bNameNumber
Definition: AMReX_CommProfStats.H:52
long number
Definition: AMReX_CommProfStats.H:49
BarrierEntry(long n, const std::string &nm, long i, int bnn)
Definition: AMReX_CommProfStats.H:44
std::string name
Definition: AMReX_CommProfStats.H:50
long seekIndex
Definition: AMReX_CommProfStats.H:51
BarrierEntry & operator=(const BarrierEntry &be)
Definition: AMReX_CommProfStats.cpp:1900
Definition: AMReX_CommProfStats.H:69
double timeMin
Definition: AMReX_CommProfStats.H:91
int streamIndex
Definition: AMReX_CommProfStats.H:89
long size
Definition: AMReX_CommProfStats.H:81
std::string fileName
Definition: AMReX_CommProfStats.H:82
amrex::Vector< amrex::BLProfiler::CommStats > vCommStats
Definition: AMReX_CommProfStats.H:95
amrex::Vector< ReductionEntry > reductions
Definition: AMReX_CommProfStats.H:93
double timerTime
Definition: AMReX_CommProfStats.H:88
amrex::Vector< NameTagEntry > nameTags
Definition: AMReX_CommProfStats.H:94
std::string nodeName
Definition: AMReX_CommProfStats.H:85
long readoffset
Definition: AMReX_CommProfStats.H:84
int nTimerTimes
Definition: AMReX_CommProfStats.H:87
amrex::Vector< BarrierEntry > barriers
Definition: AMReX_CommProfStats.H:92
int proc
Definition: AMReX_CommProfStats.H:80
long seekpos
Definition: AMReX_CommProfStats.H:83
DataBlock()
Definition: AMReX_CommProfStats.H:70
DataBlock(const int p, const long s, const std::string &fn, const long sp, const std::string &pn, const int nn, const int si)
Definition: AMReX_CommProfStats.H:74
int nodeNumber
Definition: AMReX_CommProfStats.H:86
double timeMax
Definition: AMReX_CommProfStats.H:91
Definition: AMReX_CommProfStats.H:62
long seekIndex
Definition: AMReX_CommProfStats.H:66
NameTagEntry(const long ntindex, const long seekindex)
Definition: AMReX_CommProfStats.H:63
long ntIndex
Definition: AMReX_CommProfStats.H:66
Definition: AMReX_CommProfStats.H:55
long number
Definition: AMReX_CommProfStats.H:59
ReductionEntry(const long n, const long i)
Definition: AMReX_CommProfStats.H:56
long seekIndex
Definition: AMReX_CommProfStats.H:59
Definition: AMReX_CommProfStats.H:143
SendRecvPairUnpaired(const amrex::BLProfiler::CommFuncType cft, const int sp, const int rp, const int ds, const int tg, const Real st, const Real rt, const Real tt)
Definition: AMReX_CommProfStats.H:144
amrex::BLProfiler::CommFuncType unmatchedCFType
Definition: AMReX_CommProfStats.H:150
Definition: AMReX_CommProfStats.H:98
SendRecvPair(const int sp, const int rp, const int ds, const int tg, const Real st, const Real rt, const Real tt)
Definition: AMReX_CommProfStats.H:99
int dataSize
Definition: AMReX_CommProfStats.H:105
int fromProc
Definition: AMReX_CommProfStats.H:105
static long HashLong(int fp, int tp, int, int t)
Definition: AMReX_CommProfStats.H:125
Real sendTime
Definition: AMReX_CommProfStats.H:106
int tag
Definition: AMReX_CommProfStats.H:105
int toProc
Definition: AMReX_CommProfStats.H:105
bool Matches(int fromproc, int toproc, int size)
Definition: AMReX_CommProfStats.H:113
Real totalTime
Definition: AMReX_CommProfStats.H:106
long HashLong()
Definition: AMReX_CommProfStats.H:117
Real recvTime
Definition: AMReX_CommProfStats.H:106
bool Matches(int fromproc, int toproc, int size, int mtag)
Definition: AMReX_CommProfStats.H:109
static long HashLong(int fp, int tp, int t)
Definition: AMReX_CommProfStats.H:122