![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
Class containing a schedule of operations to perform on multidims. More...
#include <schedule.h>
Public Member Functions | |
Constructors / Destructors | |
Schedule () | |
default constructor (construct an empty sequence) More... | |
Schedule (const Schedule< GUM_SCALAR > &) | |
copy constructor More... | |
~Schedule () | |
destructor More... | |
Operators | |
Schedule< GUM_SCALAR > & | operator= (const Schedule< GUM_SCALAR > &) |
copy operator More... | |
Accessors/Modifiers | |
NodeId | insert (const ScheduleOperation< GUM_SCALAR > &) |
inserts an operation to be scheduled More... | |
void | forceAfter (const ScheduleOperation< GUM_SCALAR > &op_to_force, const ScheduleOperation< GUM_SCALAR > &op_before) |
adds a constraint indicating that an operation cannot be performed before another one More... | |
void | forceAfter (NodeId op_to_force, NodeId op_before) |
inserts an operation to be scheduled More... | |
void | forceAfter (const ScheduleOperation< GUM_SCALAR > &op_to_force, const Set< const ScheduleOperation< GUM_SCALAR > * > &ops_before) |
adds a constraint indicating that an operation cannot be performed before a set of operations More... | |
void | forceAfter (NodeId op_to_force, const NodeSet &ops_before) |
inserts an operation to be scheduled More... | |
void | forceBefore (const ScheduleOperation< GUM_SCALAR > &op_to_force, const ScheduleOperation< GUM_SCALAR > &op_after) |
adds a constraint indicating that an operation must be performed before another one More... | |
void | forceBefore (NodeId op_to_force, NodeId op_after) |
inserts an operation to be scheduled More... | |
void | forceBefore (const ScheduleOperation< GUM_SCALAR > &op_to_force, const Set< const ScheduleOperation< GUM_SCALAR > * > &ops_after) |
adds a constraint indicating that an operation must be performed before a set of operations More... | |
void | forceBefore (NodeId op_to_force, const NodeSet &ops_after) |
inserts an operation to be scheduled More... | |
const DAG & | scheduling_dag () const |
returns a DAG indicating in which order the operations can be performed More... | |
const ScheduleOperation< GUM_SCALAR > & | operation (NodeId) const |
returns the scheduleOperation corresponding to an id in the DAG More... | |
NodeId | nodeId (const ScheduleOperation< GUM_SCALAR > &) const |
returns the id of the node corresponding to a given ScheduleOperation More... | |
const NodeProperty< const ScheduleOperation< GUM_SCALAR > *> & | operations () const |
resturns the association between operations anf nodeIds More... | |
const NodeSet & | operationsInvolving (const ScheduleMultiDim< GUM_SCALAR > &table) const |
returns the set of operations involving a given multidim table More... | |
const NodeSet & | operationsInvolving (MultiDimId table_id) const |
inserts an operation to be scheduled More... | |
const NodeSet & | availableOperations () const |
returns the set of ScheduleOperations that can be executed at once More... | |
void | execute (NodeId) |
executes a given operation (if this one is available) More... | |
void | execute (const ScheduleOperation< GUM_SCALAR > &) |
inserts an operation to be scheduled More... | |
float | nbOperations (NodeId) const |
returns an estimation of the number of elementary operations needed to perform a given ScheduleOperation More... | |
float | nbOperations (ScheduleOperation< GUM_SCALAR > &) const |
inserts an operation to be scheduled More... | |
std::pair< long, long > | memoryUsage (NodeId) const |
returns the memory consumption used during the execution of an operation More... | |
std::pair< long, long > | memoryUsage (ScheduleOperation< GUM_SCALAR > &) const |
inserts an operation to be scheduled More... | |
Public Types | |
using | OperationId = Idx |
to identify correctly the ids that correspond to ScheduleOperation ids More... | |
using | MultiDimId = Idx |
to identify correctly the ids that correspond to ScheduleMultiDim ids More... | |
Class containing a schedule of operations to perform on multidims.
A Schedule class contains a set of operations to be scheduled. It is able to indicate which operations can currently be performed (because all their arguments have already been computed). In addition, it is possible to insert new operations into the schedule (at a specific place) and to remove some operations.
Definition at line 67 of file schedule.h.
using gum::Schedule< GUM_SCALAR >::MultiDimId = Idx |
to identify correctly the ids that correspond to ScheduleMultiDim ids
Definition at line 73 of file schedule.h.
using gum::Schedule< GUM_SCALAR >::OperationId = Idx |
to identify correctly the ids that correspond to ScheduleOperation ids
Definition at line 70 of file schedule.h.
gum::Schedule< GUM_SCALAR >::Schedule | ( | ) |
default constructor (construct an empty sequence)
gum::Schedule< GUM_SCALAR >::Schedule | ( | const Schedule< GUM_SCALAR > & | ) |
copy constructor
gum::Schedule< GUM_SCALAR >::~Schedule | ( | ) |
destructor
|
private |
updates the set of parents for the nodes whoses parents are not correct yet and update accordingly the available operations
const NodeSet& gum::Schedule< GUM_SCALAR >::availableOperations | ( | ) | const |
returns the set of ScheduleOperations that can be executed at once
The scheduleOperations that can be executed at once are those that have no parent or whose parents have already been executed.
void gum::Schedule< GUM_SCALAR >::execute | ( | NodeId | ) |
executes a given operation (if this one is available)
Note that, whenever an operation is performed, the list of available operations is updated and the operation itslef is removed from the schedule
OperationNotAllowed | exception is thrown if the operation cannot be executed yet because some of its arguments have not already been computed |
NotFound | exception is thrown if the operation cannot be found |
void gum::Schedule< GUM_SCALAR >::execute | ( | const ScheduleOperation< GUM_SCALAR > & | ) |
inserts an operation to be scheduled
The Schedule class is able to determined by itself when the operation should be performed.
void gum::Schedule< GUM_SCALAR >::forceAfter | ( | const ScheduleOperation< GUM_SCALAR > & | op_to_force, |
const ScheduleOperation< GUM_SCALAR > & | op_before | ||
) |
adds a constraint indicating that an operation cannot be performed before another one
void gum::Schedule< GUM_SCALAR >::forceAfter | ( | NodeId | op_to_force, |
NodeId | op_before | ||
) |
inserts an operation to be scheduled
The Schedule class is able to determined by itself when the operation should be performed.
void gum::Schedule< GUM_SCALAR >::forceAfter | ( | const ScheduleOperation< GUM_SCALAR > & | op_to_force, |
const Set< const ScheduleOperation< GUM_SCALAR > * > & | ops_before | ||
) |
adds a constraint indicating that an operation cannot be performed before a set of operations
void gum::Schedule< GUM_SCALAR >::forceAfter | ( | NodeId | op_to_force, |
const NodeSet & | ops_before | ||
) |
inserts an operation to be scheduled
The Schedule class is able to determined by itself when the operation should be performed.
void gum::Schedule< GUM_SCALAR >::forceBefore | ( | const ScheduleOperation< GUM_SCALAR > & | op_to_force, |
const ScheduleOperation< GUM_SCALAR > & | op_after | ||
) |
adds a constraint indicating that an operation must be performed before another one
void gum::Schedule< GUM_SCALAR >::forceBefore | ( | NodeId | op_to_force, |
NodeId | op_after | ||
) |
inserts an operation to be scheduled
The Schedule class is able to determined by itself when the operation should be performed.
void gum::Schedule< GUM_SCALAR >::forceBefore | ( | const ScheduleOperation< GUM_SCALAR > & | op_to_force, |
const Set< const ScheduleOperation< GUM_SCALAR > * > & | ops_after | ||
) |
adds a constraint indicating that an operation must be performed before a set of operations
void gum::Schedule< GUM_SCALAR >::forceBefore | ( | NodeId | op_to_force, |
const NodeSet & | ops_after | ||
) |
inserts an operation to be scheduled
The Schedule class is able to determined by itself when the operation should be performed.
NodeId gum::Schedule< GUM_SCALAR >::insert | ( | const ScheduleOperation< GUM_SCALAR > & | ) |
inserts an operation to be scheduled
The Schedule class is able to determined by itself when the operation should be performed.
std::pair< long, long > gum::Schedule< GUM_SCALAR >::memoryUsage | ( | NodeId | ) | const |
returns the memory consumption used during the execution of an operation
Actually, this function does not return a precise account of the memory used by the scheduleOperation but a rough estimate based on the sizes of the tables involved in the operation.
std::pair< long, long > gum::Schedule< GUM_SCALAR >::memoryUsage | ( | ScheduleOperation< GUM_SCALAR > & | ) | const |
inserts an operation to be scheduled
The Schedule class is able to determined by itself when the operation should be performed.
float gum::Schedule< GUM_SCALAR >::nbOperations | ( | NodeId | ) | const |
returns an estimation of the number of elementary operations needed to perform a given ScheduleOperation
float gum::Schedule< GUM_SCALAR >::nbOperations | ( | ScheduleOperation< GUM_SCALAR > & | ) | const |
inserts an operation to be scheduled
The Schedule class is able to determined by itself when the operation should be performed.
NodeId gum::Schedule< GUM_SCALAR >::nodeId | ( | const ScheduleOperation< GUM_SCALAR > & | ) | const |
returns the id of the node corresponding to a given ScheduleOperation
const ScheduleOperation< GUM_SCALAR >& gum::Schedule< GUM_SCALAR >::operation | ( | NodeId | ) | const |
const NodeProperty< const ScheduleOperation< GUM_SCALAR >* >& gum::Schedule< GUM_SCALAR >::operations | ( | ) | const |
resturns the association between operations anf nodeIds
const NodeSet& gum::Schedule< GUM_SCALAR >::operationsInvolving | ( | const ScheduleMultiDim< GUM_SCALAR > & | table | ) | const |
returns the set of operations involving a given multidim table
const NodeSet& gum::Schedule< GUM_SCALAR >::operationsInvolving | ( | MultiDimId | table_id | ) | const |
inserts an operation to be scheduled
The Schedule class is able to determined by itself when the operation should be performed.
Schedule< GUM_SCALAR >& gum::Schedule< GUM_SCALAR >::operator= | ( | const Schedule< GUM_SCALAR > & | ) |
copy operator
const DAG& gum::Schedule< GUM_SCALAR >::scheduling_dag | ( | ) | const |
|
private |
a hashtable assigning to each ScheduleMultiDim resulting from a computation the MultiDimOperation node id that created it
Definition at line 213 of file schedule.h.
|
mutableprivate |
the DAG of the operations to perform
Operations can be scheduled as a DAG: nodes without parents can be executed directly. The other nodes need their parents to be executed to get all their arguments constructed.
Definition at line 203 of file schedule.h.
|
private |
for each multidim, store the set of operations involving it
Definition at line 229 of file schedule.h.
|
private |
a hashtable assigning to each node of the DAG an operation
Definition at line 206 of file schedule.h.
|
private |
a hashtable assigning to each operation id a node id in the DAG
Definition at line 209 of file schedule.h.
|
mutableprivate |
the set of operations that can be executed at once
Definition at line 226 of file schedule.h.
|
mutableprivate |
a list of operations whose parents are not properly set
when entering operations to be performed in a "wrong" order, it may happen that the parents of some operations in the DAG are not properly set (the parents being inserted after the child). We keep a list of such nodes and, whenever we wish to perform the schedule or get its DAG, we compute the correct set of parents of the operations of this list and, when this is done, we remove them from the list. As such, when the list is empty, the schedule can be performed.
Definition at line 223 of file schedule.h.