aGrUM  0.13.2
OMPThreads.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Pierre-Henri WUILLEMIN and Christophe GONZALES *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
27 #ifndef GUM_OPEM_MP_THREADS_H
28 #define GUM_OPEM_MP_THREADS_H
29 
30 #ifdef _OPENMP
31 # include <omp.h>
32 #endif
33 
34 namespace gum {
35 
41  bool isOMP();
42 
51  void setNumberOfThreads(unsigned int number);
52 
66  unsigned int getMaxNumberOfThreads();
67 
75  unsigned int getThreadNumber();
76 
84  unsigned int getNumberOfRunningThreads();
85 
91  unsigned int getNumberOfLogicalProcessors();
92 
105  void setNestedParallelism(bool value);
106 
112  bool getNestedParallelism();
113 
126  void setDynamicThreadsNumber(bool value);
127 
135 } // namespace gum
136 
137 // include the inlined functions if necessary
138 #ifndef GUM_NO_INLINE
139 # include <agrum/core/OMPThreads_inl.h>
140 #endif /* GUM_NO_INLINE */
141 
142 #endif // GUM_OPEM_MP_THREADS_H
bool isOMP()
Is OMP active ?
unsigned int getNumberOfLogicalProcessors()
Get the number of logical processors.
unsigned int getNumberOfRunningThreads()
Get the current number of running threads.
unsigned int getThreadNumber()
Get the calling thread id.
OpenMP wrappers implementation.
bool getDynamicThreadsNumber()
Get the dynamic thread number adjustment status.
void setNestedParallelism(bool value)
Set nested parallelism (false bu default).
unsigned int getMaxNumberOfThreads()
Returns the maximum number of threads at any time.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
bool getNestedParallelism()
Get nested parallelism status.
void setDynamicThreadsNumber(bool value)
Set the dynamic threads number (false by default).
void setNumberOfThreads(unsigned int number)
Set the number of threads to be used.