ALP User Documentation  0.8.preview
Algebraic Programming User Documentation
Public Member Functions | Static Public Member Functions | List of all members
Benchmarker< mode, implementation > Class Template Reference

A class that follows the API of the grb::Launcher, but instead of launching the given ALP program once, it launches it multiple times while benchmarking its execution times. More...

Public Member Functions

 Benchmarker (const size_t process_id=0, const size_t nprocs=1, const std::string hostname="localhost", const std::string port="0")
 Constructs an instance of the benchmarker class. More...
 
template<typename T , typename U >
RC exec (void(*alp_program)(const T &, U &), const T &data_in, U &data_out, const size_t inner, const size_t outer, const bool broadcast=false) const
 Benchmarks a given ALP program. More...
 
template<typename U >
RC exec (void(*alp_program)(const void *, const size_t, U &), const void *data_in, const size_t in_size, U &data_out, const size_t inner, const size_t outer, const bool broadcast=false) const
 Benchmarks a given ALP program. More...
 

Static Public Member Functions

static RC finalize ()
 Releases all ALP resources. More...
 

Detailed Description

template<enum EXEC_MODE mode, enum Backend implementation>
class grb::Benchmarker< mode, implementation >

A class that follows the API of the grb::Launcher, but instead of launching the given ALP program once, it launches it multiple times while benchmarking its execution times.

See also
Benchmarking

Constructor & Destructor Documentation

◆ Benchmarker()

Benchmarker ( const size_t  process_id = 0,
const size_t  nprocs = 1,
const std::string  hostname = "localhost",
const std::string  port = "0" 
)
inline

Constructs an instance of the benchmarker class.

Parameters
[in]process_idA unique ID for the calling user process.
[in]nprocsThe total number of user processes participating in the benchmark. The given process_id must be strictly smaller than this given value.
[in]hostnameThe hostname where one of the user processes participating in the benchmark resides.
[in]portA free TCP/IP port at the host corresponding to the given hostname.

The hostname and port arguments are unused if nprocs equals one.

All arguments are optional– their defaults are:

  • 0 for process_id,
  • 1 for nprocs,
  • localhost for hostname, and
  • 0 for port.

This constructor may throw the same errors as grb::Launcher.

See also
grb::Launcher
Benchmarking

Member Function Documentation

◆ exec() [1/2]

RC exec ( void(*)(const T &, U &)  alp_program,
const T &  data_in,
U &  data_out,
const size_t  inner,
const size_t  outer,
const bool  broadcast = false 
) const
inline

Benchmarks a given ALP program.

This variant applies to typed ALP programs.

Template Parameters
TInput type of the given user program.
UOutput type of the given user program.
Parameters
[in]alp_programThe ALP program to be benchmarked.
[in]data_inInput data.
[out]data_outOutput data.
[in]innerNumber of inner repetitions of the benchmark.
[in]outerNumber of outer repetitions of the benchmark.
[in]broadcastAn optional argument that dictates whether the data_in argument should be broadcast across all user processes participating in the benchmark, prior to each invocation of alp_program.

The default value of broadcast is false.

Returns
grb::SUCCESS The benchmarking has completed successfully.
grb::ILLEGAL If broadcast was false but T is not default-constructible.
grb::FAILED An error during benchmarking has occurred. The benchmark attempt could be retried, and an error for the failure is reported to the standard error stream.
grb::PANIC If an unrecoverable error was encountered while starting the benchmark, while benchmarking, or while aggregating the final results.
See also
grb::Launcher for more details.
Benchmarking

◆ exec() [2/2]

RC exec ( void(*)(const void *, const size_t, U &)  alp_program,
const void *  data_in,
const size_t  in_size,
U &  data_out,
const size_t  inner,
const size_t  outer,
const bool  broadcast = false 
) const
inline

Benchmarks a given ALP program.

This variant applies to untyped ALP programs.

Template Parameters
UOutput type of the given user program.
Parameters
[in]alp_programThe user program to be benchmarked.
[in]data_inInput data as a raw data blob.
[in]in_sizeThe size, in bytes, of the input data.
[out]data_outOutput data.
[in]innerNumber of inner repetitions of the benchmark.
[in]outerNumber of outer repetitions of the benchmark.
[in]broadcastAn optional argument that dictates whether the data_in argument should be broadcast across all user processes participating in the benchmark, prior to each invocation of alp_program.

The default value of broadcast is false.

Returns
grb::SUCCESS The benchmarking has completed successfully.
grb::ILLEGAL If in_size is nonzero but data_in compares equal to nullptr.
grb::FAILED An error during benchmarking has occurred. The benchmark attempt could be retried, and an error for the failure is reported to the standard error stream.
grb::PANIC If an unrecoverable error was encountered while starting the benchmark, while benchmarking, or while aggregating the final results.
See also
grb::Launcher for more details.
Benchmarking

◆ finalize()

static RC finalize ( )
inlinestatic

Releases all ALP resources.

Calling this function is equivalent to calling grb::Launcher::finalize.

See also
grb::Launcher for further details.
Returns
grb::SUCCESS The resources have successfully and permanently been released.
grb::PANIC An unrecoverable error has been encountered and the user program is encouraged to exit as quickly as possible. The state of the ALP library has become undefined and should no longer be used.

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