24 #include "openPMD/config.hpp" 27 #include "openPMD/Datatype.hpp" 28 #include "openPMD/Series.hpp" 43 template <
typename Duration>
46 MPI_Comm communicator;
61 typename decltype(Series::iterations)::key_type>,
62 std::pair<Duration, Duration> >
90 std::string compression,
92 std::string extension,
95 typename decltype(Series::iterations)::key_type iterations,
96 std::pair<Duration, Duration>
const &report);
111 std::string compression,
113 std::string extension,
116 typename decltype(Series::iterations)::key_type iterations);
119 template <
typename D,
typename Dummy = D>
123 template <
typename Dummy>
124 struct MPIDatatype<char, Dummy>
126 MPI_Datatype dt = MPI_CHAR;
128 template <
typename Dummy>
129 struct MPIDatatype<unsigned char, Dummy>
131 MPI_Datatype dt = MPI_UNSIGNED_CHAR;
133 template <
typename Dummy>
134 struct MPIDatatype<short, Dummy>
136 MPI_Datatype dt = MPI_SHORT;
138 template <
typename Dummy>
139 struct MPIDatatype<int, Dummy>
141 MPI_Datatype dt = MPI_INT;
143 template <
typename Dummy>
144 struct MPIDatatype<long, Dummy>
146 MPI_Datatype dt = MPI_LONG;
148 template <
typename Dummy>
149 struct MPIDatatype<float, Dummy>
151 MPI_Datatype dt = MPI_FLOAT;
153 template <
typename Dummy>
154 struct MPIDatatype<double, Dummy>
156 MPI_Datatype dt = MPI_DOUBLE;
158 template <
typename Dummy>
159 struct MPIDatatype<unsigned short, Dummy>
161 MPI_Datatype dt = MPI_UNSIGNED_SHORT;
163 template <
typename Dummy>
164 struct MPIDatatype<unsigned int, Dummy>
166 MPI_Datatype dt = MPI_UNSIGNED;
168 template <
typename Dummy>
169 struct MPIDatatype<unsigned long, Dummy>
171 MPI_Datatype dt = MPI_UNSIGNED_LONG;
173 template <
typename Dummy>
174 struct MPIDatatype<long double, Dummy>
176 MPI_Datatype dt = MPI_LONG_DOUBLE;
178 template <
typename Dummy>
179 struct MPIDatatype<long long, Dummy>
181 MPI_Datatype dt = MPI_LONG_LONG_INT;
184 MPIDatatype<typename Duration::rep> m_mpiDatatype;
185 MPI_Datatype mpiType = m_mpiDatatype.dt;
190 template <
typename Duration>
193 std::string compression,
195 std::string extension,
198 typename decltype(Series::iterations)::key_type iterations,
199 std::pair<Duration, Duration>
const &report)
201 using rep =
typename Duration::rep;
204 MPI_Comm_rank(communicator, &rank);
206 MPI_Comm_size(communicator, &size);
209 communicator, rank < threadSize ? 0 : MPI_UNDEFINED, rank, &restricted);
211 if (rank < threadSize)
213 readWrite[0] = report.first.count();
214 readWrite[1] = report.second.count();
217 if (rank == rootThread)
219 recv =
new rep[2 * threadSize];
222 if (restricted != MPI_COMM_NULL)
235 if (rank == rootThread)
237 for (
int i = 0; i < threadSize; i++)
239 Duration dWrite{recv[2 * i]};
240 Duration dRead{recv[2 * i + 1]};
250 std::make_pair(dWrite, dRead));
254 if (restricted != MPI_COMM_NULL)
256 MPI_Comm_free(&restricted);
260 template <
typename Duration>
265 template <
typename Duration>
268 std::string compression,
270 std::string extension,
273 typename decltype(Series::iterations)::key_type iterations)
275 auto it = this->
durations.find(std::make_tuple(
276 rank, compression, level, extension, threadSize, dt, iterations));
279 throw std::runtime_error(
280 "Requested report not found. (Reports are available on the root " void addReport(int rootThread, std::string compression, uint8_t level, std::string extension, int threadSize, Datatype dt, typename decltype(Series::iterations)::key_type iterations, std::pair< Duration, Duration > const &report)
Add results for a certain compression strategy and level.
Definition: MPIBenchmarkReport.hpp:191
std::map< std::tuple< int, std::string, uint8_t, std::string, int, Datatype, typename decltype(Series::iterations)::key_type >, std::pair< Duration, Duration > > durations
Time needed for writing and reading per compression strategy and level.
Definition: MPIBenchmarkReport.hpp:63
Datatype
Concrete datatype of an object available at runtime.
Definition: Datatype.hpp:45
The report for a single benchmark produced by <openPMD/benchmark/mpi/MPIBenchmark>.
Definition: MPIBenchmarkReport.hpp:44
Public definitions of openPMD-api.
Definition: Date.cpp:28
std::pair< Duration, Duration > getReport(int rank, std::string compression, uint8_t level, std::string extension, int threadSize, Datatype dt, typename decltype(Series::iterations)::key_type iterations)
Retrieve the time measured for a certain compression strategy.
Definition: MPIBenchmarkReport.hpp:266