lvropenmp.cpp
Go to the documentation of this file.
1 
28 /*
29  * lvropenmp.cpp
30  *
31  * Created on: 23.01.2015
32  * Author: Thomas Wiemann
33  */
34 
36 
37 #ifdef LVR2_USE_OPEN_MP
38 #include <omp.h>
39 #endif
40 
41 #include <iostream>
42 using namespace std;
43 
44 namespace lvr2
45 {
46 
47 bool OpenMPConfig::haveOpenMP()
48 {
49 #ifdef LVR2_USE_OPEN_MP
50  return true;
51 #else
52  return false;
53 #endif
54 }
55 
56 void OpenMPConfig::setNumThreads(int n)
57 {
58 #ifdef LVR2_USE_OPEN_MP
59  omp_set_num_threads(n);
60 #endif
61 }
62 
63 void OpenMPConfig::setMaxNumThreads()
64 {
65 #ifdef LVR2_USE_OPEN_MP
66  omp_set_num_threads(omp_get_num_procs());
67 #endif
68 }
69 
70 int OpenMPConfig::getNumThreads()
71 {
72 #ifdef LVR2_USE_OPEN_MP
73  return omp_get_max_threads();
74 #else
75  return 1;
76 #endif
77 }
78 
79 } // namespace lvr2
80 
81 


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Mon Feb 28 2022 22:46:08