26 #ifndef HMLP_THREAD_HPP 27 #define HMLP_THREAD_HPP 39 #include <base/tci.hpp> 40 #include <base/device.hpp> 65 range(
int beg,
int end,
int inc );
75 std::tuple<int, int, int > info;
81 SchedulePolicy strategy,
82 int beg,
int end,
int nb,
88 int beg,
int end,
int nb,
94 int beg,
int end,
int nb
115 void Create(
int level,
int num_threads,
int *config );
122 void Send(
void** buffer );
124 void Recv(
void** buffer );
153 volatile bool barrier_sense;
155 int barrier_threads_arrived;
236 template<
typename Arg>
237 void Bcast( Arg& buffer )
239 if ( Master() ) comm->Send( (
void**)&buffer );
241 if ( !Master() ) comm->Recv( (
void**)&buffer );
244 template<
int ALIGN_SIZE,
typename T>
245 T *AllocateSharedMemory(
size_t count )
248 if ( Master() ) ptr = hmlp_malloc<ALIGN_SIZE, T>( count );
254 void FreeSharedMemory( T *ptr )
259 size_t BalanceOver1DGangs(
size_t n,
size_t default_size,
size_t nb );
261 tuple<size_t, size_t, size_t> DistributeOver1DGangs(
262 size_t beg,
size_t end,
size_t nb );
264 tuple<size_t, size_t, size_t> DistributeOver1DThreads(
265 size_t beg,
size_t end,
size_t nb );
281 void SetDevice(
class Device *device );
283 class Device *GetDevice();
287 bool Execute(
class Task *task );
291 float EstimateCost(
class Task* task );
295 #ifdef USE_PTHREAD_RUNTIME 301 class Task *current_task = NULL;
303 class Device *device = NULL;
Definition: thread.hpp:61
Definition: runtime.hpp:562
Definition: thread.hpp:107
This class describes devices or accelerators that require a master thread to control. A device can accept tasks from multiple workers. All received tasks are expected to be executed independently in a time-sharing fashion. Whether these tasks are executed in parallel, sequential or with some built-in context switching scheme does not matter.
Definition: device.hpp:125
void hmlp_free(T *ptr)
Free the aligned memory.
Definition: util.hpp:88
Definition: runtime.hpp:174
Definition: thread.hpp:166