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

Method FillSendFAB

Src/Extern/ProfParser/AMReX_CommProfStats.cpp:641–761  ·  view source on GitHub ↗

----------------------------------------------------------------------

Source from the content-addressed store, hash-verified

639
640// ----------------------------------------------------------------------
641void CommProfStats::FillSendFAB(long &totalSends, long &totalSentData,
642 Vector<long> &totalSendsPerProc,
643 Vector<long> &totalSentDataPerProc,
644 FArrayBox &sendFAB, bool proxmap)
645{
646 BL_PROFILE("CommProfStats::FillSendFAB");
647
648#if (BL_SPACEDIM == 2)
649
650 if(proxmap) {
651
652 for(int idb(0); idb < dataBlocks.size(); ++idb) { // ---- go through dataBlocks
653 Real *tsp = sendFAB.dataPtr(0);
654 Real *tsdp = sendFAB.dataPtr(1);
655 Box dataBox(sendFAB.box());
656 int smallX(dataBox.smallEnd(XDIR)), bigX(dataBox.bigEnd(XDIR));
657 int smallY(dataBox.smallEnd(YDIR)), bigY(dataBox.bigEnd(YDIR));
658 int xlen(dataBox.length(XDIR)), rankFrom, rankTo, proxFrom, proxTo, proc;
659
660 DataBlock &dBlock = dataBlocks[idb];
661 rankFrom = dBlock.proc;
662 proxFrom = proxFromRank[rankFrom];
663 proc = dBlock.proc;
664
665 if(proxFrom >= smallX && proxFrom <= bigX) { // ---- within from proc range
666 int index, offsetX(proxFrom - smallX);
667
668 BL_PROFILE_VAR("FillSendFABIO", fillsendfabio);
669
670 if (persistentStreams){
671 ReadCommStatsNoOpen(dBlock);
672 } else {
673 ReadCommStats(dBlock);
674 }
675
676 BL_PROFILE_VAR_STOP(fillsendfabio);
677
678 for(int i(0); i < dBlock.vCommStats.size(); ++i) { // ---- find sends and sum
679 BLProfiler::CommStats &cs = dBlock.vCommStats[i];
680 if(IsSend(cs.cfType)) {
681 if(cs.size != BLProfiler::AfterCall()) {
682 rankTo = cs.commpid;
683 proxTo = proxFromRank[rankTo];
684 if(proxTo >= smallY && proxTo <= bigY) { // ---- within to proc range
685 if(InTimeRange(proc, cs.timeStamp)) {
686 ++totalSends;
687 totalSentData += cs.size;
688 ++totalSendsPerProc[proxFrom];
689 totalSentDataPerProc[proxFrom] += cs.size;
690 index = (offsetX) + (xlen * (proxTo - smallY));
691 tsp[index] += 1.0;
692 tsdp[index] += cs.size;
693 }
694 }
695 }
696 }
697 }
698 ClearCommStats(dBlock);

Callers 1

RunSendsPFMethod · 0.80

Calls 4

sizeMethod · 0.45
dataPtrMethod · 0.45
boxMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected