StarPU Internal Handbook
perfmodel.h
Go to the documentation of this file.
1 /* StarPU --- Runtime system for heterogeneous multicore architectures.
2  *
3  * Copyright (C) 2008-2020 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 __PERFMODEL_H__
20 #define __PERFMODEL_H__
21 
24 #include <common/config.h>
25 #include <starpu.h>
26 #include <core/task_bundle.h>
27 #include <stdio.h>
28 
29 #ifdef __cplusplus
30 extern "C"
31 {
32 #endif
33 
43 #define _STARPU_PERFMODEL_VERSION 45
44 
46 {
47  struct starpu_perfmodel_per_arch** per_arch; /*STARPU_MAXIMPLEMENTATIONS*/
48  int** per_arch_is_set; /*STARPU_MAXIMPLEMENTATIONS*/
49 
50  starpu_pthread_rwlock_t model_rwlock;
51  int *nimpls;
52  int *nimpls_set;
53  int ncombs; /* The number of combinations currently used by the model */
54  int ncombs_set; /* The number of combinations allocated in the array nimpls and ncombs */
55  int *combs;
56 };
57 
58 struct starpu_data_descr;
59 struct _starpu_job;
60 struct starpu_perfmodel_arch;
61 
62 extern unsigned _starpu_calibration_minimum;
63 
64 char *_starpu_get_perf_model_dir_codelet();
65 char *_starpu_get_perf_model_dir_bus();
66 char *_starpu_get_perf_model_dir_debug();
67 
68 double _starpu_history_based_job_expected_perf(struct starpu_perfmodel *model, struct starpu_perfmodel_arch* arch, struct _starpu_job *j, unsigned nimpl);
69 void _starpu_load_history_based_model(struct starpu_perfmodel *model, unsigned scan_history);
70 void _starpu_init_and_load_perfmodel(struct starpu_perfmodel *model);
71 void _starpu_initialize_registered_performance_models(void);
72 void _starpu_deinitialize_registered_performance_models(void);
73 void _starpu_deinitialize_performance_model(struct starpu_perfmodel *model);
74 
75 double _starpu_regression_based_job_expected_perf(struct starpu_perfmodel *model,
76  struct starpu_perfmodel_arch* arch, struct _starpu_job *j, unsigned nimpl);
77 double _starpu_non_linear_regression_based_job_expected_perf(struct starpu_perfmodel *model,
78  struct starpu_perfmodel_arch* arch, struct _starpu_job *j, unsigned nimpl);
79 double _starpu_multiple_regression_based_job_expected_perf(struct starpu_perfmodel *model, struct starpu_perfmodel_arch* arch,
80  struct _starpu_job *j, unsigned nimpl);
81 void _starpu_update_perfmodel_history(struct _starpu_job *j, struct starpu_perfmodel *model, struct starpu_perfmodel_arch * arch,
82  unsigned cpuid, double measured, unsigned nimpl);
83 int _starpu_perfmodel_create_comb_if_needed(struct starpu_perfmodel_arch* arch);
84 
85 void _starpu_create_sampling_directory_if_needed(void);
86 
87 void _starpu_load_bus_performance_files(void);
88 
89 void _starpu_set_calibrate_flag(unsigned val);
90 unsigned _starpu_get_calibrate_flag(void);
91 
92 #if defined(STARPU_USE_CUDA)
93 unsigned *_starpu_get_cuda_affinity_vector(unsigned gpuid);
94 #endif
95 #if defined(STARPU_USE_OPENCL)
96 unsigned *_starpu_get_opencl_affinity_vector(unsigned gpuid);
97 #endif
98 
99 void _starpu_save_bandwidth_and_latency_disk(double bandwidth_write, double bandwidth_read,
100  double latency_write, double latency_read, unsigned node, const char *name);
101 
102 void _starpu_write_double(FILE *f, const char *format, double val);
103 int _starpu_read_double(FILE *f, char *format, double *val);
104 void _starpu_simgrid_get_platform_path(int version, char *path, size_t maxlen);
105 
106 void _starpu_perfmodel_realloc(struct starpu_perfmodel *model, int nb);
107 
108 void _starpu_free_arch_combs(void);
109 
110 #if defined(STARPU_HAVE_HWLOC)
111 hwloc_topology_t _starpu_perfmodel_get_hwtopology();
112 #endif
113 
114 #ifdef __cplusplus
115 }
116 #endif
117 
118 #endif // __PERFMODEL_H__
_starpu_perfmodel_state
Definition: perfmodel.h:46
task_bundle.h
_starpu_job
Definition: jobs.h:79