aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
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 113 of file OMPThreads_inl.h.

References gum::Set< Key, Alloc >::emplace().

113  {
114 #ifdef _OPENMP
115  return ((omp_get_dynamic() == 0) ? false : true);
116 #else
117  return false;
118 #endif
119  }
+ Here is the call graph for this function:

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

39 { return std::thread::hardware_concurrency(); }

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

References gum::Set< Key, Alloc >::emplace().

52  {
53 #ifdef _OPENMP
54  return omp_get_max_threads();
55 #else
56  return 1;
57 #endif
58  }
+ Here is the call graph for this function:

◆ getNestedParallelism()

INLINE bool gum::getNestedParallelism ( )

Get nested parallelism status.

Returns
True if nested parallelism is enabled, False otherwise.

Definition at line 94 of file OMPThreads_inl.h.

References gum::Set< Key, Alloc >::emplace().

94  {
95 #ifdef _OPENMP
96  return ((omp_get_nested() == 0) ? false : true);
97 #else
98  return false;
99 #endif
100  }
+ Here is the call graph for this function:

◆ getNumberOfLogicalProcessors()

INLINE unsigned int gum::getNumberOfLogicalProcessors ( )

Get the number of logical processors.

Returns
The number of logical processors.

Definition at line 76 of file OMPThreads_inl.h.

References gum::Set< Key, Alloc >::emplace().

76  {
77 #ifdef _OPENMP
78  return omp_get_num_procs();
79 #else
80  return 1;
81 #endif
82  }
+ Here is the call graph for this function:

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

References gum::Set< Key, Alloc >::emplace().

68  {
69 #ifdef _OPENMP
70  return omp_get_num_threads();
71 #else
72  return 1;
73 #endif
74  }
+ Here is the call 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 60 of file OMPThreads_inl.h.

References gum::Set< Key, Alloc >::emplace().

60  {
61 #ifdef _OPENMP
62  return omp_get_thread_num();
63 #else
64  return 0;
65 #endif
66  }
+ Here is the call 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 34 of file OMPThreads_inl.h.

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

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

References gum::Set< Key, Alloc >::emplace().

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

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

References gum::Set< Key, Alloc >::emplace().

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

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

References gum::Set< Key, Alloc >::emplace().

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