StarPU Handbook

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
sc_hypervisor_monitoring.h
Go to the documentation of this file.
1 /* StarPU --- Runtime system for heterogeneous multicore architectures.
2 *
3 * Copyright (C) 2011 - 2013 INRIA
4 *
5 * StarPU is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation; either version 2.1 of the License, or (at
8 * your option) any later version.
9 *
10 * StarPU is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 *
14 * See the GNU Lesser General Public License in COPYING.LGPL for more details.
15 */
16
17 #ifndef SC_HYPERVISOR_MONITORING_H
18 #define SC_HYPERVISOR_MONITORING_H
19
20 #include <sc_hypervisor.h>
21
22 #ifdef __cplusplus
23 extern "C"
24 {
25 #endif
26
27 /* structure to indicate when the moving of workers was actually done
28 (moved workers can be seen in the new ctx ) */
29 struct sc_hypervisor_resize_ack
30 {
31 /* receiver context */
32 int receiver_sched_ctx;
33 /* list of workers required to be moved */
34 int *moved_workers;
35 /* number of workers required to be moved */
36 int nmoved_workers;
37 /* list of workers that actually got in the receiver ctx */
38 int *acked_workers;
39 };
40
41 /* wrapper attached to a sched_ctx storing monitoring information */
42 struct sc_hypervisor_wrapper
43 {
44 /* the sched_ctx it monitors */
45 unsigned sched_ctx;
46
47 /* user configuration meant to limit resizing */
48 struct sc_hypervisor_policy_config *config;
49
50
51 /* the start time of the resizing sample of the workers of this context*/
52 double start_time_w[STARPU_NMAXWORKERS];
53
54 /* idle time of workers in this context */
55 double current_idle_time[STARPU_NMAXWORKERS];
56
57 /* idle time from the last resize */
58 double idle_time[STARPU_NMAXWORKERS];
59
60 /* time when the idle started */
61 double idle_start_time[STARPU_NMAXWORKERS];
62
63 /* time during which the worker executed tasks */
64 double exec_time[STARPU_NMAXWORKERS];
65
66 /* time when the worker started executing a task */
67 double exec_start_time[STARPU_NMAXWORKERS];
68
69 /* list of workers that will leave this contexts (lazy resizing process) */
70 int worker_to_be_removed[STARPU_NMAXWORKERS];
71
72 /* number of tasks pushed on each worker in this ctx */
73 int pushed_tasks[STARPU_NMAXWORKERS];
74
75 /* number of tasks poped from each worker in this ctx */
76 int poped_tasks[STARPU_NMAXWORKERS];
77
78 /* number of flops the context has to execute */
79 double total_flops;
80
81 /* number of flops executed since the biginning until now */
82 double total_elapsed_flops[STARPU_NMAXWORKERS];
83
84 /* number of flops executed since last resizing */
85 double elapsed_flops[STARPU_NMAXWORKERS];
86
87 /* data quantity executed on each worker in this ctx */
88 size_t elapsed_data[STARPU_NMAXWORKERS];
89
90 /* nr of tasks executed on each worker in this ctx */
91 int elapsed_tasks[STARPU_NMAXWORKERS];
92
93 /* the average speed of the type of workers when they belonged to this context */
94 /* 0 - cuda 1 - cpu */
95 double ref_speed[2];
96
97 /* number of flops submitted to this ctx */
98 double submitted_flops;
99
100 /* number of flops that still have to be executed in this ctx */
101 double remaining_flops;
102
103 /* the start time of the resizing sample of this context*/
104 double start_time;
105
106 /* the first time a task was pushed to this context*/
107 double real_start_time;
108
109 /* the start time for sample in which the hyp is not allowed to react
110 bc too expensive */
111 double hyp_react_start_time;
112
113 /* the workers don't leave the current ctx until the receiver ctx
114 doesn't ack the receive of these workers */
115 struct sc_hypervisor_resize_ack resize_ack;
116
117 /* mutex to protect the ack of workers */
118 starpu_pthread_mutex_t mutex;
119
120 /* boolean indicating if the resizing strategy can see the
121 flops of all the execution or not */
122 unsigned total_flops_available;
123
124 /* boolean indicating that a context is being sized */
125 unsigned to_be_sized;
126
127 /* boolean indicating if we add the idle of this worker to
128 the idle of the context */
129 unsigned compute_idle[STARPU_NMAXWORKERS];
130 };
131
132 /* return the wrapper of context that saves its monitoring information */
133 struct sc_hypervisor_wrapper *sc_hypervisor_get_wrapper(unsigned sched_ctx);
134
135 /* get the list of registered contexts */
136 unsigned *sc_hypervisor_get_sched_ctxs();
137
138 /* get the number of registered contexts */
139 int sc_hypervisor_get_nsched_ctxs();
140
141 /* get the number of workers of a certain architecture in a context */
142 int sc_hypervisor_get_nworkers_ctx(unsigned sched_ctx, enum starpu_worker_archtype arch);
143
144 /* get the number of flops executed by a context since last resizing (reset to 0 when a resizing is done)*/
145 double sc_hypervisor_get_elapsed_flops_per_sched_ctx(struct sc_hypervisor_wrapper *sc_w);
146
147 /* get the number of flops executed by a context since the begining */
148 double sc_hypervisor_get_total_elapsed_flops_per_sched_ctx(struct sc_hypervisor_wrapper* sc_w);
149
150 /* compute an average value of the cpu/cuda speed */
151 double sc_hypervisorsc_hypervisor_get_speed_per_worker_type(struct sc_hypervisor_wrapper* sc_w, enum starpu_worker_archtype arch);
152
153 /* compte the actual speed of all workers of a specific type of worker */
154 double sc_hypervisor_get_speed(struct sc_hypervisor_wrapper *sc_w, enum starpu_worker_archtype arch);
155
156 #ifdef __cplusplus
157 }
158 #endif
159
160 #endif
sc_hypervisor_get_sched_ctxs
unsigned * sc_hypervisor_get_sched_ctxs()
sc_hypervisor_wrapper::elapsed_tasks
int elapsed_tasks[STARPU_NMAXWORKERS]
Definition: sc_hypervisor_monitoring.h:91
sc_hypervisor_wrapper
Definition: sc_hypervisor_monitoring.h:42
sc_hypervisor_resize_ack::nmoved_workers
int nmoved_workers
Definition: sc_hypervisor_monitoring.h:36
sc_hypervisor_wrapper::sched_ctx
unsigned sched_ctx
Definition: sc_hypervisor_monitoring.h:45
sc_hypervisor_wrapper::config
struct sc_hypervisor_policy_config * config
Definition: sc_hypervisor_monitoring.h:48
sc_hypervisor_wrapper::elapsed_data
size_t elapsed_data[STARPU_NMAXWORKERS]
Definition: sc_hypervisor_monitoring.h:88
sc_hypervisor_wrapper::worker_to_be_removed
int worker_to_be_removed[STARPU_NMAXWORKERS]
Definition: sc_hypervisor_monitoring.h:70
sc_hypervisor_resize_ack
Definition: sc_hypervisor_monitoring.h:29
sc_hypervisor_wrapper::pushed_tasks
int pushed_tasks[STARPU_NMAXWORKERS]
Definition: sc_hypervisor_monitoring.h:73
sc_hypervisor_wrapper::resize_ack
struct sc_hypervisor_resize_ack resize_ack
Definition: sc_hypervisor_monitoring.h:115
sc_hypervisor_wrapper::idle_time
double idle_time[STARPU_NMAXWORKERS]
Definition: sc_hypervisor_monitoring.h:58
sc_hypervisor_wrapper::start_time
double start_time
Definition: sc_hypervisor_monitoring.h:104
sc_hypervisor_wrapper::total_elapsed_flops
double total_elapsed_flops[STARPU_NMAXWORKERS]
Definition: sc_hypervisor_monitoring.h:82
starpu_worker_archtype
starpu_worker_archtype
Definition: starpu_worker.h:29
sc_hypervisor_wrapper::idle_start_time
double idle_start_time[STARPU_NMAXWORKERS]
Definition: sc_hypervisor_monitoring.h:61
sc_hypervisor_wrapper::ref_speed
double ref_speed[2]
Definition: sc_hypervisor_monitoring.h:95
sc_hypervisor_get_wrapper
struct sc_hypervisor_wrapper * sc_hypervisor_get_wrapper(unsigned sched_ctx)
sc_hypervisor_wrapper::mutex
starpu_pthread_mutex_t mutex
Definition: sc_hypervisor_monitoring.h:118
sc_hypervisor_wrapper::poped_tasks
int poped_tasks[STARPU_NMAXWORKERS]
Definition: sc_hypervisor_monitoring.h:76
sc_hypervisor_get_nsched_ctxs
int sc_hypervisor_get_nsched_ctxs()
sc_hypervisor_wrapper::real_start_time
double real_start_time
Definition: sc_hypervisor_monitoring.h:107
STARPU_NMAXWORKERS
#define STARPU_NMAXWORKERS
Definition: starpu_config.h:74
sc_hypervisor_wrapper::submitted_flops
double submitted_flops
Definition: sc_hypervisor_monitoring.h:98
sc_hypervisor_wrapper::remaining_flops
double remaining_flops
Definition: sc_hypervisor_monitoring.h:101
sc_hypervisor_get_elapsed_flops_per_sched_ctx
double sc_hypervisor_get_elapsed_flops_per_sched_ctx(struct sc_hypervisor_wrapper *sc_w)
sc_hypervisor_resize_ack::receiver_sched_ctx
int receiver_sched_ctx
Definition: sc_hypervisor_monitoring.h:32
sc_hypervisor_wrapper::total_flops_available
unsigned total_flops_available
Definition: sc_hypervisor_monitoring.h:122
sc_hypervisor_wrapper::elapsed_flops
double elapsed_flops[STARPU_NMAXWORKERS]
Definition: sc_hypervisor_monitoring.h:85
sc_hypervisor_resize_ack::moved_workers
int * moved_workers
Definition: sc_hypervisor_monitoring.h:34
sc_hypervisor_wrapper::current_idle_time
double current_idle_time[STARPU_NMAXWORKERS]
Definition: sc_hypervisor_monitoring.h:55
sc_hypervisor.h
sc_hypervisor_resize_ack::acked_workers
int * acked_workers
Definition: sc_hypervisor_monitoring.h:38
sc_hypervisor_policy_config
Definition: sc_hypervisor_config.h:47
sc_hypervisor_wrapper::total_flops
double total_flops
Definition: sc_hypervisor_monitoring.h:79