StarPU Handbook

starpu_sched_ctx.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) 2016 Uppsala University
5 * Copyright (C) 2017 Arthur Chevalier
6 *
7 * StarPU is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation; either version 2.1 of the License, or (at
10 * your option) any later version.
11 *
12 * StarPU is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 *
16 * See the GNU Lesser General Public License in COPYING.LGPL for more details.
17 */
18
19#ifndef __STARPU_SCHED_CTX_H__
20#define __STARPU_SCHED_CTX_H__
21
22#include <starpu.h>
23
24#ifdef __cplusplus
25 extern "C"
26{
27#endif
28
51#define STARPU_SCHED_CTX_POLICY_NAME (1<<16)
52
57#define STARPU_SCHED_CTX_POLICY_STRUCT (2<<16)
58
63#define STARPU_SCHED_CTX_POLICY_MIN_PRIO (3<<16)
64
69#define STARPU_SCHED_CTX_POLICY_MAX_PRIO (4<<16)
70
71#define STARPU_SCHED_CTX_HIERARCHY_LEVEL (5<<16)
72#define STARPU_SCHED_CTX_NESTED (6<<16)
73
77#define STARPU_SCHED_CTX_AWAKE_WORKERS (7<<16)
78
83#define STARPU_SCHED_CTX_POLICY_INIT (8<<16)
84
89#define STARPU_SCHED_CTX_USER_DATA (9<<16)
90
96#define STARPU_SCHED_CTX_CUDA_NSMS (10<<16)
97
102#define STARPU_SCHED_CTX_SUB_CTXS (11<<16)
103
138 unsigned starpu_sched_ctx_create(int *workerids_ctx, int nworkers_ctx, const char *sched_ctx_name, ...);
139
143 unsigned starpu_sched_ctx_create_inside_interval(const char *policy_name, const char *sched_ctx_name, int min_ncpus, int max_ncpus, int min_ngpus, int max_ngpus, unsigned allow_overlap);
144
150 void starpu_sched_ctx_register_close_callback(unsigned sched_ctx_id, void (*close_callback)(unsigned sched_ctx_id, void* args), void *args);
151
157 void starpu_sched_ctx_add_workers(int *workerids_ctx, unsigned nworkers_ctx, unsigned sched_ctx_id);
158
164 void starpu_sched_ctx_remove_workers(int *workerids_ctx, unsigned nworkers_ctx, unsigned sched_ctx_id);
165
170 void starpu_sched_ctx_display_workers(unsigned sched_ctx_id, FILE *f);
171
176 void starpu_sched_ctx_delete(unsigned sched_ctx_id);
177
183 void starpu_sched_ctx_set_inheritor(unsigned sched_ctx_id, unsigned inheritor);
184
185 unsigned starpu_sched_ctx_get_inheritor(unsigned sched_ctx_id);
186
187 unsigned starpu_sched_ctx_get_hierarchy_level(unsigned sched_ctx_id);
188
193 void starpu_sched_ctx_set_context(unsigned *sched_ctx_id);
194
200 unsigned starpu_sched_ctx_get_context(void);
201
206 void starpu_sched_ctx_stop_task_submission(void);
207
213 void starpu_sched_ctx_finished_submit(unsigned sched_ctx_id);
214
221 unsigned starpu_sched_ctx_get_workers_list(unsigned sched_ctx_id, int **workerids);
222
230 unsigned starpu_sched_ctx_get_workers_list_raw(unsigned sched_ctx_id, int **workerids);
231
237 unsigned starpu_sched_ctx_get_nworkers(unsigned sched_ctx_id);
238
242 unsigned starpu_sched_ctx_get_nshared_workers(unsigned sched_ctx_id, unsigned sched_ctx_id2);
243
247 unsigned starpu_sched_ctx_contains_worker(int workerid, unsigned sched_ctx_id);
248
249 unsigned starpu_sched_ctx_contains_type_of_worker(enum starpu_worker_archtype arch, unsigned sched_ctx_id);
250
256 unsigned starpu_sched_ctx_worker_get_id(unsigned sched_ctx_id);
257
258 unsigned starpu_sched_ctx_get_ctx_for_task(struct starpu_task *task);
259
263 unsigned starpu_sched_ctx_overlapping_ctxs_on_worker(int workerid);
264
268 void *starpu_sched_ctx_get_user_data(unsigned sched_ctx_id);
269
270 void starpu_sched_ctx_set_user_data(unsigned sched_ctx_id, void* user_data);
271
277 void starpu_sched_ctx_set_policy_data(unsigned sched_ctx_id, void *policy_data);
278
283 void *starpu_sched_ctx_get_policy_data(unsigned sched_ctx_id);
284
285 struct starpu_sched_policy *starpu_sched_ctx_get_sched_policy(unsigned sched_ctx_id);
286
291 void *starpu_sched_ctx_exec_parallel_code(void* (*func)(void*), void *param, unsigned sched_ctx_id);
292
293 int starpu_sched_ctx_get_nready_tasks(unsigned sched_ctx_id);
294
295 double starpu_sched_ctx_get_nready_flops(unsigned sched_ctx_id);
296
297 void starpu_sched_ctx_list_task_counters_increment(unsigned sched_ctx_id, int workerid);
298
299 void starpu_sched_ctx_list_task_counters_decrement(unsigned sched_ctx_id, int workerid);
300
301 void starpu_sched_ctx_list_task_counters_reset(unsigned sched_ctx_id, int workerid);
302
303 void starpu_sched_ctx_list_task_counters_increment_all_ctx_locked(struct starpu_task *task, unsigned sched_ctx_id);
304
305 void starpu_sched_ctx_list_task_counters_decrement_all_ctx_locked(struct starpu_task *task, unsigned sched_ctx_id);
306
307 void starpu_sched_ctx_list_task_counters_reset_all(struct starpu_task *task, unsigned sched_ctx_id);
308
309 void starpu_sched_ctx_set_priority(int *workers, int nworkers, unsigned sched_ctx_id, unsigned priority);
310
311 unsigned starpu_sched_ctx_get_priority(int worker, unsigned sched_ctx_id);
312
313 void starpu_sched_ctx_get_available_cpuids(unsigned sched_ctx_id, int **cpuids, int *ncpuids);
314
315 void starpu_sched_ctx_bind_current_thread_to_cpuid(unsigned cpuid);
316
317 int starpu_sched_ctx_book_workers_for_task(unsigned sched_ctx_id, int *workerids, int nworkers);
318
319 void starpu_sched_ctx_unbook_workers_for_task(unsigned sched_ctx_id, int master);
320
325 unsigned starpu_sched_ctx_worker_is_master_for_child_ctx(int workerid, unsigned sched_ctx_id);
326
331 unsigned starpu_sched_ctx_master_get_context(int masterid);
332
333 void starpu_sched_ctx_revert_task_counters_ctx_locked(unsigned sched_ctx_id, double flops);
334
335 void starpu_sched_ctx_move_task_to_ctx_locked(struct starpu_task *task, unsigned sched_ctx, unsigned with_repush);
336
337 int starpu_sched_ctx_get_worker_rank(unsigned sched_ctx_id);
338
339void (*starpu_sched_ctx_get_sched_policy_init(unsigned sched_ctx_id))(unsigned);
340
341 unsigned starpu_sched_ctx_has_starpu_scheduler(unsigned sched_ctx_id, unsigned *awake_workers);
342
343 int starpu_sched_ctx_get_stream_worker(unsigned sub_ctx);
344 int starpu_sched_ctx_get_nsms(unsigned sched_ctx);
345 void starpu_sched_ctx_get_sms_interval(int stream_workerid, int *start, int *end);
346
358 int starpu_sched_ctx_get_min_priority(unsigned sched_ctx_id);
359
364 int starpu_sched_ctx_get_max_priority(unsigned sched_ctx_id);
365
375 int starpu_sched_ctx_set_min_priority(unsigned sched_ctx_id, int min_prio);
376
385 int starpu_sched_ctx_set_max_priority(unsigned sched_ctx_id, int max_prio);
386
387 int starpu_sched_ctx_min_priority_is_set(unsigned sched_ctx_id);
388
389 int starpu_sched_ctx_max_priority_is_set(unsigned sched_ctx_id);
390
394#define STARPU_MIN_PRIO (starpu_sched_get_min_priority())
395
399#define STARPU_MAX_PRIO (starpu_sched_get_max_priority())
400
405#define STARPU_DEFAULT_PRIO 0
406
418 struct starpu_worker_collection *starpu_sched_ctx_create_worker_collection(unsigned sched_ctx_id, enum starpu_worker_collection_type type) STARPU_ATTRIBUTE_MALLOC;
419
423 void starpu_sched_ctx_delete_worker_collection(unsigned sched_ctx_id);
424
428 struct starpu_worker_collection *starpu_sched_ctx_get_worker_collection(unsigned sched_ctx_id);
429
434#ifdef __cplusplus
435}
436#endif
437
438#endif /* __STARPU_SCHED_CTX_H__ */
starpu_task
Definition: starpu_task.h:567
starpu_sched_ctx_display_workers
void starpu_sched_ctx_display_workers(unsigned sched_ctx_id, FILE *f)
starpu_sched_ctx_contains_worker
unsigned starpu_sched_ctx_contains_worker(int workerid, unsigned sched_ctx_id)
starpu_sched_ctx_delete
void starpu_sched_ctx_delete(unsigned sched_ctx_id)
starpu_sched_ctx_finished_submit
void starpu_sched_ctx_finished_submit(unsigned sched_ctx_id)
starpu_sched_ctx_get_workers_list
unsigned starpu_sched_ctx_get_workers_list(unsigned sched_ctx_id, int **workerids)
starpu_sched_ctx_get_nworkers
unsigned starpu_sched_ctx_get_nworkers(unsigned sched_ctx_id)
starpu_sched_ctx_set_max_priority
int starpu_sched_ctx_set_max_priority(unsigned sched_ctx_id, int max_prio)
starpu_sched_ctx_get_max_priority
int starpu_sched_ctx_get_max_priority(unsigned sched_ctx_id)
starpu_sched_ctx_create_inside_interval
unsigned starpu_sched_ctx_create_inside_interval(const char *policy_name, const char *sched_ctx_name, int min_ncpus, int max_ncpus, int min_ngpus, int max_ngpus, unsigned allow_overlap)
starpu_sched_ctx_set_policy_data
void starpu_sched_ctx_set_policy_data(unsigned sched_ctx_id, void *policy_data)
starpu_sched_ctx_worker_is_master_for_child_ctx
unsigned starpu_sched_ctx_worker_is_master_for_child_ctx(int workerid, unsigned sched_ctx_id)
starpu_sched_ctx_remove_workers
void starpu_sched_ctx_remove_workers(int *workerids_ctx, unsigned nworkers_ctx, unsigned sched_ctx_id)
starpu_sched_ctx_master_get_context
unsigned starpu_sched_ctx_master_get_context(int masterid)
starpu_sched_ctx_set_context
void starpu_sched_ctx_set_context(unsigned *sched_ctx_id)
starpu_sched_ctx_create
unsigned starpu_sched_ctx_create(int *workerids_ctx, int nworkers_ctx, const char *sched_ctx_name,...)
starpu_sched_ctx_delete_worker_collection
void starpu_sched_ctx_delete_worker_collection(unsigned sched_ctx_id)
starpu_sched_ctx_overlapping_ctxs_on_worker
unsigned starpu_sched_ctx_overlapping_ctxs_on_worker(int workerid)
starpu_sched_ctx_get_min_priority
int starpu_sched_ctx_get_min_priority(unsigned sched_ctx_id)
starpu_sched_ctx_set_min_priority
int starpu_sched_ctx_set_min_priority(unsigned sched_ctx_id, int min_prio)
starpu_sched_ctx_get_worker_collection
struct starpu_worker_collection * starpu_sched_ctx_get_worker_collection(unsigned sched_ctx_id)
starpu_sched_ctx_worker_get_id
unsigned starpu_sched_ctx_worker_get_id(unsigned sched_ctx_id)
starpu_sched_ctx_get_policy_data
void * starpu_sched_ctx_get_policy_data(unsigned sched_ctx_id)
starpu_sched_ctx_register_close_callback
void starpu_sched_ctx_register_close_callback(unsigned sched_ctx_id, void(*close_callback)(unsigned sched_ctx_id, void *args), void *args)
starpu_sched_ctx_add_workers
void starpu_sched_ctx_add_workers(int *workerids_ctx, unsigned nworkers_ctx, unsigned sched_ctx_id)
starpu_sched_ctx_get_user_data
void * starpu_sched_ctx_get_user_data(unsigned sched_ctx_id)
starpu_sched_ctx_set_inheritor
void starpu_sched_ctx_set_inheritor(unsigned sched_ctx_id, unsigned inheritor)
starpu_sched_ctx_get_nshared_workers
unsigned starpu_sched_ctx_get_nshared_workers(unsigned sched_ctx_id, unsigned sched_ctx_id2)
starpu_sched_ctx_get_workers_list_raw
unsigned starpu_sched_ctx_get_workers_list_raw(unsigned sched_ctx_id, int **workerids)
starpu_sched_ctx_create_worker_collection
struct starpu_worker_collection * starpu_sched_ctx_create_worker_collection(unsigned sched_ctx_id, enum starpu_worker_collection_type type) STARPU_ATTRIBUTE_MALLOC
starpu_sched_ctx_get_context
unsigned starpu_sched_ctx_get_context(void)
starpu_sched_ctx_exec_parallel_code
void * starpu_sched_ctx_exec_parallel_code(void *(*func)(void *), void *param, unsigned sched_ctx_id)
starpu_sched_ctx_stop_task_submission
void starpu_sched_ctx_stop_task_submission(void)
starpu_sched_policy
Definition: starpu_scheduler.h:83
STARPU_ATTRIBUTE_MALLOC
#define STARPU_ATTRIBUTE_MALLOC
Definition: starpu_util.h:112
starpu_worker_collection::type
enum starpu_worker_collection_type type
Definition: starpu_worker.h:125
starpu_worker_archtype
starpu_worker_archtype
Definition: starpu_worker.h:63
starpu_worker_collection_type
starpu_worker_collection_type
Definition: starpu_worker.h:92
starpu_worker_collection
Definition: starpu_worker.h:105
starpu.h