Debian Codegraph @

src/conditional_omp.h

raw
1 /* Header file to conditionally wrap omp.h defines
2 *
3 * _OPENMP should be defined if omp.h is safe to include
4 */
5 #if defined(_OPENMP)
6 #include <omp.h>
7 #define have_openmp 1
8 #else
9 /* These are fake defines to make these symbols valid in the c / pyx file
10 *
11 * All uses of these symbols should to be prefaced with ``if have_openmp``, as
12 * in:
13 *
14 * cdef omp_lock_t lock
15 * if have_openmp:
16 * openmp.omp_init_lock(&lock)
17 *
18 * */
19 typedef int omp_lock_t;
20 void omp_init_lock(omp_lock_t *lock) {};
21 void omp_destroy_lock(omp_lock_t *lock) {};
22 void omp_set_lock(omp_lock_t *lock) {};
23 void omp_unset_lock(omp_lock_t *lock) {};
24 int omp_test_lock(omp_lock_t *lock) { return -1;};
25 void omp_set_dynamic(int dynamic_threads) {};
26 void omp_set_num_threads(int num_threads) {};
27 int omp_get_num_procs() { return -1;};
28 int omp_get_max_threads() { return -1; };
29 #define have_openmp 0
30 #endif