aGrUM  0.13.2
Basic data structures
+ Collaboration diagram for Basic data structures:

Detailed Description

Modules

 Hash Tables
 A efficient and flexible implementation of hash tables.
 
 Hash functions
 This module lists all hash functions provided by aGrUM.
 
 Bijections
 Set of pairs of elements with fast search for both elements.
 
 Heaps
 An implementation of heaps.
 
 Lists
 This file provides class List for manipulating generic lists as well as List<>::iterator, List<>::const_iterator, List<>::iterator_safe and List<>::const_iterator_safe for parsing lists.
 
 Priority queue
 This file provides class MultiPriorityQueue that is essentially a heap in which elements are sorted according to a dynamically modifiable priority.
 
 Sequences
 A Sequence<Key> is quite similar to a vector<Key> in that it stores an ordered set of elements.
 
 Sets
 A Set is a structure that contains arbitrary elements.
 
 Splay Trees
 A splay tree is a self-balancing binary search tree.
 

Classes

class  gum::Bijection< T1, T2, Alloc >
 Set of pairs of elements with fast search for both elements. More...
 
class  gum::BinSearchTree< Val, Cmp, Node >
 A generic binary search tree. More...
 
class  gum::BinSearchTreeIterator< Val, Cmp, Node >
 A Generic binary search tree. More...
 
class  gum::BinTreeNode< Val >
 Nodes of a binary trees. More...
 
class  gum::ParseError
 This class is used to represent parsing errors for the different parser implemented in aGrUM. More...
 
class  gum::ErrorsContainer
 This class is used contain and manipulate gum::ParseError. More...
 
class  gum::HashTable< Key, Val, Alloc >
 The class for generic Hash Tables. More...
 
class  gum::Heap< Val, Cmp, Alloc >
 Heap data structureThis structure is a basic heap data structure, i.e., it is a container in which elements are sorted according to a weak ordering. More...
 
class  gum::IndexedTree< Key, Data >
 The class for storing the nodes of the Arborescence. More...
 
class  gum::List< Val, Alloc >
 Generic doubly linked lists. More...
 
class  gum::ListIteratorSafe< Val >
 Safe iterators for Lists. More...
 
class  gum::MultiPriorityQueue< Val, Priority, Cmp, Alloc >
 A MultiPriorityQueue is a heap in which each element has a mutable priority and duplicates are allowedA priority queue is quite similar to a heap except that a priority (a score) is assigned to each element in the structure. More...
 
class  gum::PriorityQueue< Val, Priority, Cmp, Alloc >
 A priorityQueue is a heap in which each element has a mutable priorityA priority queue is quite similar to a heap except that a priority (a score) is assigned to each element in the structure. More...
 
class  gum::RefPtr< Val >
 Smart pointersaGrUM's smart pointers keep track of the number of times the value they point to is referenced. More...
 
class  gum::Sequence< Key, Alloc >
 The generic class for storing (ordered) sequences of objects. More...
 
class  gum::Set< Key, Alloc >
 Representation of a setA Set is a structure that contains arbitrary elements. More...
 
class  gum::SplayTree< Element >
 A splay tree. More...
 
class  gum::Timer
 Class used to compute response times for benchmark purposesThis class represents a classic timer, it starts in the constructor, you can reset it with method reset() and you can get the delta time with the method step(). More...
 

Functions

bool gum::isOMP ()
 Is OMP active ? More...
 
void gum::setNumberOfThreads (unsigned int number)
 Set the number of threads to be used. More...
 
unsigned int gum::getMaxNumberOfThreads ()
 Returns the maximum number of threads at any time. More...
 
unsigned int gum::getThreadNumber ()
 Get the calling thread id. More...
 
unsigned int gum::getNumberOfRunningThreads ()
 Get the current number of running threads. More...
 
unsigned int gum::getNumberOfLogicalProcessors ()
 Get the number of logical processors. More...
 
void gum::setNestedParallelism (bool value)
 Set nested parallelism (false bu default). More...
 
bool gum::getNestedParallelism ()
 Get nested parallelism status. More...
 
void gum::setDynamicThreadsNumber (bool value)
 Set the dynamic threads number (false by default). More...
 
bool gum::getDynamicThreadsNumber ()
 Get the dynamic thread number adjustment status. More...
 
unsigned int gum::thread::getMaxNumberOfThreads ()
 returns the maximum number of threads possible More...
 

Function Documentation

INLINE bool gum::getDynamicThreadsNumber ( )

Get the dynamic thread number adjustment status.

Returns
True if dynamic adjustment is enabled, False otherwise.

Definition at line 112 of file OMPThreads_inl.h.

112  {
113 #ifdef _OPENMP
114  return ((omp_get_dynamic() == 0) ? false : true);
115 #else
116  return false;
117 #endif
118  }
INLINE unsigned int gum::thread::getMaxNumberOfThreads ( )

returns the maximum number of threads possible

Returns
Returns the number of concurrent threads supported by the implementation. The value should be considered only a hint.

