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

#include <schedulerSequential.h>

Inheritance diagram for gum::SchedulerSequential:
Collaboration diagram for gum::SchedulerSequential:

Classes

struct  UnexecutedOperation
 a structure to keep informations about operations that could not be executed due to memory usage limitations More...

Public Member Functions

Constructors / Destructors
 SchedulerSequential (Size max_nb_threads=0, double max_megabyte_memory=0.0)
 default constructor
 SchedulerSequential (const SchedulerSequential &from)
 copy constructor
 SchedulerSequential (SchedulerSequential &&from)
 move constructor
SchedulerSequentialclone () const final
 virtual copy constructor
virtual ~SchedulerSequential ()
 destructor
Accessors/Modifiers
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 void setNumberOfThreads (Size nb)
 sets the number max of threads to be used by the class containing this ThreadNumberManager
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 Member Functions

void _setSchedule_ (const Schedule &schedule)
 sets a schedule and updates the set of operations if necessary
Size _addExecutableOps_ (std::vector< UnexecutedOperation > &unexecuted_deletions, std::vector< UnexecutedOperation > &unexecuted_operations, bool &unexecuted_deletions_sorted, bool &unexecuted_operations_sorted, double memory_used, double max_memory, List< NodeId > &available_nodes) const
 add the currently executable deletions into the set of available operations
void _simulateDAGUpdate_ (DAG &dag, const NodeId node, std::vector< NodeId > &new_available_nodes) const
 simulate the update of the schedule's DAG resulting from the execution of an operation
void _simulateExecuteOneOperation_ (const NodeId node, ScheduleOperator &op, DAG &dag, List< NodeId > &available_nodes, std::vector< NodeId > &new_available_nodes)
 simulate the execution of one operation
void _simulateExecution_ ()
 simulate the execution of the whole schedule

Static Private Member Functions

static bool _cmp_ (const UnexecutedOperation &a, const UnexecutedOperation &b)
 the comparison function used to sort unexecutable operations

Private Attributes

Schedule_schedule_ {nullptr}
 the schedule we wish to execute
std::vector< NodeId_operations_
 the sequence of operations to perform
std::pair< double, double_memory_usage_ {0.0, 0.0}
 the memory usage for the sequence of operations;
bool _operations_up_to_date_ {false}
 is the set of operations up to date
Size _nb_threads_ {0}
 the max number of threads used by the class

Detailed Description

Definition at line 60 of file schedulerSequential.h.

Constructor & Destructor Documentation

◆ SchedulerSequential() [1/3]

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

default constructor

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

Here is the caller graph for this function:

◆ SchedulerSequential() [2/3]

gum::SchedulerSequential::SchedulerSequential ( const SchedulerSequential & from)

copy constructor

References SchedulerSequential().

Here is the call graph for this function:

◆ SchedulerSequential() [3/3]

gum::SchedulerSequential::SchedulerSequential ( SchedulerSequential && from)

move constructor

References SchedulerSequential().

Here is the call graph for this function:

◆ ~SchedulerSequential()

virtual gum::SchedulerSequential::~SchedulerSequential ( )
virtual

destructor

References SchedulerSequential().

Here is the call graph for this function:

Member Function Documentation

◆ _addExecutableOps_()

Size gum::SchedulerSequential::_addExecutableOps_ ( std::vector< UnexecutedOperation > & unexecuted_deletions,
std::vector< UnexecutedOperation > & unexecuted_operations,
bool & unexecuted_deletions_sorted,
bool & unexecuted_operations_sorted,
double memory_used,
double max_memory,
List< NodeId > & available_nodes ) const
private

add the currently executable deletions into the set of available operations

◆ _cmp_()

bool gum::SchedulerSequential::_cmp_ ( const UnexecutedOperation & a,
const UnexecutedOperation & b )
staticprivate

the comparison function used to sort unexecutable operations

◆ _setSchedule_()

void gum::SchedulerSequential::_setSchedule_ ( const Schedule & schedule)
private

sets a schedule and updates the set of operations if necessary

◆ _simulateDAGUpdate_()

void gum::SchedulerSequential::_simulateDAGUpdate_ ( DAG & dag,
const NodeId node,
std::vector< NodeId > & new_available_nodes ) const
private

simulate the update of the schedule's DAG resulting from the execution of an operation

◆ _simulateExecuteOneOperation_()

void gum::SchedulerSequential::_simulateExecuteOneOperation_ ( const NodeId node,
ScheduleOperator & op,
DAG & dag,
List< NodeId > & available_nodes,
std::vector< NodeId > & new_available_nodes )
private

simulate the execution of one operation

◆ _simulateExecution_()

void gum::SchedulerSequential::_simulateExecution_ ( )
private

simulate the execution of the whole schedule

◆ clone()

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

virtual copy constructor

Implements gum::Scheduler.

References SchedulerSequential().

Here is the call graph for this function:

◆ execute()

void gum::SchedulerSequential::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::SchedulerSequential::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::SchedulerSequential::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::SchedulerSequential::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()

virtual void gum::ThreadNumberManager::setNumberOfThreads ( Size nb)
virtualinherited

sets the number max of threads to be used by the class containing this ThreadNumberManager

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

Implements gum::IThreadNumberManager.

Reimplemented in gum::learning::IBNLearner, gum::learning::RecordCounter, gum::ScheduledInference, and gum::SchedulerParallel.

Referenced by gum::learning::IBNLearner::setNumberOfThreads(), and gum::ScheduledInference::setNumberOfThreads().

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};

◆ _memory_usage_

std::pair< double, double > gum::SchedulerSequential::_memory_usage_ {0.0, 0.0}
private

the memory usage for the sequence of operations;

Definition at line 125 of file schedulerSequential.h.

125{0.0, 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};

◆ _operations_

std::vector< NodeId > gum::SchedulerSequential::_operations_
private

the sequence of operations to perform

Definition at line 122 of file schedulerSequential.h.

◆ _operations_up_to_date_

bool gum::SchedulerSequential::_operations_up_to_date_ {false}
private

is the set of operations up to date

Definition at line 128 of file schedulerSequential.h.

128{false};

◆ _schedule_

Schedule* gum::SchedulerSequential::_schedule_ {nullptr}
private

the schedule we wish to execute

Definition at line 119 of file schedulerSequential.h.

119{nullptr};

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