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

Function GetWriteInfo

Src/Base/AMReX_AsyncOut.cpp:72–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70bool UseAsyncOut () { return s_asyncout; }
71
72WriteInfo GetWriteInfo (int rank)
73{
74 const int nfiles = s_noutfiles;
75 const int nprocs = ParallelDescriptor::NProcs();
76 const int nmaxspots = (nprocs + (nfiles-1)) / nfiles; // max spots per file
77 const int nfull = nfiles + nprocs - nmaxspots*nfiles; // the first nfull files are full
78
79 int ifile, ispot, nspots;
80 if (rank < nfull*nmaxspots) {
81 ifile = rank / nmaxspots;
82 ispot = rank - ifile*nmaxspots;
83 nspots = nmaxspots;
84 } else {
85 int tmpproc = rank-nfull*nmaxspots;
86 ifile = tmpproc/(nmaxspots-1);
87 ispot = tmpproc - ifile*(nmaxspots-1);
88 ifile += nfull;
89 nspots = nmaxspots - 1;
90 }
91
92 return WriteInfo{.ifile = ifile, .ispot = ispot, .nspots = nspots};
93}
94
95void Submit (std::function<void()>&& a_f)
96{

Callers 3

InitializeFunction · 0.85
AsyncWriteDoitMethod · 0.85

Calls 1

NProcsFunction · 0.70

Tested by

no test coverage detected