4
typedef struct HWSchedT *HWSched;
10
HW_SCHED_MODE_PREALLOCATED = 0,
11
HW_SCHED_MODE_SEQUENTIAL
13
typedef enum HWSchedModeT HWSchedMode;
16
#define HW_SINGLE_MODE
17
//#define HW_DETECT_CPU_CORES
18
#define HW_MAX_THREADS MAX_DEVICES
19
//#define HW_MAX_THREADS 128
22
typedef HWRunFunction HWEntry;
23
#else /* HW_SINGLE_MODE */
25
#endif /* HW_SINGLE_MODE */
28
#ifndef HW_HIDE_DETAILS
35
HWThread thread[HW_MAX_THREADS];
37
GCond *job_cond, *compl_cond;
38
GMutex *job_cond_mutex, *compl_cond_mutex, *data_mutex;
47
typedef struct HWSchedT HWSchedS;
48
#endif /* HW_HIDE_DETAILS */
54
HWSched hw_sched_create(int ppu_count);
55
void hw_sched_destroy(HWSched ctx);
56
int hw_sched_set_sequential_mode(HWSched ctx, int *n_blocks, int *cur_block);
57
int hw_sched_get_chunk(HWSched ctx, int thread_id);
58
int hw_sched_schedule_task(HWSched ctx, void *appctx, HWEntry entry);
59
int hw_sched_wait_task(HWSched ctx);
61
#define hw_sched_lock(ctx, type) g_mutex_lock(ctx->type##_mutex)
62
#define hw_sched_unlock(ctx, type) g_mutex_unlock(ctx->type##_mutex)
63
#define hw_sched_broadcast(ctx, type) g_cond_broadcast(ctx->type##_cond)
64
#define hw_sched_signal(ctx, type) g_cond_signal(ctx->type##_cond)
65
#define hw_sched_wait(ctx, type) g_cond_wait(ctx->type##_cond, ctx->type##_cond_mutex)
71
#endif /* _HW_SCHED_H */