StarPU Handbook
 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 ) */
30 {
31  /* receiver context */
33  /* list of workers required to be moved */
35  /* number of workers required to be moved */
37  /* list of workers that actually got in the receiver ctx */
39 };
40 
41 /* wrapper attached to a sched_ctx storing monitoring information */
43 {
44  /* the sched_ctx it monitors */
45  unsigned sched_ctx;
46 
47  /* user configuration meant to limit resizing */
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 */
56 
57  /* idle time from the last resize */
59 
60  /* time when the idle started */
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) */
71 
72  /* number of tasks pushed on each worker in this ctx */
74 
75  /* number of tasks poped from each worker in this ctx */
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 */
83 
84  /* number of flops executed since last resizing */
86 
87  /* data quantity executed on each worker in this ctx */
89 
90  /* nr of tasks executed on each worker in this ctx */
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 */
99 
100  /* number of flops that still have to be executed in this ctx */
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*/
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 */
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 */
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 */
134 
135 /* get the list of registered contexts */
136 unsigned *sc_hypervisor_get_sched_ctxs();
137 
138 /* get the number of registered contexts */
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)*/
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