StatMech
Loading...
Searching...
No Matches
OMP_helper.hpp
Go to the documentation of this file.
1#pragma once
2
3#if __has_include(<omp.h>)
4 #include <omp.h>
5__host__ __device__ static inline int get_max_threads() {
6 #ifdef __CUDA_ARCH__
7 return 1;
8 #else
9 return omp_get_max_threads();
10 #endif
11}
12__host__ __device__ static inline int get_thread_num() {
13 #ifdef __CUDA_ARCH__
14 return 0;
15 #else
16 return omp_get_thread_num();
17 #endif
18}
19#else
20constexpr static inline int get_max_threads() { return 1; }
21constexpr static inline int get_thread_num() { return 0; }
22#endif