8#include <compile_time_options.h>
10#include <deal.II/base/config.h>
47#define RYUJIN_PRAGMA(x) _Pragma(#x)
54#define RYUJIN_PARALLEL_REGION_BEGIN \
55 RYUJIN_PRAGMA(omp parallel default(shared)) \
63#define RYUJIN_PARALLEL_REGION_END }
70#define RYUJIN_OMP_FOR RYUJIN_PRAGMA(omp for)
79#define RYUJIN_OMP_FOR_NOWAIT RYUJIN_PRAGMA(omp for nowait)
86#define RYUJIN_OMP_BARRIER RYUJIN_PRAGMA(omp barrier)
93#define RYUJIN_OMP_CRITICAL RYUJIN_PRAGMA(omp critical)
100#define RYUJIN_OMP_SINGLE RYUJIN_PRAGMA(omp single)
116#define RYUJIN_LIKELY(x) (__builtin_expect(!!(x), 1))
132#define RYUJIN_UNLIKELY(x) (__builtin_expect(!!(x), 0))
145 : async_payload_(async_payload)
146 , n_threads_ready_(0)
154 if (payload_status_.valid()) {
155 payload_status_.wait();
161#ifdef ASYNC_MPI_EXCHANGE
162 DEAL_II_ALWAYS_INLINE
inline void check(
bool &thread_ready,
163 const bool condition)
169 if (++n_threads_ready_ == omp_get_num_threads())
171 payload_status_ = std::async(std::launch::async, async_payload_);
175 DEAL_II_ALWAYS_INLINE
inline void check(
bool &,
const bool) {}
179 const std::function<void()> async_payload_;
180 std::future<void> payload_status_;
181 std::atomic_int n_threads_ready_;
~SynchronizationDispatch()
SynchronizationDispatch(const std::function< void()> &async_payload)
DEAL_II_ALWAYS_INLINE void check(bool &, const bool)
#define RYUJIN_UNLIKELY(x)