Definition at line 38 of file thread_inl.h.

38  {
39  return std::thread::hardware_concurrency();
40  }
INLINE unsigned int gum::getMaxNumberOfThreads ( )

Returns the maximum number of threads at any time.

Call this from anywhere (parallel region or not). By default, it is the number of threads launched in any parallel region.

It should return the number of logical processors by default, i.e. omp_get_num_procs(). If setNumberOfThreads(number) was called, it will return the choosen number.

Returns
Returns the maximum number of threads at any time.

Definition at line 51 of file OMPThreads_inl.h.

51  {
52 #ifdef _OPENMP
53  return omp_get_max_threads();
54 #else
55  return 1;
56 #endif
57  }
INLINE bool gum::getNestedParallelism ( )

Get nested parallelism status.

Returns
True if nested parallelism is enabled, False otherwise.

Definition at line 93 of file OMPThreads_inl.h.

93  {
94 #ifdef _OPENMP
95  return ((omp_get_nested() == 0) ? false : true);
96 #else
97  return false;
98 #endif
99  }
INLINE unsigned int gum::getNumberOfLogicalProcessors ( )

Get the number of logical processors.

Returns
The number of logical processors.

Definition at line 75 of file OMPThreads_inl.h.

75  {
76 #ifdef _OPENMP
77  return omp_get_num_procs();
78 #else
79  return 1;
80 #endif
81  }
INLINE unsigned int gum::getNumberOfRunningThreads ( )

Get the current number of running threads.

Call this from a parallel region.

Returns
The current number of running threads.

Definition at line 67 of file OMPThreads_inl.h.

Referenced by gum::credal::CredalNet< GUM_SCALAR >::__H2Vlrs(), and gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::__mcThreadDataCopy().

67  {
68 #ifdef _OPENMP
69  return omp_get_num_threads();
70 #else
71  return 1;
72 #endif
73  }

+ Here is the caller graph for this function:

INLINE unsigned int gum::getThreadNumber ( )

Get the calling thread id.

Call this from a parallel region.

Returns
The calling thread id.

Definition at line 59 of file OMPThreads_inl.h.

Referenced by gum::credal::CredalNet< GUM_SCALAR >::__H2Vlrs(), gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::__insertEvidence(), gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::__mcThreadDataCopy(), gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::__threadInference(), gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::__threadUpdate(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::__updateThreadCredalSets(), gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::__verticesSampling(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::_computeEpsilon(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::_expFusion(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::_updateMarginals(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::_updateOldMarginals(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::_updateThread(), and gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::_verticesFusion().

59  {
60 #ifdef _OPENMP
61  return omp_get_thread_num();
62 #else
63  return 0;
64 #endif
65  }

+ Here is the caller graph for this function:

INLINE bool gum::isOMP ( )

Is OMP active ?

Returns
True if OMP has been set at compilation, False otherwise.

Definition at line 33 of file OMPThreads_inl.h.

33  {
34 #ifdef _OPENMP
35  return true;
36 #else
37  return false;
38 #endif
39  }
INLINE void gum::setDynamicThreadsNumber ( bool  value)

Set the dynamic threads number (false by default).

Automatically adjust the number of running threads within a parallel region.

Desactivated by default.

Parameters
valueTrue if dynamic thread number should be used, False otherwise.

Definition at line 101 of file OMPThreads_inl.h.

References GUM_ERROR.

101  {
102 #ifdef _OPENMP
103  omp_set_dynamic(((value == true) ? 1 : 0));
104 #else
105  GUM_ERROR(OperationNotAllowed,
106  "openMP was not enabled at compilation (and you "
107  "asked for dynamic adjustment of the number of "
108  "threads !)");
109 #endif
110  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66
INLINE void gum::setNestedParallelism ( bool  value)

Set nested parallelism (false bu default).

Nested parallelism, i.e. parallel activity within another parallel activity : threads creating more threads.

Off by default.

Parameters
valueTrue if nested parallelism should be activated, False otherwise.

Definition at line 83 of file OMPThreads_inl.h.

References GUM_ERROR.

83  {
84 #ifdef _OPENMP
85  omp_set_nested(((value == true) ? 1 : 0));
86 #else
87  GUM_ERROR(OperationNotAllowed,
88  "openMP was not enabled at compilation (and you "
89  "asked for nested parallelism !)");
90 #endif
91  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66
INLINE void gum::setNumberOfThreads ( unsigned int  number)

Set the number of threads to be used.

To avoid spare cycles (less then 100% CPU occupied), use more threads than logical processors (x2 is a good all-around value).

Parameters
numberThe number of threads to be used.

Definition at line 41 of file OMPThreads_inl.h.

References GUM_ERROR.

41  {
42 #ifdef _OPENMP
43  omp_set_num_threads(number);
44 #else
45  GUM_ERROR(OperationNotAllowed,
46  "openMP was not enabled at compilation (or "
47  "you asked for 0 threads !)");
48 #endif
49  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66