openPMD-api
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
openPMD::MPIBenchmark< DatasetFillerProvider > Class Template Reference

Class representing a benchmark. More...

#include <MPIBenchmark.hpp>

Collaboration diagram for openPMD::MPIBenchmark< DatasetFillerProvider >:
Collaboration graph
[legend]

Public Types

using extentT = Extent::value_type
 

Public Member Functions

 MPIBenchmark (std::string basePath, Extent tExtent, std::shared_ptr< BlockSlicer > blockSlicer, DatasetFillerProvider dfp, MPI_Comm comm=MPI_COMM_WORLD)
 Construct an MPI benchmark manually. More...
 
void addConfiguration (std::string compression, uint8_t compressionLevel, std::string backend, Datatype dt, typename decltype(Series::iterations)::key_type iterations, int threadSize)
 
void addConfiguration (std::string compression, uint8_t compressionLevel, std::string backend, Datatype dt, typename decltype(Series::iterations)::key_type iterations)
 Version of addConfiguration() that automatically sets the number of used threads to the MPI size. More...
 
void resetConfigurations ()
 
template<typename Clock >
MPIBenchmarkReport< typename Clock::duration > runBenchmark (int rootThread=0)
 Main function for running a benchmark. More...
 

Public Attributes

MPI_Comm communicator = MPI_COMM_WORLD
 
Extent totalExtent
 Total extent of the hypercuboid used in the benchmark.
 
std::shared_ptr< BlockSlicerm_blockSlicer
 
DatasetFillerProvider m_dfp
 

Detailed Description

template<typename DatasetFillerProvider>
class openPMD::MPIBenchmark< DatasetFillerProvider >

Class representing a benchmark.

Allows to configure a benchmark and execute it.

Template Parameters
DatasetFillerProviderFunctor type to create a DatasetFiller with the requested type. Should have a templated operator()() returning a value that can be dynamically casted to a std::shared_ptr<openPMD::DatasetFiller<T>>.

Constructor & Destructor Documentation

◆ MPIBenchmark()

template<typename DatasetFillerProvider >
openPMD::MPIBenchmark< DatasetFillerProvider >::MPIBenchmark ( std::string  basePath,
Extent  tExtent,
std::shared_ptr< BlockSlicer blockSlicer,
DatasetFillerProvider  dfp,
MPI_Comm  comm = MPI_COMM_WORLD 
)

Construct an MPI benchmark manually.

Parameters
basePathThe path to write to. Will be extended with the backends' filename endings. May be overwritten if performing several benchmarks with the same backend, e.g. when using different compression schemes.
tExtentThe total extent of the dataset.
blockSlicerAn implementation of BlockSlicer class, associating each thread with a portion of the dataset to write to.
dfpDatasetFillerProvider, a templated functor returning a std::shared_ptr<openPMD::DatasetFiller<T>> or a value dynamically castable to one.
commMPI communicator.

Member Function Documentation

◆ addConfiguration() [1/2]

template<typename DatasetFillerProvider >
void openPMD::MPIBenchmark< DatasetFillerProvider >::addConfiguration ( std::string  compression,
uint8_t  compressionLevel,
std::string  backend,
Datatype  dt,
typename decltype(Series::iterations)::key_type  iterations 
)

Version of addConfiguration() that automatically sets the number of used threads to the MPI size.

Parameters
compressionCompression string, leave empty to disable commpression.
compressionLevelCompression level.
backendBackend to use, specified by filename extension (eg "bp" or "h5").
dtType of data to write and read.
iterationsThe number of iterations to write and read for each compression strategy. The DatasetFiller functor will be called for each iteration, so it should create sufficient data for one iteration.

◆ addConfiguration() [2/2]

template<typename DatasetFillerProvider >
void openPMD::MPIBenchmark< DatasetFillerProvider >::addConfiguration ( std::string  compression,
uint8_t  compressionLevel,
std::string  backend,
Datatype  dt,
typename decltype(Series::iterations)::key_type  iterations,
int  threadSize 
)
Parameters
compressionCompression string, leave empty to disable commpression.
compressionLevelCompression level.
backendBackend to use, specified by filename extension (eg "bp" or "h5").
dtType of data to write and read.
iterationsThe number of iterations to write and read for each compression strategy. The DatasetFiller functor will be called for each iteration, so it should create sufficient data for one iteration.
threadSizeNumber of threads to use.

◆ runBenchmark()

template<typename DatasetFillerProvider >
template<typename Clock >
MPIBenchmarkReport< typename Clock::duration > openPMD::MPIBenchmark< DatasetFillerProvider >::runBenchmark ( int  rootThread = 0)

Main function for running a benchmark.

The benchmark is repeated for all previously requested compressions strategies, backends and thread sizes.

Template Parameters
ClockClock type to use.
Parameters
rootThreadRank at which the report will be read.
Returns
A report about the time needed for writing and reading under each compression strategy.

The documentation for this class was generated from the following file: