waLBerla 7.3
Loading...
Searching...
No Matches
walberla::timing Namespace Reference

Namespaces

namespace  internal

Classes

struct  CpuPolicy
 Timing policy for the measurement of the CPU time. More...
class  RemainingTimeLogger
struct  StaticPolicy
 Timing policy for fake measurement with a static settable clock. More...
class  Timer
 Progress timer for time and performance measurements. More...
struct  TimingNode
class  ScopeTimer
class  TimingPool
class  TimingTree
struct  WcPolicy
 Timing policy for the measurement of the wall clock time. More...
struct  DeviceSynchronizePolicy
 Timing policy for the measurement of the GPU time. More...

Enumerations

enum  ReduceType { REDUCE_MIN , REDUCE_AVG , REDUCE_MAX , REDUCE_TOTAL }
 The reduce type describes which values are reduced from each process. More...

Functions

double getCpuTime ()
 Returns the current CPU time in seconds.
double getWcTime ()
 Returns the current wall clock time in seconds.
std::string timeToString (real_t time)
 Converts a timespan to a string.
template<typename TP>
shared_ptr< Timer< TP > > getReduced (Timer< TP > &timer, ReduceType rt, int targetRank)
 Returns a reduced Timer, holding information from all processes.
template<typename TP>
std::ostream & operator<< (std::ostream &os, const Timer< TP > &timer)
template<typename T, typename G, typename TP>
mpi::GenericSendBuffer< T, G > & operator<< (mpi::GenericSendBuffer< T, G > &buf, const Timer< TP > &t)
template<typename T, typename TP>
mpi::GenericRecvBuffer< T > & operator>> (mpi::GenericRecvBuffer< T > &buf, Timer< TP > &t)
template<typename TP>
std::ostream & operator<< (std::ostream &os, const TimingPool< TP > &tp)
template<typename T, typename G, typename TP>
mpi::GenericSendBuffer< T, G > & operator<< (mpi::GenericSendBuffer< T, G > &buf, const timing::TimingPool< TP > &tp)
template<typename T, typename TP>
mpi::GenericRecvBuffer< T > & operator>> (mpi::GenericRecvBuffer< T > &buf, timing::TimingPool< TP > &tp)
template<typename TP>
void to_json (nlohmann::json &j, const Timer< TP > &timer)
 Converts timer to json The signature is required by the json library.
template<typename TP>
void to_json (nlohmann::json &j, const TimingNode< TP > &tn)
 Converts a TimingNode to json.
template<typename TP>
void to_json (nlohmann::json &j, const TimingTree< TP > &tt)
 Converts a TimingTree to json.
template<typename TP>
const Timer< TP > & findTimer (const TimingNode< TP > &tn, const std::string &name)
 Finds the specified timer in the timing hierarchy.
template<typename TP>
bool timerExists (const TimingNode< TP > &tn, const std::string &name)
 Checks if the specified timer exists in the timing hierarchy.
template<typename TP>
void reset (TimingNode< TP > &tn)
 Resets the timer in the TimingNode structure and all sub timers.
template<typename TP>
size_t getLongestTimerNameLength (const TimingNode< TP > &tn)
 Utility function to find the length of the longest timer name.
template<typename TP>
size_t getHierarchyDepth (const TimingNode< TP > &tn)
 Utility function to find the depth of a TimingNode tree.
template<typename TP>
void reduceInplace (TimingNode< TP > &tn, ReduceType rt=REDUCE_TOTAL, int targetRank=0)
 Collects all the timing data from different processes.
template<typename TP>
void synchronizeEntries (TimingNode< TP > &tn)
 Makes sure all nodes on all processes have the same children.
template<typename TP>
std::ostream & operator<< (std::ostream &os, const TimingNode< TP > &tn)
template<typename TP>
std::ostream & operator<< (std::ostream &os, const TimingTree< TP > &tt)

Enumeration Type Documentation

◆ ReduceType

The reduce type describes which values are reduced from each process.

Enumerator
REDUCE_MIN 

Treats each process as one timing sample. For the timing sample the min value is used.

REDUCE_AVG 

Treats each process as one timing sample. For the timing sample the average value is used.

REDUCE_MAX 

Treats each process as one timing sample. For the timing sample the max value is used.

REDUCE_TOTAL 

Collects all timing samples from all processes and accumulates the data.

The number of measurements afterwards are: nrOfProcesses*measurementsPerProcess

Function Documentation

◆ getCpuTime()

double walberla::timing::getCpuTime ( )

Returns the current CPU time in seconds.

Returns
The current CPU time in seconds.

◆ getReduced()

template<typename TP>
shared_ptr< Timer< TP > > walberla::timing::getReduced ( Timer< TP > & timer,
ReduceType rt,
int targetRank )

Returns a reduced Timer, holding information from all processes.

Parameters
timerTimer which should be reduced
rtSpecified the method how the reduction is done. See documentation for ReduceType
targetRankthe world rank of the target process. Or negative value for an all-reduction operation
Returns
a nonzero shared pointer to a Timer on the process with rank "targetRank" and a zero pointer otherwise. For the all-reduction a valid timer is returned on all processes.

◆ getWcTime()

double walberla::timing::getWcTime ( )
inline

Returns the current wall clock time in seconds.

Returns
The current wall clock time in seconds.

◆ operator<<() [1/6]

template<typename T, typename G, typename TP>
mpi::GenericSendBuffer< T, G > & walberla::timing::operator<< ( mpi::GenericSendBuffer< T, G > & buf,
const Timer< TP > & t )

◆ operator<<() [2/6]

template<typename T, typename G, typename TP>
mpi::GenericSendBuffer< T, G > & walberla::timing::operator<< ( mpi::GenericSendBuffer< T, G > & buf,
const timing::TimingPool< TP > & tp )

◆ operator<<() [3/6]

template<typename TP>
std::ostream & walberla::timing::operator<< ( std::ostream & os,
const Timer< TP > & timer )

◆ operator<<() [4/6]

template<typename TP>
std::ostream & walberla::timing::operator<< ( std::ostream & os,
const TimingPool< TP > & tp )

◆ operator>>() [1/2]

template<typename T, typename TP>
mpi::GenericRecvBuffer< T > & walberla::timing::operator>> ( mpi::GenericRecvBuffer< T > & buf,
Timer< TP > & t )

◆ operator>>() [2/2]

template<typename T, typename TP>
mpi::GenericRecvBuffer< T > & walberla::timing::operator>> ( mpi::GenericRecvBuffer< T > & buf,
timing::TimingPool< TP > & tp )

◆ timeToString()

std::string walberla::timing::timeToString ( real_t time)
inline

Converts a timespan to a string.

Parameters
timeThe timespan in seconds.
Returns
A string of the form "3d 2h 12m 9s". Zero values are omitted.