StarPU Handbook

starpu_scheduler.h
Go to the documentation of this file.
1/* StarPU --- Runtime system for heterogeneous multicore architectures.
2 *
3 * Copyright (C) 2010-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
4 * Copyright (C) 2011 Télécom-SudParis
5 * Copyright (C) 2013 Thibaut Lambert
6 * Copyright (C) 2016 Uppsala University
7 *
8 * StarPU is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or (at
11 * your option) any later version.
12 *
13 * StarPU is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 *
17 * See the GNU Lesser General Public License in COPYING.LGPL for more details.
18 */
19
20#ifndef __STARPU_SCHEDULER_H__
21#define __STARPU_SCHEDULER_H__
22
23#include <starpu.h>
24
25#ifdef __cplusplus
26 extern "C"
27{
28#endif
29
40 struct starpu_task;
41
82 struct starpu_sched_policy
83{
88 void (*init_sched)(unsigned sched_ctx_id);
92 void (*deinit_sched)(unsigned sched_ctx_id);
93
102 int (*push_task)(struct starpu_task *);
103
104 double (*simulate_push_task)(struct starpu_task *);
105
114 void (*push_task_notify)(struct starpu_task *, int workerid, int perf_workerid, unsigned sched_ctx_id);
115
136 struct starpu_task *(*pop_task)(unsigned sched_ctx_id);
137
145 struct starpu_task *(*pop_every_task)(unsigned sched_ctx_id);
146
151 void (*submit_hook)(struct starpu_task *task);
152
157 void (*pre_exec_hook)(struct starpu_task *, unsigned sched_ctx_id);
158
163 void (*post_exec_hook)(struct starpu_task *, unsigned sched_ctx_id);
164
171 void (*do_schedule)(unsigned sched_ctx_id);
172
177 void (*add_workers)(unsigned sched_ctx_id, int *workerids, unsigned nworkers);
178
183 void (*remove_workers)(unsigned sched_ctx_id, int *workerids, unsigned nworkers);
184
188 const char *policy_name;
189
193 const char *policy_description;
194
195 enum starpu_worker_collection_type worker_type;
196};
197
202 struct starpu_sched_policy **starpu_sched_get_predefined_policies();
203
213 void starpu_worker_get_sched_condition(int workerid, starpu_pthread_mutex_t **sched_mutex, starpu_pthread_cond_t **sched_cond);
214
215 unsigned long starpu_task_get_job_id(struct starpu_task *task);
216
222 int starpu_sched_get_min_priority(void);
223
229 int starpu_sched_get_max_priority(void);
230
241 int starpu_sched_set_min_priority(int min_prio);
242
252 int starpu_sched_set_max_priority(int max_prio);
253
259 int starpu_worker_can_execute_task(unsigned workerid, struct starpu_task *task, unsigned nimpl);
260
271 int starpu_worker_can_execute_task_impl(unsigned workerid, struct starpu_task *task, unsigned *impl_mask);
272
283 int starpu_worker_can_execute_task_first_impl(unsigned workerid, struct starpu_task *task, unsigned *nimpl);
284
292 int starpu_push_local_task(int workerid, struct starpu_task *task, int back);
293
298 int starpu_push_task_end(struct starpu_task *task);
299
303 int starpu_get_prefetch_flag(void);
304
309 int starpu_prefetch_task_input_on_node_prio(struct starpu_task *task, unsigned node, int prio);
310
314 int starpu_prefetch_task_input_on_node(struct starpu_task *task, unsigned node);
315
320 int starpu_idle_prefetch_task_input_on_node_prio(struct starpu_task *task, unsigned node, int prio);
321
326 int starpu_idle_prefetch_task_input_on_node(struct starpu_task *task, unsigned node);
327
332 int starpu_prefetch_task_input_for_prio(struct starpu_task *task, unsigned worker, int prio);
333
337 int starpu_prefetch_task_input_for(struct starpu_task *task, unsigned worker);
338
343 int starpu_idle_prefetch_task_input_for_prio(struct starpu_task *task, unsigned worker, int prio);
344
349 int starpu_idle_prefetch_task_input_for(struct starpu_task *task, unsigned worker);
350
355uint32_t starpu_task_footprint(struct starpu_perfmodel *model, struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl);
356
361uint32_t starpu_task_data_footprint(struct starpu_task *task);
362
366 double starpu_task_expected_length(struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl);
367
371 double starpu_worker_get_relative_speedup(struct starpu_perfmodel_arch *perf_arch);
372
378 double starpu_task_expected_data_transfer_time(unsigned memory_node, struct starpu_task *task);
379
384 double starpu_task_expected_data_transfer_time_for(struct starpu_task *task, unsigned worker);
385
390 double starpu_data_expected_transfer_time(starpu_data_handle_t handle, unsigned memory_node, enum starpu_data_access_mode mode);
391
395 double starpu_task_expected_energy(struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl);
396
400 double starpu_task_expected_conversion_time(struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl);
401
402 typedef void (*starpu_notify_ready_soon_func)(void *data, struct starpu_task *task, double delay);
403
409 void starpu_task_notify_ready_soon_register(starpu_notify_ready_soon_func f, void *data);
410
416 void starpu_sched_ctx_worker_shares_tasks_lists(int workerid, int sched_ctx_id);
417
418 void starpu_sched_task_break(struct starpu_task *task);
419
432 int starpu_wake_worker_relax(int workerid);
433
439 int starpu_wake_worker_no_relax(int workerid);
440
445 int starpu_wake_worker_locked(int workerid);
446
452 int starpu_wake_worker_relax_light(int workerid);
453
458#ifdef __cplusplus
459}
460#endif
461
462#endif /* __STARPU_SCHEDULER_H__ */
starpu_task::workerid
unsigned workerid
Definition: starpu_task.h:999
starpu_task::workerids
uint32_t * workerids
Definition: starpu_task.h:1029
starpu_task
Definition: starpu_task.h:567
starpu_data_access_mode
starpu_data_access_mode
Definition: starpu_data.h:55
starpu_data_handle_t
struct _starpu_data_state * starpu_data_handle_t
Definition: starpu_data.h:44
starpu_perfmodel
Definition: starpu_perfmodel.h:189
starpu_perfmodel_arch
Definition: starpu_perfmodel.h:54
starpu_sched_policy::push_task_notify
void(* push_task_notify)(struct starpu_task *, int workerid, int perf_workerid, unsigned sched_ctx_id)
Definition: starpu_scheduler.h:114
starpu_sched_policy::submit_hook
void(* submit_hook)(struct starpu_task *task)
Definition: starpu_scheduler.h:151
starpu_sched_policy::policy_description
const char * policy_description
Definition: starpu_scheduler.h:193
starpu_sched_policy::add_workers
void(* add_workers)(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
Definition: starpu_scheduler.h:177
starpu_sched_policy::deinit_sched
void(* deinit_sched)(unsigned sched_ctx_id)
Definition: starpu_scheduler.h:92
starpu_sched_policy::push_task
int(* push_task)(struct starpu_task *)
Definition: starpu_scheduler.h:102
starpu_sched_policy::pre_exec_hook
void(* pre_exec_hook)(struct starpu_task *, unsigned sched_ctx_id)
Definition: starpu_scheduler.h:157
starpu_sched_policy::policy_name
const char * policy_name
Definition: starpu_scheduler.h:188
starpu_sched_policy::remove_workers
void(* remove_workers)(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
Definition: starpu_scheduler.h:183
starpu_sched_policy::init_sched
void(* init_sched)(unsigned sched_ctx_id)
Definition: starpu_scheduler.h:88
starpu_sched_policy::do_schedule
void(* do_schedule)(unsigned sched_ctx_id)
Definition: starpu_scheduler.h:171
starpu_sched_policy::post_exec_hook
void(* post_exec_hook)(struct starpu_task *, unsigned sched_ctx_id)
Definition: starpu_scheduler.h:163
starpu_data_expected_transfer_time
double starpu_data_expected_transfer_time(starpu_data_handle_t handle, unsigned memory_node, enum starpu_data_access_mode mode)
starpu_idle_prefetch_task_input_on_node
int starpu_idle_prefetch_task_input_on_node(struct starpu_task *task, unsigned node)
starpu_task_footprint
uint32_t starpu_task_footprint(struct starpu_perfmodel *model, struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl)
starpu_push_task_end
int starpu_push_task_end(struct starpu_task *task)
starpu_worker_can_execute_task
int starpu_worker_can_execute_task(unsigned workerid, struct starpu_task *task, unsigned nimpl)
starpu_task_expected_length
double starpu_task_expected_length(struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl)
starpu_sched_ctx_worker_shares_tasks_lists
void starpu_sched_ctx_worker_shares_tasks_lists(int workerid, int sched_ctx_id)
starpu_task_expected_data_transfer_time_for
double starpu_task_expected_data_transfer_time_for(struct starpu_task *task, unsigned worker)
starpu_wake_worker_relax
int starpu_wake_worker_relax(int workerid)
starpu_prefetch_task_input_on_node
int starpu_prefetch_task_input_on_node(struct starpu_task *task, unsigned node)
starpu_idle_prefetch_task_input_for
int starpu_idle_prefetch_task_input_for(struct starpu_task *task, unsigned worker)
starpu_task_expected_energy
double starpu_task_expected_energy(struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl)
starpu_worker_can_execute_task_impl
int starpu_worker_can_execute_task_impl(unsigned workerid, struct starpu_task *task, unsigned *impl_mask)
starpu_prefetch_task_input_on_node_prio
int starpu_prefetch_task_input_on_node_prio(struct starpu_task *task, unsigned node, int prio)
starpu_task_expected_data_transfer_time
double starpu_task_expected_data_transfer_time(unsigned memory_node, struct starpu_task *task)
starpu_task_expected_conversion_time
double starpu_task_expected_conversion_time(struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl)
starpu_sched_get_max_priority
int starpu_sched_get_max_priority(void)
starpu_idle_prefetch_task_input_on_node_prio
int starpu_idle_prefetch_task_input_on_node_prio(struct starpu_task *task, unsigned node, int prio)
starpu_sched_get_min_priority
int starpu_sched_get_min_priority(void)
starpu_worker_can_execute_task_first_impl
int starpu_worker_can_execute_task_first_impl(unsigned workerid, struct starpu_task *task, unsigned *nimpl)
starpu_idle_prefetch_task_input_for_prio
int starpu_idle_prefetch_task_input_for_prio(struct starpu_task *task, unsigned worker, int prio)
starpu_wake_worker_locked
int starpu_wake_worker_locked(int workerid)
starpu_prefetch_task_input_for
int starpu_prefetch_task_input_for(struct starpu_task *task, unsigned worker)
starpu_worker_get_relative_speedup
double starpu_worker_get_relative_speedup(struct starpu_perfmodel_arch *perf_arch)
starpu_wake_worker_relax_light
int starpu_wake_worker_relax_light(int workerid)
starpu_task_notify_ready_soon_register
void starpu_task_notify_ready_soon_register(starpu_notify_ready_soon_func f, void *data)
starpu_wake_worker_no_relax
int starpu_wake_worker_no_relax(int workerid)
starpu_get_prefetch_flag
int starpu_get_prefetch_flag(void)
starpu_task_data_footprint
uint32_t starpu_task_data_footprint(struct starpu_task *task)
starpu_sched_set_max_priority
int starpu_sched_set_max_priority(int max_prio)
starpu_sched_get_predefined_policies
struct starpu_sched_policy ** starpu_sched_get_predefined_policies()
starpu_sched_set_min_priority
int starpu_sched_set_min_priority(int min_prio)
starpu_worker_get_sched_condition
void starpu_worker_get_sched_condition(int workerid, starpu_pthread_mutex_t **sched_mutex, starpu_pthread_cond_t **sched_cond)
starpu_prefetch_task_input_for_prio
int starpu_prefetch_task_input_for_prio(struct starpu_task *task, unsigned worker, int prio)
starpu_push_local_task
int starpu_push_local_task(int workerid, struct starpu_task *task, int back)
starpu_sched_policy
Definition: starpu_scheduler.h:83
starpu_worker_collection_type
starpu_worker_collection_type
Definition: starpu_worker.h:92
starpu.h