Skip to content

Commit

Permalink
Ensure that _OPENMP and BOUT_USE_OPENMP is the same
Browse files Browse the repository at this point in the history
  • Loading branch information
dschwoerer committed Feb 21, 2024
1 parent 828552b commit f9b8426
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/bout/array.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <memory>
#include <vector>

#ifdef _OPENMP
#if BOUT_USE_OPENMP
#include <omp.h>
#endif

Expand Down
4 changes: 4 additions & 0 deletions include/bout/openmpwrap.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@
#define BOUT_OMP(...) _Pragma(INDIRECT2(__VA_ARGS__))
#else
#define BOUT_OMP(...)
#ifdef _OPENMP
inline int constexpr omp_get_max_threads() { return 1; }
inline int constexpr omp_get_num_threads() { return 1; }
inline int constexpr omp_get_thread_num() { return 0; }
#else
#error OpenMP used but BOUT++ thinks it is disabled
#endif
#endif

//Perhaps want to cleanup local helpers with below, but DON'T!
Expand Down

0 comments on commit f9b8426

Please sign in to comment.