20 #ifndef GALOIS_SUBSTRATE_BARRIER_H
21 #define GALOIS_SUBSTRATE_BARRIER_H
26 #include "galois/config.h"
38 virtual void reinit(
unsigned val) = 0;
41 virtual void wait() = 0;
47 virtual const char*
name()
const = 0;
76 template <
typename _UNUSED =
void>
77 struct BarrierInstance {
78 unsigned m_num_threads;
79 std::unique_ptr<Barrier> m_barrier;
81 BarrierInstance(
void) {
86 Barrier&
get(
unsigned numT) {
88 "substrate::getBarrier() number of threads must be > 0");
93 if (numT != m_num_threads) {
95 m_barrier->reinit(numT);
102 void setBarrierInstance(BarrierInstance<>* bi);
ThreadPool & getThreadPool(void)
return a reference to system thread pool
Definition: ThreadPool.cpp:259
unsigned getMaxThreads() const
return the number of threads supported by the thread pool on the current machine
Definition: ThreadPool.h:178
std::unique_ptr< Barrier > createTopoBarrier(unsigned)
Definition: Barrier_Topo.cpp:126
std::unique_ptr< Barrier > createCountingBarrier(unsigned)
Definition: Barrier_Counting.cpp:67
virtual const char * name() const =0
Barrier & getBarrier(unsigned activeThreads)
Return a reference to system barrier.
Definition: libgalois/src/Barrier.cpp:38
std::unique_ptr< Barrier > createSimpleBarrier(unsigned int)
Creates a new simple barrier.
Definition: Barrier_Simple.cpp:85
virtual void reinit(unsigned val)=0
#define GALOIS_ASSERT(cond,...)
Like assert but unconditionally executed.
Definition: gIO.h:102
const Ty max(std::atomic< Ty > &a, const Ty &b)
Definition: AtomicHelpers.h:40
unsigned int activeThreads
Definition: Threads.cpp:26
std::unique_ptr< Barrier > createPthreadBarrier(unsigned)
Create specific types of barriers.
Definition: Barrier_Pthread.cpp:85
const Ty min(std::atomic< Ty > &a, const Ty &b)
Definition: AtomicHelpers.h:70
std::unique_ptr< Barrier > createMCSBarrier(unsigned)
Definition: Barrier_MCS.cpp:106
virtual ~Barrier()
Definition: libgalois/src/Barrier.cpp:23
std::unique_ptr< Barrier > createDisseminationBarrier(unsigned)
Definition: Barrier_Dissemination.cpp:100
void operator()(void)
Definition: Barrier.h:44