StarPU Handbook - StarPU Performances
Loading...
Searching...
No Matches
starpu_profiling.h
Go to the documentation of this file.
1/* StarPU --- Runtime system for heterogeneous multicore architectures.
2 *
3 * Copyright (C) 2010-2023 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
4 * Copyright (C) 2020 Federal University of Rio Grande do Sul (UFRGS)
5 *
6 * StarPU is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or (at
9 * your option) any later version.
10 *
11 * StarPU is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 *
15 * See the GNU Lesser General Public License in COPYING.LGPL for more details.
16 */
17
18#ifndef __STARPU_PROFILING_H__
19#define __STARPU_PROFILING_H__
20
21#include <starpu.h>
22#include <errno.h>
23#include <time.h>
24
25#include <starpu_config.h>
26
27#ifdef STARPU_PAPI
28#include <papi.h>
29#endif
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
43#define STARPU_PROFILING_DISABLE 0
47#define STARPU_PROFILING_ENABLE 1
48
54{
56 struct timespec submit_time;
57
59 struct timespec push_start_time;
61 struct timespec push_end_time;
63 struct timespec pop_start_time;
65 struct timespec pop_end_time;
66
68 struct timespec acquire_data_start_time;
70 struct timespec acquire_data_end_time;
71
73 struct timespec start_time;
75 struct timespec end_time;
76
78 struct timespec release_data_start_time;
80 struct timespec release_data_end_time;
81
83 struct timespec callback_start_time;
85 struct timespec callback_end_time;
86
87 /* TODO add expected length, expected start/end ? */
88
91
93 uint64_t used_cycles;
95 uint64_t stall_cycles;
98
99#ifdef STARPU_PAPI
101 long long int papi_values[PAPI_MAX_HWCTRS];
102 int papi_event_set;
103#endif
104};
105
117{
119 struct timespec start_time;
121 struct timespec total_time;
122
124 struct timespec executing_time;
127 struct timespec callback_time;
131 struct timespec waiting_time;
135 struct timespec sleeping_time;
139 struct timespec scheduling_time;
140
143 struct timespec all_executing_time;
146 struct timespec all_callback_time;
149 struct timespec all_waiting_time;
152 struct timespec all_sleeping_time;
155 struct timespec all_scheduling_time;
156
159
161 uint64_t used_cycles;
163 uint64_t stall_cycles;
166
167 /* TODO: add wasted time due to failed tasks */
168
169 double flops;
170};
171
176{
178 struct timespec start_time;
180 struct timespec total_time;
182 int long long transferred_bytes;
185};
186
193
198void starpu_profiling_set_id(int new_id);
199
212
219
220#ifdef BUILDING_STARPU
221#include <common/utils.h>
222#ifdef __GNUC__
223extern int _starpu_profiling;
224#define starpu_profiling_status_get() ( \
225 { \
226 int __ret; \
227 ANNOTATE_HAPPENS_AFTER(&_starpu_profiling); \
228 __ret = _starpu_profiling; \
229 ANNOTATE_HAPPENS_BEFORE(&_starpu_profiling); \
230 __ret; \
231 })
232#endif
233#endif
234
244
250
255int starpu_bus_get_id(int src, int dst);
256
261int starpu_bus_get_src(int busid);
262
267int starpu_bus_get_dst(int busid);
271void starpu_bus_set_direct(int busid, int direct);
279void starpu_bus_set_ngpus(int busid, int ngpus);
283int starpu_bus_get_ngpus(int busid);
284
291
292/* Some helper functions to manipulate profiling API output */
293/* Reset timespec */
294static __starpu_inline void starpu_timespec_clear(struct timespec *tsp)
295{
296 tsp->tv_sec = 0;
297 tsp->tv_nsec = 0;
298}
299
300#define STARPU_NS_PER_S 1000000000
301
302/* Computes result = a + b */
303static __starpu_inline void starpu_timespec_add(struct timespec *a,
304 struct timespec *b,
305 struct timespec *result)
306{
307 result->tv_sec = a->tv_sec + b->tv_sec;
308 result->tv_nsec = a->tv_nsec + b->tv_nsec;
309
310 if (result->tv_nsec >= STARPU_NS_PER_S)
311 {
312 ++(result)->tv_sec;
313 result->tv_nsec -= STARPU_NS_PER_S;
314 }
315}
316
317/* Computes res += b */
318static __starpu_inline void starpu_timespec_accumulate(struct timespec *result,
319 struct timespec *a)
320{
321 result->tv_sec += a->tv_sec;
322 result->tv_nsec += a->tv_nsec;
323
324 if (result->tv_nsec >= STARPU_NS_PER_S)
325 {
326 ++(result)->tv_sec;
327 result->tv_nsec -= STARPU_NS_PER_S;
328 }
329}
330
331/* Computes result = a - b */
332static __starpu_inline void starpu_timespec_sub(const struct timespec *a,
333 const struct timespec *b,
334 struct timespec *result)
335{
336 result->tv_sec = a->tv_sec - b->tv_sec;
337 result->tv_nsec = a->tv_nsec - b->tv_nsec;
338
339 if ((result)->tv_nsec < 0)
340 {
341 --(result)->tv_sec;
342 result->tv_nsec += STARPU_NS_PER_S;
343 }
344}
345
346#define starpu_timespec_cmp(a, b, CMP) \
347 (((a)->tv_sec == (b)->tv_sec) ? ((a)->tv_nsec CMP(b)->tv_nsec) : ((a)->tv_sec CMP(b)->tv_sec))
348
353double starpu_timing_timespec_delay_us(struct timespec *start, struct timespec *end);
354
359double starpu_timing_timespec_to_us(struct timespec *ts);
360
368
376
385
388#ifdef __cplusplus
389}
390#endif
391
392#endif /* __STARPU_PROFILING_H__ */
int long long transferred_bytes
Definition starpu_profiling.h:182
struct timespec executing_time
Definition starpu_profiling.h:124
struct timespec acquire_data_end_time
Definition starpu_profiling.h:70
struct timespec waiting_time
Definition starpu_profiling.h:131
int workerid
Definition starpu_profiling.h:90
uint64_t stall_cycles
Definition starpu_profiling.h:163
struct timespec all_waiting_time
Definition starpu_profiling.h:149
struct timespec callback_end_time
Definition starpu_profiling.h:85
int transfer_count
Definition starpu_profiling.h:184
struct timespec submit_time
Definition starpu_profiling.h:56
struct timespec total_time
Definition starpu_profiling.h:180
struct timespec callback_start_time
Definition starpu_profiling.h:83
struct timespec all_scheduling_time
Definition starpu_profiling.h:155
double energy_consumed
Definition starpu_profiling.h:165
struct timespec pop_start_time
Definition starpu_profiling.h:63
struct timespec all_callback_time
Definition starpu_profiling.h:146
uint64_t used_cycles
Definition starpu_profiling.h:161
struct timespec push_end_time
Definition starpu_profiling.h:61
struct timespec all_executing_time
Definition starpu_profiling.h:143
double energy_consumed
Definition starpu_profiling.h:97
int executed_tasks
Definition starpu_profiling.h:158
uint64_t stall_cycles
Definition starpu_profiling.h:95
struct timespec start_time
Definition starpu_profiling.h:178
struct timespec callback_time
Definition starpu_profiling.h:127
struct timespec all_sleeping_time
Definition starpu_profiling.h:152
struct timespec acquire_data_start_time
Definition starpu_profiling.h:68
struct timespec release_data_end_time
Definition starpu_profiling.h:80
struct timespec pop_end_time
Definition starpu_profiling.h:65
struct timespec push_start_time
Definition starpu_profiling.h:59
struct timespec total_time
Definition starpu_profiling.h:121
struct timespec release_data_start_time
Definition starpu_profiling.h:78
struct timespec start_time
Definition starpu_profiling.h:73
struct timespec sleeping_time
Definition starpu_profiling.h:135
struct timespec scheduling_time
Definition starpu_profiling.h:139
struct timespec end_time
Definition starpu_profiling.h:75
uint64_t used_cycles
Definition starpu_profiling.h:93
struct timespec start_time
Definition starpu_profiling.h:119
void starpu_profiling_worker_helper_display_summary(void)
void starpu_profiling_bus_helper_display_summary(void)
void starpu_profiling_init(void)
int starpu_bus_get_profiling_info(int busid, struct starpu_profiling_bus_info *bus_info)
int starpu_bus_get_id(int src, int dst)
int starpu_bus_get_src(int busid)
double starpu_timing_timespec_to_us(struct timespec *ts)
int starpu_profiling_worker_get_info(int workerid, struct starpu_profiling_worker_info *worker_info)
int starpu_bus_get_direct(int busid)
int starpu_bus_get_count(void)
int starpu_bus_get_dst(int busid)
void starpu_data_display_memory_stats(void)
int starpu_bus_get_ngpus(int busid)
void starpu_bus_set_direct(int busid, int direct)
int starpu_profiling_status_set(int status)
double starpu_timing_timespec_delay_us(struct timespec *start, struct timespec *end)
void starpu_profiling_set_id(int new_id)
void starpu_bus_set_ngpus(int busid, int ngpus)
int starpu_profiling_status_get(void)
Definition starpu_profiling.h:176
Definition starpu_profiling.h:54
Definition starpu_profiling.h:117