aGrUM  0.15.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::ThreadData< T_DATA >
 A wrapper that enables to store data in a way that prevents false cacheline sharing. 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

◆ getDynamicThreadsNumber()

INLINE bool gum::getDynamicThreadsNumber ( )

Get the dynamic thread number adjustment status.

Returns
True if dynamic adjustment is enabled, False otherwise.

Definition at line 114 of file OMPThreads_inl.h.

114  {
115 #ifdef _OPENMP
116  return ((omp_get_dynamic() == 0) ? false : true);
117 #else
118  return false;
119 #endif
120  }

◆ getMaxNumberOfThreads() [1/2]

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 40 of file thread_inl.h.

40  {
41  return std::thread::hardware_concurrency();
42  }

◆ getMaxNumberOfThreads() [2/2]

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 53 of file OMPThreads_inl.h.

53  {
54 #ifdef _OPENMP
55  return omp_get_max_threads();
56 #else
57  return 1;
58 #endif
59  }

◆ getNestedParallelism()

INLINE bool gum::getNestedParallelism ( )

Get nested parallelism status.

Returns
True if nested parallelism is enabled, False otherwise.

Definition at line 95 of file OMPThreads_inl.h.

95  {
96 #ifdef _OPENMP
97  return ((omp_get_nested() == 0) ? false : true);
98 #else
99  return false;
100 #endif
101  }

◆ getNumberOfLogicalProcessors()

INLINE unsigned int gum::getNumberOfLogicalProcessors ( )

Get the number of logical processors.

Returns
The number of logical processors.

Definition at line 77 of file OMPThreads_inl.h.

77  {
78 #ifdef _OPENMP
79  return omp_get_num_procs();
80 #else
81  return 1;
82 #endif
83  }

◆ getNumberOfRunningThreads()

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 69 of file OMPThreads_inl.h.

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

69  {
70 #ifdef _OPENMP
71  return omp_get_num_threads();
72 #else
73  return 1;
74 #endif
75  }
+ Here is the caller graph for this function:

◆ getThreadNumber()

INLINE unsigned int gum::getThreadNumber ( )

Get the calling thread id.

Call this from a parallel region.

Returns
The calling thread id.

Definition at line 61 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().

61  {
62 #ifdef _OPENMP
63  return omp_get_thread_num();
64 #else
65  return 0;
66 #endif
67  }
+ Here is the caller graph for this function:

◆ isOMP()

INLINE bool gum::isOMP ( )

Is OMP active ?

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

Definition at line 35 of file OMPThreads_inl.h.

35  {
36 #ifdef _OPENMP
37  return true;
38 #else
39  return false;
40 #endif
41  }

◆ setDynamicThreadsNumber()

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 103 of file OMPThreads_inl.h.

References GUM_ERROR.

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

◆ setNestedParallelism()

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 85 of file OMPThreads_inl.h.

References GUM_ERROR.

85  {
86 #ifdef _OPENMP
87  omp_set_nested(((value == true) ? 1 : 0));
88 #else
89  GUM_ERROR(OperationNotAllowed,
90  "openMP was not enabled at compilation (and you "
91  "asked for nested parallelism !)");
92 #endif
93  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55

◆ setNumberOfThreads()

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 43 of file OMPThreads_inl.h.

References GUM_ERROR.

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