StarPU Handbook - StarPU Introduction
starpu_scheduler.h
Go to the documentation of this file.
1/* StarPU --- Runtime system for heterogeneous multicore architectures.
2 *
3 * Copyright (C) 2010-2023 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
26extern "C" {
27#endif
28
39struct starpu_task;
40
82{
87 void (*init_sched)(unsigned sched_ctx_id);
91 void (*deinit_sched)(unsigned sched_ctx_id);
92
101 int (*push_task)(struct starpu_task *);
102
103 double (*simulate_push_task)(struct starpu_task *);
104
117 void (*push_task_notify)(struct starpu_task *, int workerid, int perf_workerid, unsigned sched_ctx_id);
118
139 struct starpu_task *(*pop_task)(unsigned sched_ctx_id);
140
145 void (*submit_hook)(struct starpu_task *task);
146
151 void (*pre_exec_hook)(struct starpu_task *, unsigned sched_ctx_id);
152
157 void (*post_exec_hook)(struct starpu_task *, unsigned sched_ctx_id);
158
165 void (*do_schedule)(unsigned sched_ctx_id);
166
171 void (*add_workers)(unsigned sched_ctx_id, int *workerids, unsigned nworkers);
172
177 void (*remove_workers)(unsigned sched_ctx_id, int *workerids, unsigned nworkers);
178
183
187 const char *policy_name;
188
193
194 enum starpu_worker_collection_type worker_type;
195};
196
202
209
216
221
226
236void starpu_worker_get_sched_condition(int workerid, starpu_pthread_mutex_t **sched_mutex, starpu_pthread_cond_t **sched_cond);
237
238unsigned long starpu_task_get_job_id(struct starpu_task *task);
239
246
253
265
276
282int starpu_worker_can_execute_task(unsigned workerid, struct starpu_task *task, unsigned nimpl);
283
294int starpu_worker_can_execute_task_impl(unsigned workerid, struct starpu_task *task, unsigned *impl_mask);
295
306int starpu_worker_can_execute_task_first_impl(unsigned workerid, struct starpu_task *task, unsigned *nimpl);
307
315int starpu_push_local_task(int workerid, struct starpu_task *task, int back);
316
322
328
333int starpu_prefetch_task_input_on_node_prio(struct starpu_task *task, unsigned node, int prio);
334
338int starpu_prefetch_task_input_on_node(struct starpu_task *task, unsigned node);
339
344int starpu_idle_prefetch_task_input_on_node_prio(struct starpu_task *task, unsigned node, int prio);
345
351
357int starpu_prefetch_task_input_for_prio(struct starpu_task *task, unsigned worker, int prio);
358
363int starpu_prefetch_task_input_for(struct starpu_task *task, unsigned worker);
364
370int starpu_idle_prefetch_task_input_for_prio(struct starpu_task *task, unsigned worker, int prio);
371
377int starpu_idle_prefetch_task_input_for(struct starpu_task *task, unsigned worker);
378
384uint32_t starpu_task_footprint(struct starpu_perfmodel *model, struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl);
385
392
397double starpu_task_expected_length(struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl);
398
403double starpu_task_worker_expected_length(struct starpu_task *task, unsigned workerid, unsigned sched_ctx_id, unsigned nimpl);
404
412double starpu_task_expected_length_average(struct starpu_task *task, unsigned sched_ctx_id);
413
418
424double starpu_task_expected_data_transfer_time(unsigned memory_node, struct starpu_task *task);
425
431double starpu_task_expected_data_transfer_time_for(struct starpu_task *task, unsigned worker);
432
438
443double starpu_task_expected_energy(struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl);
444
448double starpu_task_worker_expected_energy(struct starpu_task *task, unsigned workerid, unsigned sched_ctx_id, unsigned nimpl);
449
457double starpu_task_expected_energy_average(struct starpu_task *task, unsigned sched_ctx_id);
458
462double starpu_task_expected_conversion_time(struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl);
463
464typedef void (*starpu_notify_ready_soon_func)(void *data, struct starpu_task *task, double delay);
465
471void starpu_task_notify_ready_soon_register(starpu_notify_ready_soon_func f, void *data);
472
479
489
503
510
516
524
529#ifdef __cplusplus
530}
531#endif
532
533#endif /* __STARPU_SCHEDULER_H__ */
unsigned workerid
Definition: starpu_task.h:1186
uint32_t * workerids
Definition: starpu_task.h:1216
Definition: starpu_task.h:662
starpu_data_access_mode
Definition: starpu_data.h:55
struct _starpu_data_state * starpu_data_handle_t
Definition: starpu_data.h:44
Definition: starpu_perfmodel.h:186
Definition: starpu_perfmodel.h:51
int prefetches
Definition: starpu_scheduler.h:182
void(* push_task_notify)(struct starpu_task *, int workerid, int perf_workerid, unsigned sched_ctx_id)
Definition: starpu_scheduler.h:117
void(* submit_hook)(struct starpu_task *task)
Definition: starpu_scheduler.h:145
const char * policy_description
Definition: starpu_scheduler.h:192
void(* add_workers)(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
Definition: starpu_scheduler.h:171
void(* deinit_sched)(unsigned sched_ctx_id)
Definition: starpu_scheduler.h:91
int(* push_task)(struct starpu_task *)
Definition: starpu_scheduler.h:101
void(* pre_exec_hook)(struct starpu_task *, unsigned sched_ctx_id)
Definition: starpu_scheduler.h:151
const char * policy_name
Definition: starpu_scheduler.h:187
void(* remove_workers)(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
Definition: starpu_scheduler.h:177
void(* init_sched)(unsigned sched_ctx_id)
Definition: starpu_scheduler.h:87
void(* do_schedule)(unsigned sched_ctx_id)
Definition: starpu_scheduler.h:165
void(* post_exec_hook)(struct starpu_task *, unsigned sched_ctx_id)
Definition: starpu_scheduler.h:157
double starpu_data_expected_transfer_time(starpu_data_handle_t handle, unsigned memory_node, enum starpu_data_access_mode mode)
int starpu_idle_prefetch_task_input_on_node(struct starpu_task *task, unsigned node)
uint32_t starpu_task_footprint(struct starpu_perfmodel *model, struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl)
int starpu_push_task_end(struct starpu_task *task)
struct starpu_sched_policy * starpu_sched_get_sched_policy_in_ctx(unsigned sched_ctx_id)
int starpu_worker_can_execute_task(unsigned workerid, struct starpu_task *task, unsigned nimpl)
double starpu_task_expected_length(struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl)
void starpu_sched_ctx_worker_shares_tasks_lists(int workerid, int sched_ctx_id)
double starpu_task_expected_data_transfer_time_for(struct starpu_task *task, unsigned worker)
int starpu_wake_worker_relax(int workerid)
double starpu_task_expected_length_average(struct starpu_task *task, unsigned sched_ctx_id)
struct starpu_sched_policy ** starpu_get_sched_lib_policies(void)
void starpu_sched_task_break(struct starpu_task *task)
int starpu_prefetch_task_input_on_node(struct starpu_task *task, unsigned node)
int starpu_idle_prefetch_task_input_for(struct starpu_task *task, unsigned worker)
double starpu_task_expected_energy(struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl)
int starpu_worker_can_execute_task_impl(unsigned workerid, struct starpu_task *task, unsigned *impl_mask)
int starpu_prefetch_task_input_on_node_prio(struct starpu_task *task, unsigned node, int prio)
double starpu_task_expected_data_transfer_time(unsigned memory_node, struct starpu_task *task)
double starpu_task_expected_conversion_time(struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl)
int starpu_sched_get_max_priority(void)
int starpu_idle_prefetch_task_input_on_node_prio(struct starpu_task *task, unsigned node, int prio)
int starpu_sched_get_min_priority(void)
int starpu_worker_can_execute_task_first_impl(unsigned workerid, struct starpu_task *task, unsigned *nimpl)
int starpu_idle_prefetch_task_input_for_prio(struct starpu_task *task, unsigned worker, int prio)
int starpu_wake_worker_locked(int workerid)
int starpu_prefetch_task_input_for(struct starpu_task *task, unsigned worker)
double starpu_worker_get_relative_speedup(struct starpu_perfmodel_arch *perf_arch)
int starpu_wake_worker_relax_light(int workerid)
void starpu_task_notify_ready_soon_register(starpu_notify_ready_soon_func f, void *data)
int starpu_wake_worker_no_relax(int workerid)
int starpu_get_prefetch_flag(void)
double starpu_task_worker_expected_length(struct starpu_task *task, unsigned workerid, unsigned sched_ctx_id, unsigned nimpl)
struct starpu_sched_policy * starpu_sched_get_sched_policy(void)
uint32_t starpu_task_data_footprint(struct starpu_task *task)
double starpu_task_worker_expected_energy(struct starpu_task *task, unsigned workerid, unsigned sched_ctx_id, unsigned nimpl)
struct starpu_sched_policy * starpu_get_sched_lib_policy(const char *name)
int starpu_sched_set_max_priority(int max_prio)
int starpu_sched_set_min_priority(int min_prio)
double starpu_task_expected_energy_average(struct starpu_task *task, unsigned sched_ctx_id)
void starpu_worker_get_sched_condition(int workerid, starpu_pthread_mutex_t **sched_mutex, starpu_pthread_cond_t **sched_cond)
int starpu_prefetch_task_input_for_prio(struct starpu_task *task, unsigned worker, int prio)
int starpu_push_local_task(int workerid, struct starpu_task *task, int back)
struct starpu_sched_policy ** starpu_sched_get_predefined_policies(void)
Definition: starpu_scheduler.h:82
starpu_worker_collection_type
Definition: starpu_worker.h:100