ampsci
c++ program for high-precision atomic structure calculations of single-valence systems
Loading...
Searching...
No Matches
omp.hpp
1#pragma once
2#include <string>
3
4// #include this instead of <omp.h>
5// This allows ompenMP code to compile, even if
6
7#if defined(_OPENMP)
8#include <omp.h>
9namespace qip {
10constexpr bool use_omp = true;
11} // namespace qip
12#else
13#pragma GCC diagnostic ignored "-Wunknown-pragmas"
14namespace qip {
15constexpr bool use_omp = false;
16} // namespace qip
17#define omp_get_thread_num() 0
18#define omp_get_max_threads() 1
19#endif
20
21namespace qip {
22inline std::string omp_details() {
23 return use_omp ? "Using OpenMP with " +
24 std::to_string(omp_get_max_threads()) + " threads." :
25 "Single-threaded.";
26}
27} // namespace qip
qip library: A collection of useful functions
Definition Array.hpp:9