12 #include <base/util.hpp> 21 HMLP_SCHEDULE_DEFAULT,
22 HMLP_SCHEDULE_ROUND_ROBIN,
23 HMLP_SCHEDULE_UNIFORM,
32 Range(
int beg,
int end,
int inc );
40 void Print(
int prefix );
44 tuple<int, int, int > info;
63 #ifdef USE_PTHREAD_RUNTIME 80 volatile bool barrier_sense =
false;
82 volatile int barrier_threads_arrived = 0;
84 void Barrier(
int size );
97 Comm(
Comm* parent,
Context* context,
int assigned_size,
int assigned_rank );
99 Comm Split(
int num_groups );
105 void Send(
void** sent_object );
107 void Recv(
void** recv_object );
109 template<
typename Arg>
110 void Bcast( Arg& buffer,
int root )
112 if ( rank == root ) Send( (
void**)&buffer );
114 if ( rank != root ) Recv( (
void**)&buffer );
117 template<
int ALIGN_SIZE,
typename T>
118 T *AllocateSharedMemory(
size_t count )
121 if ( Master() ) ptr = hmlp_malloc<ALIGN_SIZE, T>( count );
127 void FreeSharedMemory( T *ptr )
133 void Create1DLocks(
int n );
135 void Destroy1DLocks();
137 void Create2DLocks(
int m,
int n );
139 void Destroy2DLocks();
141 void Acquire1DLocks(
int i );
143 void Release1DLocks(
int i );
145 void Acquire2DLocks(
int i ,
int j );
147 void Release2DLocks(
int i ,
int j );
157 int BalanceOver1DGangs(
int n,
int default_size,
int nb );
159 Range DistributeOver1DThreads(
int beg,
int end,
int nb );
161 Range DistributeOver1DGangs(
int beg,
int end,
int nb );
163 void Print(
int prefix );
181 vector<hmlp::Lock>* lock1d = NULL;
183 vector<vector<hmlp::Lock>>* lock2d = NULL;
187 template<
typename FUNC,
typename... Args>
192 func( *comm, args... );
202 Comm CommGLB( &context );
204 func( CommGLB, args... );
void Parallelize(tci::Comm *comm, FUNC func, Args &&...args)
Definition: tci.hpp:188
Wrapper for omp or pthread mutex.
Definition: tci.hpp:50
void hmlp_free(T *ptr)
Free the aligned memory.
Definition: util.hpp:88