24 #include "openPMD/config.hpp"
27 #include "openPMD/Datatype.hpp"
28 #include "openPMD/Series.hpp"
43 template <
typename Duration>
46 MPI_Comm communicator;
61 std::pair<Duration, Duration> >
88 std::string jsonConfig,
89 std::string extension,
93 std::pair<Duration, Duration>
const &report);
107 std::string jsonConfig,
108 std::string extension,
114 template <
typename D,
typename Dummy = D>
118 template <
typename Dummy>
119 struct MPIDatatype<char, Dummy>
121 MPI_Datatype dt = MPI_CHAR;
123 template <
typename Dummy>
124 struct MPIDatatype<unsigned char, Dummy>
126 MPI_Datatype dt = MPI_UNSIGNED_CHAR;
128 template <
typename Dummy>
129 struct MPIDatatype<short, Dummy>
131 MPI_Datatype dt = MPI_SHORT;
133 template <
typename Dummy>
134 struct MPIDatatype<int, Dummy>
136 MPI_Datatype dt = MPI_INT;
138 template <
typename Dummy>
139 struct MPIDatatype<long, Dummy>
141 MPI_Datatype dt = MPI_LONG;
143 template <
typename Dummy>
144 struct MPIDatatype<float, Dummy>
146 MPI_Datatype dt = MPI_FLOAT;
148 template <
typename Dummy>
149 struct MPIDatatype<double, Dummy>
151 MPI_Datatype dt = MPI_DOUBLE;
153 template <
typename Dummy>
154 struct MPIDatatype<unsigned short, Dummy>
156 MPI_Datatype dt = MPI_UNSIGNED_SHORT;
158 template <
typename Dummy>
159 struct MPIDatatype<unsigned int, Dummy>
161 MPI_Datatype dt = MPI_UNSIGNED;
163 template <
typename Dummy>
164 struct MPIDatatype<unsigned long, Dummy>
166 MPI_Datatype dt = MPI_UNSIGNED_LONG;
168 template <
typename Dummy>
169 struct MPIDatatype<long double, Dummy>
171 MPI_Datatype dt = MPI_LONG_DOUBLE;
173 template <
typename Dummy>
174 struct MPIDatatype<long long, Dummy>
176 MPI_Datatype dt = MPI_LONG_LONG_INT;
179 MPIDatatype<typename Duration::rep> m_mpiDatatype;
180 MPI_Datatype mpiType = m_mpiDatatype.dt;
185 template <
typename Duration>
188 std::string jsonConfig,
189 std::string extension,
193 std::pair<Duration, Duration>
const &report)
195 using rep =
typename Duration::rep;
198 MPI_Comm_rank(communicator, &rank);
200 MPI_Comm_size(communicator, &size);
203 communicator, rank < threadSize ? 0 : MPI_UNDEFINED, rank, &restricted);
205 if (rank < threadSize)
207 readWrite[0] = report.first.count();
208 readWrite[1] = report.second.count();
211 if (rank == rootThread)
213 recv =
new rep[2 * threadSize];
216 if (restricted != MPI_COMM_NULL)
229 if (rank == rootThread)
231 for (
int i = 0; i < threadSize; i++)
233 Duration dWrite{recv[2 * i]};
234 Duration dRead{recv[2 * i + 1]};
235 this->durations.emplace(
237 i, jsonConfig, extension, threadSize, dt, iterations),
238 std::make_pair(dWrite, dRead));
242 if (restricted != MPI_COMM_NULL)
244 MPI_Comm_free(&restricted);
248 template <
typename Duration>
253 template <
typename Duration>
256 std::string jsonConfig,
257 std::string extension,
262 auto it = this->durations.find(std::make_tuple(
263 rank, jsonConfig, extension, threadSize, dt, iterations));
264 if (it == this->durations.end())
266 throw std::runtime_error(
267 "Requested report not found. (Reports are available on the root "
Iteration::IterationIndex_t IterationIndex_t
An unsigned integer type, used to identify Iterations in a Series.
Definition: Series.hpp:313
Public definitions of openPMD-api.
Definition: Date.cpp:29
Datatype
Concrete datatype of an object available at runtime.
Definition: Datatype.hpp:51
The report for a single benchmark produced by <openPMD/benchmark/mpi/MPIBenchmark>.
Definition: MPIBenchmarkReport.hpp:45
std::map< std::tuple< int, std::string, std::string, int, Datatype, Series::IterationIndex_t >, std::pair< Duration, Duration > > durations
Time needed for writing and reading per compression strategy and level.
Definition: MPIBenchmarkReport.hpp:62
void addReport(int rootThread, std::string jsonConfig, std::string extension, int threadSize, Datatype dt, Series::IterationIndex_t iterations, std::pair< Duration, Duration > const &report)
Add results for a certain compression strategy and level.
Definition: MPIBenchmarkReport.hpp:186
std::pair< Duration, Duration > getReport(int rank, std::string jsonConfig, std::string extension, int threadSize, Datatype dt, Series::IterationIndex_t iterations)
Retrieve the time measured for a certain compression strategy.
Definition: MPIBenchmarkReport.hpp:254