StarPU Handbook
Loading...
Searching...
No Matches
starpu_perfmodel.h
Go to the documentation of this file.
1/* StarPU --- Runtime system for heterogeneous multicore architectures.
2 *
3 * Copyright (C) 2009-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
4 * Copyright (C) 2011 Télécom-SudParis
5 * Copyright (C) 2013 Thibaut Lambert
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_PERFMODEL_H__
20#define __STARPU_PERFMODEL_H__
21
22#include <starpu.h>
23#include <stdio.h>
24
25#ifdef __cplusplus
26extern "C"
27{
28#endif
29
35struct starpu_task;
37
38#define STARPU_NARCH STARPU_ANY_WORKER
39
44{
46 int devid;
47 int ncores;
48};
49
54{
57};
58
59
61{
62 double mean;
63 double deviation;
64 double sum;
65 double sum2;
66 unsigned nsample;
67 unsigned nerror;
68 uint32_t footprint;
69 size_t size;
70 double flops;
72 double duration;
73 starpu_tag_t tag;
74 double *parameters;
75};
76
78{
81};
82
87{
88 double sumlny;
90 double sumlnx;
91 double sumlnx2;
93 unsigned long minx;
94 unsigned long maxx;
96 double sumlnxlny;
98 double alpha;
99 double beta;
100 unsigned valid;
102 double a;
103 double b;
104 double c;
105 unsigned nl_valid;
107 unsigned nsample;
109 double *coeff;
110 unsigned ncoeff;
111 unsigned multi_valid;
112};
113
114struct starpu_perfmodel_history_table;
115
116#define starpu_per_arch_perfmodel starpu_perfmodel_per_arch STARPU_DEPRECATED
117
118typedef double (*starpu_perfmodel_per_arch_cost_function)(struct starpu_task *task, struct starpu_perfmodel_arch* arch, unsigned nimpl);
119typedef size_t (*starpu_perfmodel_per_arch_size_base)(struct starpu_task *task, struct starpu_perfmodel_arch* arch, unsigned nimpl);
120
125{
132 starpu_perfmodel_per_arch_cost_function cost_function;
137 starpu_perfmodel_per_arch_size_base size_base;
138
143 struct starpu_perfmodel_history_table *history;
158
159 char debug_path[256];
160};
161
166{
167 STARPU_PERFMODEL_INVALID=0,
176
177struct _starpu_perfmodel_state;
178typedef struct _starpu_perfmodel_state* starpu_perfmodel_state_t;
179
189{
222
227 double (*cost_function)(struct starpu_task *, unsigned nimpl);
233 double (*arch_cost_function)(struct starpu_task *, struct starpu_perfmodel_arch * arch, unsigned nimpl);
234
241 size_t (*size_base)(struct starpu_task *, unsigned nimpl);
248 uint32_t (*footprint)(struct starpu_task *);
249
255 const char *symbol;
256
261 unsigned is_loaded;
265 unsigned benchmarking;
269 unsigned is_init;
270
271 void (*parameters)(struct starpu_task * task, double *parameters);
277 const char **parameters_names;
282 unsigned nparameters;
288 unsigned **combinations;
298 starpu_perfmodel_state_t state;
299};
300
306
311int starpu_perfmodel_load_file(const char *filename, struct starpu_perfmodel *model);
312
320int starpu_perfmodel_load_symbol(const char *symbol, struct starpu_perfmodel *model);
321
327
333void starpu_perfmodel_get_model_path(const char *symbol, char *path, size_t maxlen);
334
338void starpu_perfmodel_dump_xml(FILE *output, struct starpu_perfmodel *model);
339
347
351struct starpu_perfmodel_arch *starpu_worker_get_perf_archtype(int workerid, unsigned sched_ctx_id);
352
353int starpu_perfmodel_get_narch_combs(void);
354int starpu_perfmodel_arch_comb_add(int ndevices, struct starpu_perfmodel_device* devices);
355int starpu_perfmodel_arch_comb_get(int ndevices, struct starpu_perfmodel_device *devices);
356struct starpu_perfmodel_arch *starpu_perfmodel_arch_comb_fetch(int comb);
357
358struct starpu_perfmodel_per_arch *starpu_perfmodel_get_model_per_arch(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, unsigned impl);
359struct starpu_perfmodel_per_arch *starpu_perfmodel_get_model_per_devices(struct starpu_perfmodel *model, int impl, ...);
360
361int starpu_perfmodel_set_per_devices_cost_function(struct starpu_perfmodel *model, int impl, starpu_perfmodel_per_arch_cost_function func, ...);
362int starpu_perfmodel_set_per_devices_size_base(struct starpu_perfmodel *model, int impl, starpu_perfmodel_per_arch_size_base func, ...);
363
367void starpu_perfmodel_debugfilepath(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, char *path, size_t maxlen, unsigned nimpl);
368
369char* starpu_perfmodel_get_archtype_name(enum starpu_worker_archtype archtype);
370
374void starpu_perfmodel_get_arch_name(struct starpu_perfmodel_arch *arch, char *archname, size_t maxlen, unsigned nimpl);
375
379double starpu_perfmodel_history_based_expected_perf(struct starpu_perfmodel *model, struct starpu_perfmodel_arch* arch, uint32_t footprint);
380
385
389int starpu_perfmodel_list(FILE *output);
390
391void starpu_perfmodel_print(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, unsigned nimpl, char *parameter, uint32_t *footprint, FILE *output);
392int starpu_perfmodel_print_all(struct starpu_perfmodel *model, char *arch, char *parameter, uint32_t *footprint, FILE *output);
393int starpu_perfmodel_print_estimations(struct starpu_perfmodel *model, uint32_t footprint, FILE *output);
394
395int starpu_perfmodel_list_combs(FILE *output, struct starpu_perfmodel *model);
396
405void starpu_perfmodel_update_history(struct starpu_perfmodel *model, struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned cpuid, unsigned nimpl, double measured);
406
410void starpu_perfmodel_directory(FILE *output);
411
416
421
426
430double starpu_transfer_bandwidth(unsigned src_node, unsigned dst_node);
431
435double starpu_transfer_latency(unsigned src_node, unsigned dst_node);
436
440double starpu_transfer_predict(unsigned src_node, unsigned dst_node, size_t size);
441
446
449#ifdef __cplusplus
450}
451#endif
452
453#endif /* __STARPU_PERFMODEL_H__ */
Definition: starpu_task.h:552
Definition: starpu_task.h:567
uint64_t starpu_tag_t
Definition: starpu_task_dep.h:127
double sum2
Definition: starpu_perfmodel.h:65
const char * symbol
Definition: starpu_perfmodel.h:255
starpu_perfmodel_per_arch_cost_function cost_function
Definition: starpu_perfmodel.h:132
double(* cost_function)(struct starpu_task *, unsigned nimpl)
Definition: starpu_perfmodel.h:227
struct starpu_perfmodel_regression_model regression
Definition: starpu_perfmodel.h:157
struct starpu_perfmodel_history_list * list
Definition: starpu_perfmodel.h:150
unsigned valid
Definition: starpu_perfmodel.h:100
size_t size
Definition: starpu_perfmodel.h:69
double deviation
Definition: starpu_perfmodel.h:63
unsigned ncombinations
Definition: starpu_perfmodel.h:294
struct starpu_perfmodel_device * devices
Definition: starpu_perfmodel.h:56
uint32_t(* footprint)(struct starpu_task *)
Definition: starpu_perfmodel.h:248
double(* arch_cost_function)(struct starpu_task *, struct starpu_perfmodel_arch *arch, unsigned nimpl)
Definition: starpu_perfmodel.h:233
double sumlnx2
Definition: starpu_perfmodel.h:91
unsigned ** combinations
Definition: starpu_perfmodel.h:288
int ncores
Definition: starpu_perfmodel.h:47
unsigned ncoeff
Definition: starpu_perfmodel.h:110
int devid
Definition: starpu_perfmodel.h:46
unsigned long minx
Definition: starpu_perfmodel.h:93
double sumlny
Definition: starpu_perfmodel.h:88
size_t(* size_base)(struct starpu_task *, unsigned nimpl)
Definition: starpu_perfmodel.h:241
double mean
Definition: starpu_perfmodel.h:62
unsigned nl_valid
Definition: starpu_perfmodel.h:105
double sumlnxlny
Definition: starpu_perfmodel.h:96
unsigned nparameters
Definition: starpu_perfmodel.h:282
unsigned nsample
Definition: starpu_perfmodel.h:66
const char ** parameters_names
Definition: starpu_perfmodel.h:277
double beta
Definition: starpu_perfmodel.h:99
starpu_perfmodel_per_arch_size_base size_base
Definition: starpu_perfmodel.h:137
double sum
Definition: starpu_perfmodel.h:64
double a
Definition: starpu_perfmodel.h:102
enum starpu_worker_archtype type
Definition: starpu_perfmodel.h:45
double c
Definition: starpu_perfmodel.h:104
double sumlnx
Definition: starpu_perfmodel.h:90
unsigned nsample
Definition: starpu_perfmodel.h:107
unsigned long maxx
Definition: starpu_perfmodel.h:94
uint32_t footprint
Definition: starpu_perfmodel.h:68
int ndevices
Definition: starpu_perfmodel.h:55
unsigned is_loaded
Definition: starpu_perfmodel.h:261
struct starpu_perfmodel_history_table * history
Definition: starpu_perfmodel.h:143
unsigned multi_valid
Definition: starpu_perfmodel.h:111
double * coeff
Definition: starpu_perfmodel.h:109
double flops
Definition: starpu_perfmodel.h:70
double b
Definition: starpu_perfmodel.h:103
double alpha
Definition: starpu_perfmodel.h:98
enum starpu_perfmodel_type type
Definition: starpu_perfmodel.h:221
double starpu_perfmodel_history_based_expected_perf(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, uint32_t footprint)
void starpu_perfmodel_init(struct starpu_perfmodel *model)
void starpu_perfmodel_debugfilepath(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, char *path, size_t maxlen, unsigned nimpl)
void starpu_perfmodel_get_model_path(const char *symbol, char *path, size_t maxlen)
struct starpu_perfmodel starpu_perfmodel_nop
int starpu_perfmodel_load_symbol(const char *symbol, struct starpu_perfmodel *model)
void starpu_bus_print_affinity(FILE *f)
void starpu_perfmodel_get_arch_name(struct starpu_perfmodel_arch *arch, char *archname, size_t maxlen, unsigned nimpl)
int starpu_perfmodel_list(FILE *output)
double starpu_transfer_bandwidth(unsigned src_node, unsigned dst_node)
double starpu_transfer_latency(unsigned src_node, unsigned dst_node)
void starpu_bus_print_filenames(FILE *f)
void starpu_perfmodel_free_sampling(void)
int starpu_perfmodel_unload_model(struct starpu_perfmodel *model)
double starpu_transfer_predict(unsigned src_node, unsigned dst_node, size_t size)
void starpu_perfmodel_initialize(void)
void starpu_perfmodel_dump_xml(FILE *output, struct starpu_perfmodel *model)
void starpu_bus_print_bandwidth(FILE *f)
struct starpu_perfmodel_arch * starpu_worker_get_perf_archtype(int workerid, unsigned sched_ctx_id)
starpu_perfmodel_type
Definition: starpu_perfmodel.h:166
void starpu_perfmodel_directory(FILE *output)
void starpu_perfmodel_update_history(struct starpu_perfmodel *model, struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned cpuid, unsigned nimpl, double measured)
int starpu_perfmodel_load_file(const char *filename, struct starpu_perfmodel *model)
@ STARPU_NL_REGRESSION_BASED
Definition: starpu_perfmodel.h:172
@ STARPU_MULTIPLE_REGRESSION_BASED
Definition: starpu_perfmodel.h:173
@ STARPU_REGRESSION_BASED
Definition: starpu_perfmodel.h:171
@ STARPU_COMMON
Definition: starpu_perfmodel.h:169
@ STARPU_PER_ARCH
Definition: starpu_perfmodel.h:168
@ STARPU_HISTORY_BASED
Definition: starpu_perfmodel.h:170
Definition: starpu_perfmodel.h:189
Definition: starpu_perfmodel.h:54
Definition: starpu_perfmodel.h:44
Definition: starpu_perfmodel.h:61
Definition: starpu_perfmodel.h:78
Definition: starpu_perfmodel.h:125
Definition: starpu_perfmodel.h:87
starpu_worker_archtype
Definition: starpu_worker.h:63