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-2014 Inria
4  * Copyright (C) 2012-2015,2017 CNRS
5  * Copyright (C) 2012,2014,2016 Université de Bordeaux
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 
29 #define STARPU_SCHED_CTX_POLICY_NAME (1<<16)
30 #define STARPU_SCHED_CTX_POLICY_STRUCT (2<<16)
31 #define STARPU_SCHED_CTX_POLICY_MIN_PRIO (3<<16)
32 #define STARPU_SCHED_CTX_POLICY_MAX_PRIO (4<<16)
33 #define STARPU_SCHED_CTX_HIERARCHY_LEVEL (5<<16)
34 #define STARPU_SCHED_CTX_NESTED (6<<16)
35 #define STARPU_SCHED_CTX_AWAKE_WORKERS (7<<16)
36 
37 unsigned starpu_sched_ctx_create(int *workerids_ctx, int nworkers_ctx, const char *sched_ctx_name, ...);
38 
39 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);
40 
41 void starpu_sched_ctx_register_close_callback(unsigned sched_ctx_id, void (*close_callback)(unsigned sched_ctx_id, void* args), void *args);
42 
43 void starpu_sched_ctx_add_workers(int *workerids_ctx, int nworkers_ctx, unsigned sched_ctx_id);
44 
45 void starpu_sched_ctx_remove_workers(int *workerids_ctx, int nworkers_ctx, unsigned sched_ctx_id);
46 
47 void starpu_sched_ctx_display_workers(unsigned sched_ctx_id, FILE *f);
48 
49 void starpu_sched_ctx_delete(unsigned sched_ctx_id);
50 
51 void starpu_sched_ctx_set_inheritor(unsigned sched_ctx_id, unsigned inheritor);
52 
53 unsigned starpu_sched_ctx_get_inheritor(unsigned sched_ctx_id);
54 
55 unsigned starpu_sched_ctx_get_hierarchy_level(unsigned sched_ctx_id);
56 
57 void starpu_sched_ctx_set_context(unsigned *sched_ctx_id);
58 
59 unsigned starpu_sched_ctx_get_context(void);
60 
62 
63 void starpu_sched_ctx_finished_submit(unsigned sched_ctx_id);
64 
65 unsigned starpu_sched_ctx_get_workers_list(unsigned sched_ctx_id, int **workerids);
66 unsigned starpu_sched_ctx_get_workers_list_raw(unsigned sched_ctx_id, int **workerids);
67 
68 unsigned starpu_sched_ctx_get_nworkers(unsigned sched_ctx_id);
69 
70 unsigned starpu_sched_ctx_get_nshared_workers(unsigned sched_ctx_id, unsigned sched_ctx_id2);
71 
72 unsigned starpu_sched_ctx_contains_worker(int workerid, unsigned sched_ctx_id);
73 
74 unsigned starpu_sched_ctx_contains_type_of_worker(enum starpu_worker_archtype arch, unsigned sched_ctx_id);
75 
76 unsigned starpu_sched_ctx_worker_get_id(unsigned sched_ctx_id);
77 
78 unsigned starpu_sched_ctx_overlapping_ctxs_on_worker(int workerid);
79 
81 
83 
84 int starpu_sched_set_min_priority(int min_prio);
85 
86 int starpu_sched_set_max_priority(int max_prio);
87 
88 int starpu_sched_ctx_get_min_priority(unsigned sched_ctx_id);
89 
90 int starpu_sched_ctx_get_max_priority(unsigned sched_ctx_id);
91 
92 int starpu_sched_ctx_set_min_priority(unsigned sched_ctx_id, int min_prio);
93 
94 int starpu_sched_ctx_set_max_priority(unsigned sched_ctx_id, int max_prio);
95 
96 int starpu_sched_ctx_min_priority_is_set(unsigned sched_ctx_id);
97 
98 int starpu_sched_ctx_max_priority_is_set(unsigned sched_ctx_id);
99 
100 #define STARPU_MIN_PRIO (starpu_sched_get_min_priority())
101 #define STARPU_MAX_PRIO (starpu_sched_get_max_priority())
102 
103 #define STARPU_DEFAULT_PRIO 0
104 
106 
107 void starpu_sched_ctx_delete_worker_collection(unsigned sched_ctx_id);
108 
110 
111 void starpu_sched_ctx_set_policy_data(unsigned sched_ctx_id, void *policy_data);
112 
113 void *starpu_sched_ctx_get_policy_data(unsigned sched_ctx_id);
114 
115 void *starpu_sched_ctx_exec_parallel_code(void* (*func)(void*), void *param, unsigned sched_ctx_id);
116 
117 int starpu_sched_ctx_get_nready_tasks(unsigned sched_ctx_id);
118 
119 double starpu_sched_ctx_get_nready_flops(unsigned sched_ctx_id);
120 
121 void starpu_sched_ctx_set_priority(int *workers, int nworkers, unsigned sched_ctx_id, unsigned priority);
122 
123 void starpu_sched_ctx_set_priority_on_level(int* workers_to_add, unsigned nworkers_to_add, unsigned sched_ctx, unsigned priority);
124 
125 unsigned starpu_sched_ctx_get_priority(int worker, unsigned sched_ctx_id);
126 
127 void starpu_sched_ctx_get_available_cpuids(unsigned sched_ctx_id, int **cpuids, int *ncpuids);
128 
129 void starpu_sched_ctx_bind_current_thread_to_cpuid(unsigned cpuid);
130 
131 int starpu_sched_ctx_book_workers_for_task(unsigned sched_ctx_id, int *workerids, int nworkers);
132 
133 void starpu_sched_ctx_unbook_workers_for_task(unsigned sched_ctx_id, int master);
134 
135 /* return the first context (child of sched_ctx_id) where the workerid is master */
136 unsigned starpu_sched_ctx_worker_is_master_for_child_ctx(int workerid, unsigned sched_ctx_id);
137 
138 void starpu_sched_ctx_revert_task_counters(unsigned sched_ctx_id, double flops);
139 
140 void starpu_sched_ctx_move_task_to_ctx(struct starpu_task *task, unsigned sched_ctx);
141 
142 int starpu_sched_ctx_get_worker_rank(unsigned sched_ctx_id);
143 
144 #ifdef STARPU_USE_SC_HYPERVISOR
145 void starpu_sched_ctx_call_pushed_task_cb(int workerid, unsigned sched_ctx_id);
146 #endif /* STARPU_USE_SC_HYPERVISOR */
147 
148 #ifdef __cplusplus
149 }
150 #endif
151 
152 #endif /* __STARPU_SCHED_CTX_H__ */
void starpu_sched_ctx_set_inheritor(unsigned sched_ctx_id, unsigned inheritor)
void starpu_sched_ctx_set_context(unsigned *sched_ctx_id)
void starpu_sched_ctx_delete(unsigned sched_ctx_id)
Definition: starpu_worker.h:55
void starpu_sched_ctx_remove_workers(int *workerids_ctx, int nworkers_ctx, unsigned sched_ctx_id)
void starpu_sched_ctx_display_workers(unsigned sched_ctx_id, FILE *f)
#define STARPU_ATTRIBUTE_MALLOC
Definition: starpu_util.h:62
struct starpu_worker_collection * starpu_sched_ctx_get_worker_collection(unsigned sched_ctx_id)
void starpu_sched_ctx_stop_task_submission(void)
int starpu_sched_ctx_set_min_priority(unsigned sched_ctx_id, int min_prio)
unsigned starpu_sched_ctx_get_nshared_workers(unsigned sched_ctx_id, unsigned sched_ctx_id2)
unsigned starpu_sched_ctx_worker_get_id(unsigned sched_ctx_id)
starpu_worker_archtype
Definition: starpu_worker.h:31
int starpu_sched_ctx_max_priority_is_set(unsigned sched_ctx_id)
void * starpu_sched_ctx_exec_parallel_code(void *(*func)(void *), void *param, unsigned sched_ctx_id)
unsigned starpu_sched_ctx_get_nworkers(unsigned sched_ctx_id)
void starpu_sched_ctx_add_workers(int *workerids_ctx, int nworkers_ctx, unsigned sched_ctx_id)
unsigned starpu_sched_ctx_get_context(void)
unsigned starpu_sched_ctx_contains_worker(int workerid, unsigned sched_ctx_id)
unsigned starpu_sched_ctx_get_workers_list_raw(unsigned sched_ctx_id, int **workerids)
void starpu_sched_ctx_finished_submit(unsigned sched_ctx_id)
int starpu_sched_ctx_get_nready_tasks(unsigned sched_ctx_id)
Definition: starpu_task.h:129
int starpu_sched_ctx_get_max_priority(unsigned sched_ctx_id)
int starpu_sched_ctx_min_priority_is_set(unsigned sched_ctx_id)
unsigned starpu_sched_ctx_get_workers_list(unsigned sched_ctx_id, int **workerids)
void starpu_sched_ctx_call_pushed_task_cb(int workerid, unsigned sched_ctx_id)
unsigned starpu_sched_ctx_overlapping_ctxs_on_worker(int workerid)
void * starpu_sched_ctx_get_policy_data(unsigned sched_ctx_id)
int starpu_sched_set_max_priority(int max_prio)
int starpu_sched_ctx_set_max_priority(unsigned sched_ctx_id, int max_prio)
unsigned nworkers
Definition: starpu_worker.h:59
int starpu_sched_get_max_priority(void)
int starpu_sched_get_min_priority(void)
int * workerids
Definition: starpu_worker.h:57
unsigned starpu_sched_ctx_create(int *workerids_ctx, int nworkers_ctx, const char *sched_ctx_name,...)
double starpu_sched_ctx_get_nready_flops(unsigned sched_ctx_id)
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)
enum starpu_worker_collection_type type
Definition: starpu_worker.h:64
void starpu_sched_ctx_delete_worker_collection(unsigned sched_ctx_id)
struct starpu_worker_collection * starpu_sched_ctx_create_worker_collection(unsigned sched_ctx_id, enum starpu_worker_collection_type type) STARPU_ATTRIBUTE_MALLOC
starpu_worker_collection_type
Definition: starpu_worker.h:49
unsigned sched_ctx_id
Definition: starpu_sched_component.h:84
int starpu_sched_set_min_priority(int min_prio)
int starpu_sched_ctx_get_min_priority(unsigned sched_ctx_id)
void starpu_sched_ctx_register_close_callback(unsigned sched_ctx_id, void(*close_callback)(unsigned sched_ctx_id, void *args), void *args)
void starpu_sched_ctx_set_policy_data(unsigned sched_ctx_id, void *policy_data)