OpenMP.h 563 Bytes
Newer Older
1
2
3
#ifndef AMDIS_OPENMP_H
#define AMDIS_OPENMP_H

4
#ifdef _OPENMP
5

6
#include <algorithm>
7
#include <omp.h>
8

9
10
const bool amdisHaveOpenMP = true;

11
12
13
14
inline int omp_get_overall_max_threads() {
  return std::max(omp_get_max_threads(), omp_get_num_threads());
}

15
16
#else

17
18
const bool amdisHaveOpenMP = false;

19
20
21
22
inline int omp_get_max_threads() {
  return 1;
}

23
24
25
26
inline int omp_get_num_procs() {
  return 1;
}

27
28
29
30
31
32
33
34
inline int omp_get_num_threads() {
  return 1;
}

inline int omp_get_thread_num() {
  return 0;
}

35
36
37
38
inline int omp_get_overall_max_threads() {
  return 1;
}

39
40
#endif

41
#endif