StarPU Handbook
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
starpu_perfmodel.h
Go to the documentation of this file.
1 /* StarPU --- Runtime system for heterogeneous multicore architectures.
2  *
3  * Copyright (C) 2010-2013 Université de Bordeaux 1
4  * Copyright (C) 2010, 2011, 2012, 2013 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 
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31 
32 struct starpu_task;
33 struct starpu_data_descr;
34 
36 {
38  STARPU_CUDA_DEFAULT = STARPU_MAXCPUS,
40 };
41 
42 #ifdef __STDC_VERSION__
43 # if __STDC_VERSION__ > 199901L || STARPU_GNUC_PREREQ(4, 6)
44 
45 /* Make sure the following assertions hold, since StarPU relies on it. */
46 
47 _Static_assert(STARPU_CPU_DEFAULT == 0,
48  "invalid STARPU_CPU_DEFAULT value");
50  "invalid STARPU_CPU_DEFAULT value");
52  "invalid STARPU_{CUDA,OPENCL}_DEFAULT values");
53 
54 # endif
55 #endif
56 
57 #define STARPU_NARCH_VARIATIONS (STARPU_OPENCL_DEFAULT + STARPU_MAXOPENCLDEVS)
58 
60 {
61  double mean;
62  double deviation;
63  double sum;
64  double sum2;
65  unsigned nsample;
66  uint32_t footprint;
67 #ifdef STARPU_HAVE_WINDOWS
68  unsigned size;
69 #else
70  size_t size;
71 #endif
72  double flops;
73 };
74 
76 {
79 };
80 
82 {
83  double sumlny;
84 
85  double sumlnx;
86  double sumlnx2;
87 
88  unsigned long minx;
89  unsigned long maxx;
90 
91  double sumlnxlny;
92 
93  double alpha;
94  double beta;
95  unsigned valid;
96 
97  double a, b, c;
98  unsigned nl_valid;
99 
100  unsigned nsample;
101 };
102 
103 struct starpu_perfmodel_history_table;
104 
105 #define starpu_per_arch_perfmodel starpu_perfmodel_per_arch STARPU_DEPRECATED
106 
108 {
109  double (*cost_model)(struct starpu_data_descr *t) STARPU_DEPRECATED;
110  double (*cost_function)(struct starpu_task *task, enum starpu_perfmodel_archtype arch, unsigned nimpl);
111  size_t (*size_base)(struct starpu_task *, enum starpu_perfmodel_archtype arch, unsigned nimpl);
112 
113  struct starpu_perfmodel_history_table *history;
116 #ifdef STARPU_MODEL_DEBUG
117  char debug_path[256];
118 #endif
119 };
120 
122 {
128 };
129 
131 {
133 
134  double (*cost_model)(struct starpu_data_descr *) STARPU_DEPRECATED;
135  double (*cost_function)(struct starpu_task *, unsigned nimpl);
136 
137  size_t (*size_base)(struct starpu_task *, unsigned nimpl);
138 
139  struct starpu_perfmodel_per_arch per_arch[STARPU_NARCH_VARIATIONS][STARPU_MAXIMPLEMENTATIONS];
140 
141  const char *symbol;
142 
143  unsigned is_loaded;
144  unsigned benchmarking;
145  starpu_pthread_rwlock_t model_rwlock;
146 };
147 
149 
150 int starpu_perfmodel_load_symbol(const char *symbol, struct starpu_perfmodel *model);
152 
153 void starpu_perfmodel_debugfilepath(struct starpu_perfmodel *model, enum starpu_perfmodel_archtype arch, char *path, size_t maxlen, unsigned nimpl);
154 void starpu_perfmodel_get_arch_name(enum starpu_perfmodel_archtype arch, char *archname, size_t maxlen, unsigned nimpl);
155 
156 double starpu_permodel_history_based_expected_perf(struct starpu_perfmodel *model, enum starpu_perfmodel_archtype arch, uint32_t footprint);
157 int starpu_perfmodel_list(FILE *output);
158 void starpu_perfmodel_print(struct starpu_perfmodel *model, enum starpu_perfmodel_archtype arch, unsigned nimpl, char *parameter, uint32_t *footprint, FILE *output);
159 int starpu_perfmodel_print_all(struct starpu_perfmodel *model, char *arch, char *parameter, uint32_t *footprint, FILE *output);
160 
161 void starpu_perfmodel_directory(FILE *output);
162 
163 void starpu_perfmodel_update_history(struct starpu_perfmodel *model, struct starpu_task *task, enum starpu_perfmodel_archtype arch, unsigned cpuid, unsigned nimpl, double measured);
164 
165 void starpu_bus_print_bandwidth(FILE *f);
166 void starpu_bus_print_affinity(FILE *f);
167 
168 double starpu_transfer_bandwidth(unsigned src_node, unsigned dst_node);
169 double starpu_transfer_latency(unsigned src_node, unsigned dst_node);
170 double starpu_transfer_predict(unsigned src_node, unsigned dst_node, size_t size);
171 
172 #ifdef __cplusplus
173 }
174 #endif
175 
176 #endif /* __STARPU_PERFMODEL_H__ */
uint32_t footprint
Definition: starpu_perfmodel.h:66
void starpu_perfmodel_update_history(struct starpu_perfmodel *model, struct starpu_task *task, enum starpu_perfmodel_archtype arch, unsigned cpuid, unsigned nimpl, double measured)
double deviation
Definition: starpu_perfmodel.h:62
Definition: starpu_perfmodel.h:123
struct starpu_perfmodel_history_entry * entry
Definition: starpu_perfmodel.h:78
size_t(* size_base)(struct starpu_task *, unsigned nimpl)
Definition: starpu_perfmodel.h:137
Definition: starpu_perfmodel.h:39
Definition: starpu_perfmodel.h:107
void starpu_bus_print_bandwidth(FILE *f)
starpu_pthread_rwlock_t model_rwlock
Definition: starpu_perfmodel.h:145
double c
Definition: starpu_perfmodel.h:97
void starpu_perfmodel_get_arch_name(enum starpu_perfmodel_archtype arch, char *archname, size_t maxlen, unsigned nimpl)
struct starpu_perfmodel_history_table * history
Definition: starpu_perfmodel.h:113
struct starpu_perfmodel_history_list * next
Definition: starpu_perfmodel.h:77
double(* cost_model)(struct starpu_data_descr *t)
Definition: starpu_perfmodel.h:109
unsigned valid
Definition: starpu_perfmodel.h:95
enum starpu_perfmodel_archtype starpu_worker_get_perf_archtype(int workerid)
int starpu_perfmodel_list(FILE *output)
double sum
Definition: starpu_perfmodel.h:63
double beta
Definition: starpu_perfmodel.h:94
double sumlnx
Definition: starpu_perfmodel.h:85
unsigned is_loaded
Definition: starpu_perfmodel.h:143
struct starpu_perfmodel_regression_model regression
Definition: starpu_perfmodel.h:115
Definition: starpu_perfmodel.h:125
starpu_perfmodel_type
Definition: starpu_perfmodel.h:121
unsigned nsample
Definition: starpu_perfmodel.h:65
double(* cost_function)(struct starpu_task *task, enum starpu_perfmodel_archtype arch, unsigned nimpl)
Definition: starpu_perfmodel.h:110
Definition: starpu_perfmodel.h:75
double(* cost_function)(struct starpu_task *, unsigned nimpl)
Definition: starpu_perfmodel.h:135
Definition: starpu_task.h:104
struct starpu_perfmodel_per_arch per_arch[STARPU_NARCH_VARIATIONS][STARPU_MAXIMPLEMENTATIONS]
Definition: starpu_perfmodel.h:139
double mean
Definition: starpu_perfmodel.h:61
double sumlny
Definition: starpu_perfmodel.h:83
Definition: starpu_perfmodel.h:37
double starpu_transfer_predict(unsigned src_node, unsigned dst_node, size_t size)
void starpu_bus_print_affinity(FILE *f)
unsigned nl_valid
Definition: starpu_perfmodel.h:98
double sumlnx2
Definition: starpu_perfmodel.h:86
Definition: starpu_perfmodel.h:59
Definition: starpu_perfmodel.h:127
Definition: starpu_perfmodel.h:38
void starpu_perfmodel_directory(FILE *output)
#define STARPU_MAXCUDADEVS
Definition: starpu_config.h:72
unsigned benchmarking
Definition: starpu_perfmodel.h:144
size_t size
Definition: starpu_perfmodel.h:70
double b
Definition: starpu_perfmodel.h:97
double starpu_transfer_bandwidth(unsigned src_node, unsigned dst_node)
const char * symbol
Definition: starpu_perfmodel.h:141
void starpu_perfmodel_debugfilepath(struct starpu_perfmodel *model, enum starpu_perfmodel_archtype arch, char *path, size_t maxlen, unsigned nimpl)
void starpu_perfmodel_print(struct starpu_perfmodel *model, enum starpu_perfmodel_archtype arch, unsigned nimpl, char *parameter, uint32_t *footprint, FILE *output)
Definition: starpu_perfmodel.h:126
double sum2
Definition: starpu_perfmodel.h:64
unsigned long minx
Definition: starpu_perfmodel.h:88
enum starpu_perfmodel_type type
Definition: starpu_perfmodel.h:132
Definition: starpu_perfmodel.h:130
starpu_perfmodel_archtype
Definition: starpu_perfmodel.h:35
struct starpu_perfmodel_history_list * list
Definition: starpu_perfmodel.h:114
double(* cost_model)(struct starpu_data_descr *)
Definition: starpu_perfmodel.h:134
size_t(* size_base)(struct starpu_task *, enum starpu_perfmodel_archtype arch, unsigned nimpl)
Definition: starpu_perfmodel.h:111
double starpu_transfer_latency(unsigned src_node, unsigned dst_node)
int starpu_perfmodel_load_symbol(const char *symbol, struct starpu_perfmodel *model)
unsigned long maxx
Definition: starpu_perfmodel.h:89
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:41
double a
Definition: starpu_perfmodel.h:97
Definition: starpu_perfmodel.h:81
unsigned nsample
Definition: starpu_perfmodel.h:100
Definition: starpu_perfmodel.h:124
double flops
Definition: starpu_perfmodel.h:72
double sumlnxlny
Definition: starpu_perfmodel.h:91
double alpha
Definition: starpu_perfmodel.h:93