Debian Codegraph @

src/dmlc-core/include/dmlc/omp.h

raw symbols SCIP
1 /*!
2 * Copyright (c) 2015 by Contributors
3 * \file omp.h
4 * \brief header to handle OpenMP compatibility issues
5 */
6 #ifndef DMLC_OMP_H_
7 #define DMLC_OMP_H_
8
9 #if defined(_OPENMP)
10 #include <omp.h>
11 #else
12
13 #if defined(__clang__)
14 #undef __GOMP_NOTHROW
15 #define __GOMP_NOTHROW
16 #elif defined(__cplusplus)
17 #undef __GOMP_NOTHROW
18 #define __GOMP_NOTHROW throw()
19 #else
20 #undef __GOMP_NOTHROW
21 #define __GOMP_NOTHROW __attribute__((__nothrow__))
22 #endif
23
24 //! \cond Doxygen_Suppress
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 inline int omp_get_thread_num() __GOMP_NOTHROW {
29 return 0;
30 }
31 inline int omp_get_num_threads() __GOMP_NOTHROW {
32 return 1;
33 }
34 inline int omp_get_max_threads() __GOMP_NOTHROW {
35 return 1;
36 }
37 inline int omp_get_num_procs() __GOMP_NOTHROW {
38 return 1;
39 }
40 inline void omp_set_num_threads(int nthread) __GOMP_NOTHROW {}
41 inline int omp_in_parallel() __GOMP_NOTHROW {
42 return 0;
43 }
44 #ifdef __cplusplus
45 }
46 #endif // __cplusplus
47 #endif // _OPENMP
48
49 // loop variable used in openmp
50 namespace dmlc {
51 #ifdef _MSC_VER
52 typedef int omp_uint;
53 typedef long omp_ulong; // NOLINT(*)
54 #else
55 typedef unsigned omp_uint;
56 typedef unsigned long omp_ulong; // NOLINT(*)
57 #endif
58 //! \endcond
59 } // namespace dmlc
60 #endif // DMLC_OMP_H_