StarPU Handbook
starpu_scheduler.h
Go to the documentation of this file.
1 /* StarPU --- Runtime system for heterogeneous multicore architectures.
2  *
3  * Copyright (C) 2011-2013,2015-2017 Inria
4  * Copyright (C) 2010-2018 Université de Bordeaux
5  * Copyright (C) 2011-2013,2015,2017,2019 CNRS
6  * Copyright (C) 2013 Thibaut Lambert
7  * Copyright (C) 2011 Télécom-SudParis
8  * Copyright (C) 2016 Uppsala University
9  *
10  * StarPU is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation; either version 2.1 of the License, or (at
13  * your option) any later version.
14  *
15  * StarPU is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18  *
19  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
20  */
21 
22 #ifndef __STARPU_SCHEDULER_H__
23 #define __STARPU_SCHEDULER_H__
24 
25 #include <starpu.h>
26 
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31 
42 struct starpu_task;
43 
85 {
90  void (*init_sched)(unsigned sched_ctx_id);
94  void (*deinit_sched)(unsigned sched_ctx_id);
95 
104  int (*push_task)(struct starpu_task *);
105 
106  double (*simulate_push_task)(struct starpu_task *);
107 
116  void (*push_task_notify)(struct starpu_task *, int workerid, int perf_workerid, unsigned sched_ctx_id);
117 
138  struct starpu_task *(*pop_task)(unsigned sched_ctx_id);
139 
147  struct starpu_task *(*pop_every_task)(unsigned sched_ctx_id);
148 
153  void (*submit_hook)(struct starpu_task *task);
154 
159  void (*pre_exec_hook)(struct starpu_task *, unsigned sched_ctx_id);
160 
165  void (*post_exec_hook)(struct starpu_task *, unsigned sched_ctx_id);
166 
173  void (*do_schedule)(unsigned sched_ctx_id);
174 
179  void (*add_workers)(unsigned sched_ctx_id, int *workerids, unsigned nworkers);
180 
185  void (*remove_workers)(unsigned sched_ctx_id, int *workerids, unsigned nworkers);
186 
190  const char *policy_name;
191 
195  const char *policy_description;
196 
197  enum starpu_worker_collection_type worker_type;
198 };
199 
205 
215 void starpu_worker_get_sched_condition(int workerid, starpu_pthread_mutex_t **sched_mutex, starpu_pthread_cond_t **sched_cond);
216 
217 unsigned long starpu_task_get_job_id(struct starpu_task *task);
218 
225 
232 
243 int starpu_sched_set_min_priority(int min_prio);
244 
254 int starpu_sched_set_max_priority(int max_prio);
255 
261 int starpu_worker_can_execute_task(unsigned workerid, struct starpu_task *task, unsigned nimpl);
262 
273 int starpu_worker_can_execute_task_impl(unsigned workerid, struct starpu_task *task, unsigned *impl_mask);
274 
285 int starpu_worker_can_execute_task_first_impl(unsigned workerid, struct starpu_task *task, unsigned *nimpl);
286 
294 int starpu_push_local_task(int workerid, struct starpu_task *task, int back);
295 
300 int starpu_push_task_end(struct starpu_task *task);
301 
305 int starpu_get_prefetch_flag(void);
306 
311 int starpu_prefetch_task_input_on_node_prio(struct starpu_task *task, unsigned node, int prio);
312 
316 int starpu_prefetch_task_input_on_node(struct starpu_task *task, unsigned node);
317 
322 int starpu_idle_prefetch_task_input_on_node_prio(struct starpu_task *task, unsigned node, int prio);
323 
328 int starpu_idle_prefetch_task_input_on_node(struct starpu_task *task, unsigned node);
329 
334 int starpu_prefetch_task_input_for_prio(struct starpu_task *task, unsigned worker, int prio);
335 
339 int starpu_prefetch_task_input_for(struct starpu_task *task, unsigned worker);
340 
345 int starpu_idle_prefetch_task_input_for_prio(struct starpu_task *task, unsigned worker, int prio);
346 
351 int starpu_idle_prefetch_task_input_for(struct starpu_task *task, unsigned worker);
352 
357 uint32_t starpu_task_footprint(struct starpu_perfmodel *model, struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl);
358 
363 uint32_t starpu_task_data_footprint(struct starpu_task *task);
364 
368 double starpu_task_expected_length(struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl);
369 
374 
380 double starpu_task_expected_data_transfer_time(unsigned memory_node, struct starpu_task *task);
381 
386 double starpu_task_expected_data_transfer_time_for(struct starpu_task *task, unsigned worker);
387 
392 double starpu_data_expected_transfer_time(starpu_data_handle_t handle, unsigned memory_node, enum starpu_data_access_mode mode);
393 
397 double starpu_task_expected_energy(struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl);
398 
402 double starpu_task_expected_conversion_time(struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl);
403 
404 typedef void (*starpu_notify_ready_soon_func)(void *data, struct starpu_task *task, double delay);
405 
411 void starpu_task_notify_ready_soon_register(starpu_notify_ready_soon_func f, void *data);
412 
418 void starpu_sched_ctx_worker_shares_tasks_lists(int workerid, int sched_ctx_id);
419 
420 void starpu_sched_task_break(struct starpu_task *task);
421 
435 
442 
448 
455 
460 #ifdef __cplusplus
461 }
462 #endif
463 
464 #endif /* __STARPU_SCHEDULER_H__ */
double starpu_task_expected_data_transfer_time(unsigned memory_node, struct starpu_task *task)
int starpu_prefetch_task_input_for(struct starpu_task *task, unsigned worker)
void(* post_exec_hook)(struct starpu_task *, unsigned sched_ctx_id)
Definition: starpu_scheduler.h:165
uint32_t starpu_task_data_footprint(struct starpu_task *task)
void(* init_sched)(unsigned sched_ctx_id)
Definition: starpu_scheduler.h:90
uint32_t * workerids
Definition: starpu_task.h:984
struct starpu_sched_policy ** starpu_sched_get_predefined_policies()
int starpu_idle_prefetch_task_input_for_prio(struct starpu_task *task, unsigned worker, int prio)
int starpu_idle_prefetch_task_input_for(struct starpu_task *task, unsigned worker)
void(* add_workers)(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
Definition: starpu_scheduler.h:179
int starpu_push_local_task(int workerid, struct starpu_task *task, int back)
void starpu_worker_get_sched_condition(int workerid, starpu_pthread_mutex_t **sched_mutex, starpu_pthread_cond_t **sched_cond)
void(* remove_workers)(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
Definition: starpu_scheduler.h:185
unsigned workerid
Definition: starpu_task.h:954
int starpu_get_prefetch_flag(void)
double starpu_worker_get_relative_speedup(struct starpu_perfmodel_arch *perf_arch)
int starpu_wake_worker_locked(int workerid)
const char * policy_description
Definition: starpu_scheduler.h:195
double starpu_task_expected_length(struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl)
int starpu_worker_can_execute_task_first_impl(unsigned workerid, struct starpu_task *task, unsigned *nimpl)
double starpu_task_expected_energy(struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl)
int starpu_prefetch_task_input_on_node_prio(struct starpu_task *task, unsigned node, int prio)
int starpu_wake_worker_relax_light(int workerid)
int starpu_prefetch_task_input_for_prio(struct starpu_task *task, unsigned worker, int prio)
Definition: starpu_task.h:548
Definition: starpu_perfmodel.h:55
void starpu_task_notify_ready_soon_register(starpu_notify_ready_soon_func f, void *data)
int(* push_task)(struct starpu_task *)
Definition: starpu_scheduler.h:104
void(* submit_hook)(struct starpu_task *task)
Definition: starpu_scheduler.h:153
int starpu_sched_set_max_priority(int max_prio)
double starpu_data_expected_transfer_time(starpu_data_handle_t handle, unsigned memory_node, enum starpu_data_access_mode mode)
struct _starpu_data_state * starpu_data_handle_t
Definition: starpu_data.h:46
int starpu_wake_worker_no_relax(int workerid)
int starpu_worker_can_execute_task(unsigned workerid, struct starpu_task *task, unsigned nimpl)
double starpu_task_expected_conversion_time(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)
int starpu_idle_prefetch_task_input_on_node_prio(struct starpu_task *task, unsigned node, int prio)
int starpu_sched_get_max_priority(void)
int starpu_sched_get_min_priority(void)
Definition: starpu_perfmodel.h:190
int starpu_idle_prefetch_task_input_on_node(struct starpu_task *task, unsigned node)
Definition: starpu_scheduler.h:84
int starpu_prefetch_task_input_on_node(struct starpu_task *task, unsigned node)
int starpu_wake_worker_relax(int workerid)
void(* do_schedule)(unsigned sched_ctx_id)
Definition: starpu_scheduler.h:173
double starpu_task_expected_data_transfer_time_for(struct starpu_task *task, unsigned worker)
starpu_data_access_mode
Definition: starpu_data.h:56
void(* deinit_sched)(unsigned sched_ctx_id)
Definition: starpu_scheduler.h:94
starpu_worker_collection_type
Definition: starpu_worker.h:90
const char * policy_name
Definition: starpu_scheduler.h:190
void(* push_task_notify)(struct starpu_task *, int workerid, int perf_workerid, unsigned sched_ctx_id)
Definition: starpu_scheduler.h:116
int starpu_push_task_end(struct starpu_task *task)
void(* pre_exec_hook)(struct starpu_task *, unsigned sched_ctx_id)
Definition: starpu_scheduler.h:159
int starpu_sched_set_min_priority(int min_prio)
uint32_t starpu_task_footprint(struct starpu_perfmodel *model, 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)