StarPU Handbook - StarPU Introduction
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-2023 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#endif
28
34struct starpu_task;
36
46
55
60{
61 double mean;
62 double deviation;
63 double sum;
64 double sum2;
65 unsigned nsample;
66 unsigned nerror;
67 uint32_t footprint;
68 size_t size;
69 double flops;
71 double duration;
72 starpu_tag_t tag;
73 double *parameters;
74};
75
84
89{
90 double sumlny;
92 double sumlnx;
93 double sumlnx2;
95 unsigned long minx;
96 unsigned long maxx;
98 double sumlnxlny;
100 double alpha;
101 double beta;
102 unsigned valid;
104 double a;
105 double b;
106 double c;
107 unsigned nl_valid;
109 unsigned nsample;
111 double *coeff;
112 unsigned ncoeff;
113 unsigned multi_valid;
114};
115
116struct starpu_perfmodel_history_table;
117
118#define starpu_per_arch_perfmodel starpu_perfmodel_per_arch STARPU_DEPRECATED
119
120typedef double (*starpu_perfmodel_per_arch_cost_function)(struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl);
121typedef size_t (*starpu_perfmodel_per_arch_size_base)(struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned nimpl);
122
127{
134 starpu_perfmodel_per_arch_cost_function cost_function;
139 starpu_perfmodel_per_arch_size_base size_base;
140
145 struct starpu_perfmodel_history_table *history;
160
161 char debug_path[256];
162};
163
179
180struct _starpu_perfmodel_state;
181typedef struct _starpu_perfmodel_state *starpu_perfmodel_state_t;
182
192{
225
230 double (*cost_function)(struct starpu_task *, unsigned nimpl);
236 double (*arch_cost_function)(struct starpu_task *, struct starpu_perfmodel_arch *arch, unsigned nimpl);
242 double (*worker_cost_function)(struct starpu_task *, unsigned workerid, unsigned nimpl);
243
250 size_t (*size_base)(struct starpu_task *, unsigned nimpl);
257 uint32_t (*footprint)(struct starpu_task *);
258
264 const char *symbol;
265
270 char *path;
271
276 unsigned is_loaded;
280 unsigned benchmarking;
284 unsigned is_init;
285
286 void (*parameters)(struct starpu_task *task, double *parameters);
292 const char **parameters_names;
297 unsigned nparameters;
303 unsigned **combinations;
313 starpu_perfmodel_state_t state;
314};
315
321
328
338
351int starpu_energy_stop(struct starpu_perfmodel *model, struct starpu_task *task, unsigned nimpl, unsigned ntasks, int workerid, enum starpu_worker_archtype archi);
352
357int starpu_perfmodel_load_file(const char *filename, struct starpu_perfmodel *model);
358
366int starpu_perfmodel_load_symbol(const char *symbol, struct starpu_perfmodel *model);
367
373
378
384void starpu_perfmodel_get_model_path(const char *symbol, char *path, size_t maxlen);
385
390void starpu_perfmodel_dump_xml(FILE *output, struct starpu_perfmodel *model);
391
399
403struct starpu_perfmodel_arch *starpu_worker_get_perf_archtype(int workerid, unsigned sched_ctx_id);
404
405int starpu_perfmodel_get_narch_combs(void);
406int starpu_perfmodel_arch_comb_add(int ndevices, struct starpu_perfmodel_device *devices);
407int starpu_perfmodel_arch_comb_get(int ndevices, struct starpu_perfmodel_device *devices);
408struct starpu_perfmodel_arch *starpu_perfmodel_arch_comb_fetch(int comb);
409
410struct starpu_perfmodel_per_arch *starpu_perfmodel_get_model_per_arch(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, unsigned impl);
411struct starpu_perfmodel_per_arch *starpu_perfmodel_get_model_per_devices(struct starpu_perfmodel *model, int impl, ...);
412
413int starpu_perfmodel_set_per_devices_cost_function(struct starpu_perfmodel *model, int impl, starpu_perfmodel_per_arch_cost_function func, ...);
414int starpu_perfmodel_set_per_devices_size_base(struct starpu_perfmodel *model, int impl, starpu_perfmodel_per_arch_size_base func, ...);
415
419void starpu_perfmodel_debugfilepath(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, char *path, size_t maxlen, unsigned nimpl);
420
421const char *starpu_perfmodel_get_archtype_name(enum starpu_worker_archtype archtype);
422
426void starpu_perfmodel_get_arch_name(struct starpu_perfmodel_arch *arch, char *archname, size_t maxlen, unsigned nimpl);
427
431double starpu_perfmodel_history_based_expected_perf(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, uint32_t footprint);
432
437
441int starpu_perfmodel_list(FILE *output);
442
443void starpu_perfmodel_print(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, unsigned nimpl, char *parameter, uint32_t *footprint, FILE *output);
444int starpu_perfmodel_print_all(struct starpu_perfmodel *model, char *arch, char *parameter, uint32_t *footprint, FILE *output);
445int starpu_perfmodel_print_estimations(struct starpu_perfmodel *model, uint32_t footprint, FILE *output);
446
447int starpu_perfmodel_list_combs(FILE *output, struct starpu_perfmodel *model);
448
467void starpu_perfmodel_update_history(struct starpu_perfmodel *model, struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned cpuid, unsigned nimpl, double measured);
468
475void starpu_perfmodel_update_history_n(struct starpu_perfmodel *model, struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned cpuid, unsigned nimpl, double average_measured, unsigned number);
476
480void starpu_perfmodel_directory(FILE *output);
481
486
491
496
501double starpu_transfer_bandwidth(unsigned src_node, unsigned dst_node);
502
507double starpu_transfer_latency(unsigned src_node, unsigned dst_node);
508
513double starpu_transfer_predict(unsigned src_node, unsigned dst_node, size_t size);
514
519
522#ifdef __cplusplus
523}
524#endif
525
526#endif /* __STARPU_PERFMODEL_H__ */
unsigned workerid
Definition starpu_task.h:1214
Definition starpu_task.h:668
Definition starpu_task.h:683
uint64_t starpu_tag_t
Definition starpu_task_dep.h:134
double sum2
Definition starpu_perfmodel.h:64
const char * symbol
Definition starpu_perfmodel.h:264
starpu_perfmodel_per_arch_cost_function cost_function
Definition starpu_perfmodel.h:134
double(* cost_function)(struct starpu_task *, unsigned nimpl)
Definition starpu_perfmodel.h:230
struct starpu_perfmodel_regression_model regression
Definition starpu_perfmodel.h:159
struct starpu_perfmodel_history_list * list
Definition starpu_perfmodel.h:152
unsigned valid
Definition starpu_perfmodel.h:102
size_t size
Definition starpu_perfmodel.h:68
double deviation
Definition starpu_perfmodel.h:62
unsigned ncombinations
Definition starpu_perfmodel.h:309
struct starpu_perfmodel_device * devices
Definition starpu_perfmodel.h:53
uint32_t(* footprint)(struct starpu_task *)
Definition starpu_perfmodel.h:257
double(* arch_cost_function)(struct starpu_task *, struct starpu_perfmodel_arch *arch, unsigned nimpl)
Definition starpu_perfmodel.h:236
double sumlnx2
Definition starpu_perfmodel.h:93
unsigned ** combinations
Definition starpu_perfmodel.h:303
int ncores
Definition starpu_perfmodel.h:44
unsigned ncoeff
Definition starpu_perfmodel.h:112
int devid
Definition starpu_perfmodel.h:43
unsigned long minx
Definition starpu_perfmodel.h:95
double sumlny
Definition starpu_perfmodel.h:90
size_t(* size_base)(struct starpu_task *, unsigned nimpl)
Definition starpu_perfmodel.h:250
double mean
Definition starpu_perfmodel.h:61
unsigned nl_valid
Definition starpu_perfmodel.h:107
double sumlnxlny
Definition starpu_perfmodel.h:98
unsigned nparameters
Definition starpu_perfmodel.h:297
unsigned nsample
Definition starpu_perfmodel.h:65
const char ** parameters_names
Definition starpu_perfmodel.h:292
double beta
Definition starpu_perfmodel.h:101
starpu_perfmodel_per_arch_size_base size_base
Definition starpu_perfmodel.h:139
double sum
Definition starpu_perfmodel.h:63
double a
Definition starpu_perfmodel.h:104
enum starpu_worker_archtype type
Definition starpu_perfmodel.h:42
char * path
Definition starpu_perfmodel.h:270
double(* worker_cost_function)(struct starpu_task *, unsigned workerid, unsigned nimpl)
Definition starpu_perfmodel.h:242
double c
Definition starpu_perfmodel.h:106
double sumlnx
Definition starpu_perfmodel.h:92
unsigned nsample
Definition starpu_perfmodel.h:109
unsigned long maxx
Definition starpu_perfmodel.h:96
uint32_t footprint
Definition starpu_perfmodel.h:67
int ndevices
Definition starpu_perfmodel.h:52
unsigned is_loaded
Definition starpu_perfmodel.h:276
struct starpu_perfmodel_history_table * history
Definition starpu_perfmodel.h:145
unsigned multi_valid
Definition starpu_perfmodel.h:113
double * coeff
Definition starpu_perfmodel.h:111
double flops
Definition starpu_perfmodel.h:69
double b
Definition starpu_perfmodel.h:105
double alpha
Definition starpu_perfmodel.h:100
enum starpu_perfmodel_type type
Definition starpu_perfmodel.h:224
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)
int starpu_energy_start(int workerid, enum starpu_worker_archtype archi)
int starpu_energy_stop(struct starpu_perfmodel *model, struct starpu_task *task, unsigned nimpl, unsigned ntasks, int workerid, enum starpu_worker_archtype archi)
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_save_history_based_model(struct starpu_perfmodel *model)
void starpu_perfmodel_initialize(void)
void starpu_perfmodel_dump_xml(FILE *output, struct starpu_perfmodel *model)
void starpu_bus_print_bandwidth(FILE *f)
int starpu_perfmodel_deinit(struct starpu_perfmodel *model)
struct starpu_perfmodel_arch * starpu_worker_get_perf_archtype(int workerid, unsigned sched_ctx_id)
starpu_perfmodel_type
Definition starpu_perfmodel.h:168
void starpu_perfmodel_update_history_n(struct starpu_perfmodel *model, struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned cpuid, unsigned nimpl, double average_measured, unsigned number)
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:175
@ STARPU_PER_WORKER
Definition starpu_perfmodel.h:170
@ STARPU_MULTIPLE_REGRESSION_BASED
Definition starpu_perfmodel.h:176
@ STARPU_REGRESSION_BASED
Definition starpu_perfmodel.h:174
@ STARPU_COMMON
Definition starpu_perfmodel.h:172
@ STARPU_PER_ARCH
Definition starpu_perfmodel.h:171
@ STARPU_HISTORY_BASED
Definition starpu_perfmodel.h:173
Definition starpu_perfmodel.h:192
Definition starpu_perfmodel.h:51
Definition starpu_perfmodel.h:41
Definition starpu_perfmodel.h:60
Definition starpu_perfmodel.h:80
Definition starpu_perfmodel.h:127
Definition starpu_perfmodel.h:89
starpu_worker_archtype
Definition starpu_worker.h:66