| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 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 |
|
| 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 |
| 47 |
#endif |
| 48 |
|
| 49 |
|
| 50 |
namespace dmlc { |
| 51 |
#ifdef _MSC_VER |
| 52 |
typedef int omp_uint; |
| 53 |
typedef long omp_ulong; |
| 54 |
#else |
| 55 |
typedef unsigned omp_uint; |
| 56 |
typedef unsigned long omp_ulong; |
| 57 |
#endif |
| 58 |
|
| 59 |
} |
| 60 |
#endif |