StarPU Handbook
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
starpu_perfmodel.h
Go to the documentation of this file.
1 /* StarPU --- Runtime system for heterogeneous multicore architectures.
2  *
3  * Copyright (C) 2010-2014 Université de Bordeaux
4  * Copyright (C) 2010, 2011, 2012, 2013, 2014 Centre National de la Recherche Scientifique
5  * Copyright (C) 2011 Télécom-SudParis
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 #include <starpu_util.h>
26 #include <starpu_worker.h>
27 
28 #ifdef __cplusplus
29 extern "C"
30 {
31 #endif
32 
33 struct starpu_task;
34 struct starpu_data_descr;
35 
36 #define STARPU_NARCH STARPU_ANY_WORKER
37 
39 {
40  enum starpu_worker_archtype type;
41  int devid; /* identifier of the precise device */
42  int ncores; /* number of execution in parallel, minus 1 */
43 };
44 
46 {
47  int ndevices;
48  struct starpu_perfmodel_device *devices;
49 };
50 
51 
53 {
54  double mean;
55  double deviation;
56  double sum;
57  double sum2;
58  unsigned nsample;
59  unsigned nerror;
60  uint32_t footprint;
61  size_t size;
62  double flops;
63 };
64 
66 {
69 };
70 
72 {
73  double sumlny;
74 
75  double sumlnx;
76  double sumlnx2;
77 
78  unsigned long minx;
79  unsigned long maxx;
80 
81  double sumlnxlny;
82 
83  double alpha;
84  double beta;
85  unsigned valid;
86 
87  double a, b, c;
88  unsigned nl_valid;
89 
90  unsigned nsample;
91 };
92 
93 struct starpu_perfmodel_history_table;
94 
95 #define starpu_per_arch_perfmodel starpu_perfmodel_per_arch STARPU_DEPRECATED
96 
97 typedef double (*starpu_perfmodel_per_arch_cost_function)(struct starpu_task *task, struct starpu_perfmodel_arch* arch, unsigned nimpl);
98 typedef size_t (*starpu_perfmodel_per_arch_size_base)(struct starpu_task *task, struct starpu_perfmodel_arch* arch, unsigned nimpl);
99 
101 {
102  starpu_perfmodel_per_arch_cost_function cost_function;
103  starpu_perfmodel_per_arch_size_base size_base;
104 
105  struct starpu_perfmodel_history_table *history;
108 
109  char debug_path[256];
110 };
111 
113 {
114  STARPU_PERFMODEL_INVALID=0,
120 };
121 
122 struct _starpu_perfmodel_state;
123 typedef struct _starpu_perfmodel_state* starpu_perfmodel_state_t;
124 
126 {
128 
129  double (*cost_function)(struct starpu_task *, unsigned nimpl);
130 
131  size_t (*size_base)(struct starpu_task *, unsigned nimpl);
132  uint32_t (*footprint)(struct starpu_task *);
133 
134  const char *symbol;
135 
136  unsigned is_loaded;
137  unsigned benchmarking;
138  unsigned is_init;
139 
140  starpu_perfmodel_state_t state;
141 };
142 
143 void starpu_perfmodel_init(FILE *f, struct starpu_perfmodel *model);
145 
146 struct starpu_perfmodel_arch *starpu_worker_get_perf_archtype(int workerid, unsigned sched_ctx_id);
147 
148 int starpu_perfmodel_load_symbol(const char *symbol, struct starpu_perfmodel *model);
150 int starpu_get_narch_combs();
151 int starpu_perfmodel_arch_comb_add(int ndevices, struct starpu_perfmodel_device* devices);
152 int starpu_perfmodel_arch_comb_get(int ndevices, struct starpu_perfmodel_device *devices);
153 
154 struct starpu_perfmodel_per_arch *starpu_perfmodel_get_model_per_arch(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, unsigned impl);
155 struct starpu_perfmodel_per_arch *starpu_perfmodel_get_model_per_devices(struct starpu_perfmodel *model, int impl, ...);
156 
157 int starpu_perfmodel_set_per_devices_cost_function(struct starpu_perfmodel *model, int impl, starpu_perfmodel_per_arch_cost_function func, ...);
158 int starpu_perfmodel_set_per_devices_size_base(struct starpu_perfmodel *model, int impl, starpu_perfmodel_per_arch_size_base func, ...);
159 
160 void starpu_perfmodel_debugfilepath(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, char *path, size_t maxlen, unsigned nimpl);
162 void starpu_perfmodel_get_arch_name(struct starpu_perfmodel_arch *arch, char *archname, size_t maxlen, unsigned nimpl);
163 
164 double starpu_permodel_history_based_expected_perf(struct starpu_perfmodel *model, struct starpu_perfmodel_arch* arch, uint32_t footprint);
165 int starpu_perfmodel_list(FILE *output);
166 void starpu_perfmodel_print(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, unsigned nimpl, char *parameter, uint32_t *footprint, FILE *output);
167 int starpu_perfmodel_print_all(struct starpu_perfmodel *model, char *arch, char *parameter, uint32_t *footprint, FILE *output);
168 
169 int starpu_perfmodel_list_combs(FILE *output, struct starpu_perfmodel *model);
170 
171 void starpu_perfmodel_update_history(struct starpu_perfmodel *model, struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned cpuid, unsigned nimpl, double measured);
172 void starpu_perfmodel_directory(FILE *output);
173 
174 void starpu_bus_print_bandwidth(FILE *f);
175 void starpu_bus_print_affinity(FILE *f);
176 
177 double starpu_transfer_bandwidth(unsigned src_node, unsigned dst_node);
178 double starpu_transfer_latency(unsigned src_node, unsigned dst_node);
179 double starpu_transfer_predict(unsigned src_node, unsigned dst_node, size_t size);
180 
181 #ifdef __cplusplus
182 }
183 #endif
184 
185 #endif /* __STARPU_PERFMODEL_H__ */
Definition: starpu_perfmodel.h:115
double sumlny
Definition: starpu_perfmodel.h:73
Definition: starpu_perfmodel.h:100
void starpu_bus_print_bandwidth(FILE *f)
void starpu_perfmodel_get_arch_name(struct starpu_perfmodel_arch *arch, char *archname, size_t maxlen, unsigned nimpl)
double starpu_permodel_history_based_expected_perf(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, uint32_t footprint)
unsigned is_init
Definition: starpu_perfmodel.h:138
int starpu_perfmodel_list(FILE *output)
double(* cost_function)(struct starpu_task *, unsigned nimpl)
Definition: starpu_perfmodel.h:129
void starpu_perfmodel_free_sampling_directories(void)
unsigned nsample
Definition: starpu_perfmodel.h:90
void starpu_perfmodel_debugfilepath(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, char *path, size_t maxlen, unsigned nimpl)
double sumlnx2
Definition: starpu_perfmodel.h:76
starpu_worker_archtype
Definition: starpu_worker.h:30
struct starpu_perfmodel_history_list * list
Definition: starpu_perfmodel.h:106
unsigned long minx
Definition: starpu_perfmodel.h:78
double flops
Definition: starpu_perfmodel.h:62
unsigned nl_valid
Definition: starpu_perfmodel.h:88
double a
Definition: starpu_perfmodel.h:87
Definition: starpu_perfmodel.h:117
starpu_perfmodel_type
Definition: starpu_perfmodel.h:112
struct starpu_perfmodel_history_entry * entry
Definition: starpu_perfmodel.h:68
unsigned is_loaded
Definition: starpu_perfmodel.h:136
uint32_t footprint
Definition: starpu_perfmodel.h:60
struct starpu_perfmodel_history_table * history
Definition: starpu_perfmodel.h:105
double sum
Definition: starpu_perfmodel.h:56
Definition: starpu_perfmodel.h:65
starpu_perfmodel_per_arch_size_base size_base
Definition: starpu_perfmodel.h:103
Definition: starpu_task.h:123
struct starpu_perfmodel_arch * starpu_worker_get_perf_archtype(int workerid, unsigned sched_ctx_id)
Definition: starpu_perfmodel.h:38
double sum2
Definition: starpu_perfmodel.h:57
void starpu_perfmodel_directory(FILE *output)
double c
Definition: starpu_perfmodel.h:87
double starpu_transfer_predict(unsigned src_node, unsigned dst_node, size_t size)
void starpu_bus_print_affinity(FILE *f)
unsigned valid
Definition: starpu_perfmodel.h:85
Definition: starpu_perfmodel.h:52
Definition: starpu_perfmodel.h:119
unsigned long maxx
Definition: starpu_perfmodel.h:79
double sumlnxlny
Definition: starpu_perfmodel.h:81
Definition: starpu_perfmodel.h:45
double starpu_transfer_bandwidth(unsigned src_node, unsigned dst_node)
Definition: starpu_perfmodel.h:118
uint32_t(* footprint)(struct starpu_task *)
Definition: starpu_perfmodel.h:132
size_t(* size_base)(struct starpu_task *, unsigned nimpl)
Definition: starpu_perfmodel.h:131
double deviation
Definition: starpu_perfmodel.h:55
Definition: starpu_perfmodel.h:125
double starpu_transfer_latency(unsigned src_node, unsigned dst_node)
int starpu_perfmodel_load_symbol(const char *symbol, struct starpu_perfmodel *model)
double b
Definition: starpu_perfmodel.h:87
double alpha
Definition: starpu_perfmodel.h:83
unsigned nsample
Definition: starpu_perfmodel.h:58
struct starpu_perfmodel_regression_model regression
Definition: starpu_perfmodel.h:107
char * starpu_perfmodel_get_archtype_name(enum starpu_worker_archtype archtype)
size_t size
Definition: starpu_perfmodel.h:61
starpu_perfmodel_per_arch_cost_function cost_function
Definition: starpu_perfmodel.h:102
void starpu_perfmodel_print(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, unsigned nimpl, char *parameter, uint32_t *footprint, FILE *output)
double mean
Definition: starpu_perfmodel.h:54
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_print_all(struct starpu_perfmodel *model, char *arch, char *parameter, uint32_t *footprint, FILE *output)
int starpu_perfmodel_unload_model(struct starpu_perfmodel *model)
Definition: starpu_data.h:44
void starpu_perfmodel_init(FILE *f, struct starpu_perfmodel *model)
Definition: starpu_perfmodel.h:71
enum starpu_perfmodel_type type
Definition: starpu_perfmodel.h:127
Definition: starpu_perfmodel.h:116
double sumlnx
Definition: starpu_perfmodel.h:75
const char * symbol
Definition: starpu_perfmodel.h:134
double beta
Definition: starpu_perfmodel.h:84
struct starpu_perfmodel_history_list * next
Definition: starpu_perfmodel.h:67