aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
gum::SchedulerParallel Class Reference

A scheduler that executes available operators in parallel. More...

#include <agrum/base/graphicalModels/inference/scheduler/schedulerParallel.h>

Inheritance diagram for gum::SchedulerParallel:
Collaboration diagram for gum::SchedulerParallel:

Public Member Functions

Constructors / Destructors
 SchedulerParallel (Size max_nb_threads=0, double max_megabyte_memory=0.0)
 default constructor
 SchedulerParallel (const SchedulerParallel &from)
 copy constructor
 SchedulerParallel (SchedulerParallel &&from)
 move constructor
SchedulerParallelclone () const final
 virtual copy constructor
virtual ~SchedulerParallel ()
 destructor
Accessors/Modifiers
void setNumberOfThreads (Size nb) final
 sets the number of threads that can be used by the scheduler
void setMaxMemory (double megabytes) final
 sets an upper bound on the memory consumption admissible
void execute (Schedule &) final
 execute all the operations of a given schedule
double nbOperations (const Schedule &) final
 returns an estimation of the number of elementary operations needed to perform a given schedule
std::pair< double, doublememoryUsage (const Schedule &) final
 returns the memory consumption used during the execution of a schedule
Accessors/Modifiers
virtual double maxMemory () const
 returns the Max memory (in megabytes) available for executing schedules
Accessors/Modifiers
virtual Size getNumberOfThreads () const
 returns the current max number of threads used by the class containing this ThreadNumberManager
bool isGumNumberOfThreadsOverriden () const
 indicates whether the class containing this ThreadNumberManager set its own number of threads

Protected Attributes

double _max_memory {0.0}
 the max memory usage possible (in bytes)

Private Attributes

SchedulerSequential _sequential_scheduler_
 a scheduler used for computing the number of operations and memory usage
Size _nb_threads_ {0}
 the max number of threads used by the class

Detailed Description

A scheduler that executes available operators in parallel.

Definition at line 74 of file schedulerParallel.h.

Constructor & Destructor Documentation

◆ SchedulerParallel() [1/3]

gum::SchedulerParallel::SchedulerParallel ( Size max_nb_threads = 0,
double max_megabyte_memory = 0.0 )
explicit

default constructor

Referenced by SchedulerParallel(), SchedulerParallel(), ~SchedulerParallel(), and clone().

Here is the caller graph for this function:

◆ SchedulerParallel() [2/3]

gum::SchedulerParallel::SchedulerParallel ( const SchedulerParallel & from)

copy constructor

References SchedulerParallel().

Here is the call graph for this function:

◆ SchedulerParallel() [3/3]

gum::SchedulerParallel::SchedulerParallel ( SchedulerParallel && from)

move constructor

References SchedulerParallel().

Here is the call graph for this function:

◆ ~SchedulerParallel()

virtual gum::SchedulerParallel::~SchedulerParallel ( )
virtual

destructor

References SchedulerParallel().

Here is the call graph for this function:

Member Function Documentation

◆ clone()

SchedulerParallel * gum::SchedulerParallel::clone ( ) const
finalvirtual

virtual copy constructor

Implements gum::Scheduler.

References SchedulerParallel().

Here is the call graph for this function:

◆ execute()

void gum::SchedulerParallel::execute ( Schedule & )
finalvirtual

execute all the operations of a given schedule

Implements gum::Scheduler.

References execute().

Referenced by execute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNumberOfThreads()

virtual Size gum::ThreadNumberManager::getNumberOfThreads ( ) const
virtualinherited

◆ isGumNumberOfThreadsOverriden()

bool gum::ThreadNumberManager::isGumNumberOfThreadsOverriden ( ) const
virtualinherited

indicates whether the class containing this ThreadNumberManager set its own number of threads

Implements gum::IThreadNumberManager.

Referenced by gum::learning::IBNLearner::createParamEstimator_(), and gum::learning::IBNLearner::createScore_().

Here is the caller graph for this function:

◆ maxMemory()

virtual double gum::Scheduler::maxMemory ( ) const
virtualinherited

returns the Max memory (in megabytes) available for executing schedules

Returns
the Max memory (in megabytes) available for executing schedules. 0 means an unlimited amount of memory

Referenced by gum::ScheduledInference::operator=().

Here is the caller graph for this function:

◆ memoryUsage()

std::pair< double, double > gum::SchedulerParallel::memoryUsage ( const Schedule & )
finalvirtual

returns the memory consumption used during the execution of a schedule

Actually, this function does not return a precise account of the memory used to perform the schedule but a rough estimate based on the sizes of the tables involved in the schedule.

Returns
a pair of memory consumption: the first one is the maximum amount of memory used during the execution of the Schedule and the second one is the amount of memory still used at the end of the execution of the schedule

Implements gum::Scheduler.

References memoryUsage().

Referenced by memoryUsage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nbOperations()

double gum::SchedulerParallel::nbOperations ( const Schedule & )
finalvirtual

returns an estimation of the number of elementary operations needed to perform a given schedule

Implements gum::Scheduler.

References nbOperations().

Referenced by nbOperations().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMaxMemory()

void gum::SchedulerParallel::setMaxMemory ( double megabytes)
finalvirtual

sets an upper bound on the memory consumption admissible

Parameters
megabytesthe number of megabytes that can be used for the execution of the schedule. If this number is equal to 0, then no memory limit is applied.

Reimplemented from gum::Scheduler.

References setMaxMemory().

Referenced by setMaxMemory().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setNumberOfThreads()

void gum::SchedulerParallel::setNumberOfThreads ( Size nb)
finalvirtual

sets the number of threads that can be used by the scheduler

Parameters
nbthe number of threads used for executing schedules. If this number is set to 0, then it is defaulted to aGrUM's number of threads

Reimplemented from gum::ThreadNumberManager.

References setNumberOfThreads().

Referenced by setNumberOfThreads().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _max_memory

double gum::Scheduler::_max_memory {0.0}
protectedinherited

the max memory usage possible (in bytes)

Definition at line 142 of file scheduler.h.

142{0.0};

◆ _nb_threads_

Size gum::ThreadNumberManager::_nb_threads_ {0}
privateinherited

the max number of threads used by the class

Definition at line 126 of file threadNumberManager.h.

126{0};

◆ _sequential_scheduler_

SchedulerSequential gum::SchedulerParallel::_sequential_scheduler_
private

a scheduler used for computing the number of operations and memory usage

Definition at line 140 of file schedulerParallel.h.


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