HMLP: High-performance Machine Learning Primitives
hmlp::RunTime Class Reference

RunTime is statically created in hmlp_runtime.cpp. More...

#include <runtime.hpp>

Public Member Functions

 RunTime ()
 
hmlpError_t init (mpi::Comm comm)
 Initialize the runtime system with an MPI communicator. More...
 
hmlpError_t init (int *argc, char ***argv, mpi::Comm comm)
 Initialize the runtime system with arguments and an MPI communicator. More...
 
hmlpError_t run ()
 Consume all tasks in the graph. More...
 
hmlpError_t finalize ()
 
bool isInit () const noexcept
 
bool isInEpochSession () const noexcept
 
void ExecuteNestedTasksWhileWaiting (Task *waiting_task)
 
hmlpError_t setNumberOfWorkers (int num_of_workers) noexcept
 Adjust the number of workers in the next epoch. More...
 
int getNumberOfWorkers () const noexcept
 

Public Attributes

thread_communicatormycomm
 
class Worker workers [MAX_WORKER]
 
class Device host
 
class Devicedevice [1]
 
Schedulerscheduler
 

Detailed Description

RunTime is statically created in hmlp_runtime.cpp.

end class Scheduler class RunTime

Constructor & Destructor Documentation

hmlp::RunTime::RunTime ( )

Member Function Documentation

void hmlp::RunTime::ExecuteNestedTasksWhileWaiting ( Task waiting_task)

Consuming nested tasks while in a epoch session.

Use omp_get_thread_num() to acquire tid.

If I am not in a epoch session, then return.

hmlpError_t hmlp::RunTime::finalize ( )

end RunTime::Run() Stop and clean up the runtime syste.

Returns
error code

Finalize the scheduler and delete it.

Set the initialized flag to false.

Finalize MPI if it was initialized by HMLP.

int hmlp::RunTime::getNumberOfWorkers ( ) const
noexcept
Returns
the number of workers
hmlpError_t hmlp::RunTime::init ( mpi::Comm  comm = MPI_COMM_WORLD)

Initialize the runtime system with an MPI communicator.

Parameters
[in]commthe MPI communicator.
Returns
error code

Check whether MPI has been initialized?

hmlpError_t hmlp::RunTime::init ( int *  argc,
char ***  argv,
mpi::Comm  comm = MPI_COMM_WORLD 
)

Initialize the runtime system with arguments and an MPI communicator.

Parameters
[in]argcthe &argc from main().
[in]argvthe &argv from main().
[in]commthe MPI communicator.
Returns
error code

Set argument count.

Set argument values.

Acquire the number of (maximum) workers from OpenMP.

Check whether MPI has been initialized?

Initialize MPI inside HMLP otherwise.

Flag that MPI is initialized by HMLP.

Initialize the scheduler.

Set the flag such that this is only executed once.

bool hmlp::RunTime::isInEpochSession ( ) const
noexcept

Whether the runtime is in a epoch session.

Returns
whether or not the current execution is in an epoch.
bool hmlp::RunTime::isInit ( ) const
noexcept

Whether the runtime is initialized.

end RunTime::finalize()

Returns
whether or not the runtime is initialized.
hmlpError_t hmlp::RunTime::run ( )

Consume all tasks in the graph.

Returns
error code

Begin this epoch session.

Schedule jobs to n workers.

Clean up.

Finish this epoch session.

Return without error.

hmlpError_t hmlp::RunTime::setNumberOfWorkers ( int  num_of_workers)
noexcept

Adjust the number of workers in the next epoch.

end RunTime::ExecuteNestedTasksWhileWaiting()

Parameters
[in]num_of_workersthe number of workers
Returns
error code

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