Treelite
omp.h
Go to the documentation of this file.
1 
7 #ifndef TREELITE_OMP_H_
8 #define TREELITE_OMP_H_
9 
10 #ifdef TREELITE_OPENMP_SUPPORT
11 #include <omp.h>
12 #include <limits>
13 
14 // MSVC doesn't implement the thread limit.
15 #if defined(_MSC_VER)
16 inline int omp_get_thread_limit() {
17  return std::numeric_limits<int>::max();
18 }
19 #endif // defined(_MSC_VER)
20 
21 #else // TREELITE_OPENMP_SUPPORT
22 
23 // Stubs for OpenMP functions, to be used when OpenMP is not available.
24 
25 inline int omp_get_thread_limit() {
26  return 1;
27 }
28 
29 inline int omp_get_thread_num() {
30  return 0;
31 }
32 
33 inline int omp_get_max_threads() {
34  return 1;
35 }
36 
37 inline int omp_get_num_procs() {
38  return 1;
39 }
40 
41 #endif // TREELITE_OPENMP_SUPPORT
42 
43 #endif // TREELITE_OMP_H_
compatiblity wrapper for systems that don&#39;t support OpenMP