| 70 | bool UseAsyncOut () { return s_asyncout; } |
| 71 | |
| 72 | WriteInfo 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 | |
| 95 | void Submit (std::function<void()>&& a_f) |
| 96 | { |
no test coverage detected