starpu_perfmodel.h
Go to the documentation of this file.
/* StarPU --- Runtime system for heterogeneous multicore architectures.
*
* Copyright (C) 2009-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
* Copyright (C) 2011 Télécom-SudParis
* Copyright (C) 2013 Thibaut Lambert
*
* StarPU is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* StarPU is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU Lesser General Public License in COPYING.LGPL for more details.
*/
#ifndef __STARPU_PERFMODEL_H__
#define __STARPU_PERFMODEL_H__
#include <starpu.h>
#include <stdio.h>
#ifdef __cplusplus
extern "C"
{
#endif
struct starpu_task;
struct starpu_data_descr;
#define STARPU_NARCH STARPU_ANY_WORKER
struct starpu_perfmodel_device
{
enum starpu_worker_archtype type;
int devid;
int ncores;
};
struct starpu_perfmodel_arch
{
int ndevices;
struct starpu_perfmodel_device *devices;
};
struct starpu_perfmodel_history_entry
{
double mean;
double deviation;
double sum;
double sum2;
unsigned nsample;
unsigned nerror;
uint32_t footprint;
size_t size;
double flops;
double duration;
starpu_tag_t tag;
double *parameters;
};
struct starpu_perfmodel_history_list
{
struct starpu_perfmodel_history_list *next;
struct starpu_perfmodel_history_entry *entry;
};
struct starpu_perfmodel_regression_model
{
double sumlny;
double sumlnx;
double sumlnx2;
unsigned long minx;
unsigned long maxx;
double sumlnxlny;
double alpha;
double beta;
unsigned valid;
double a;
double b;
double c;
unsigned nl_valid;
unsigned nsample;
double *coeff;
unsigned ncoeff;
unsigned multi_valid;
};
struct starpu_perfmodel_history_table;
#define starpu_per_arch_perfmodel starpu_perfmodel_per_arch STARPU_DEPRECATED
typedef double (*starpu_perfmodel_per_arch_cost_function)(struct starpu_task *task, struct starpu_perfmodel_arch* arch, unsigned nimpl);
typedef size_t (*starpu_perfmodel_per_arch_size_base)(struct starpu_task *task, struct starpu_perfmodel_arch* arch, unsigned nimpl);
struct starpu_perfmodel_per_arch
{
starpu_perfmodel_per_arch_cost_function cost_function;
starpu_perfmodel_per_arch_size_base size_base;
struct starpu_perfmodel_history_table *history;
struct starpu_perfmodel_history_list *list;
struct starpu_perfmodel_regression_model regression;
char debug_path[256];
};
enum starpu_perfmodel_type
{
STARPU_PERFMODEL_INVALID=0,
STARPU_PER_ARCH,
STARPU_COMMON,
STARPU_HISTORY_BASED,
STARPU_REGRESSION_BASED,
STARPU_NL_REGRESSION_BASED,
STARPU_MULTIPLE_REGRESSION_BASED
};
struct _starpu_perfmodel_state;
typedef struct _starpu_perfmodel_state* starpu_perfmodel_state_t;
struct starpu_perfmodel
{
enum starpu_perfmodel_type type;
double (*cost_function)(struct starpu_task *, unsigned nimpl);
double (*arch_cost_function)(struct starpu_task *, struct starpu_perfmodel_arch * arch, unsigned nimpl);
size_t (*size_base)(struct starpu_task *, unsigned nimpl);
uint32_t (*footprint)(struct starpu_task *);
const char *symbol;
unsigned is_loaded;
unsigned benchmarking;
unsigned is_init;
void (*parameters)(struct starpu_task * task, double *parameters);
const char **parameters_names;
unsigned nparameters;
unsigned **combinations;
unsigned ncombinations;
starpu_perfmodel_state_t state;
};
void starpu_perfmodel_init(struct starpu_perfmodel *model);
int starpu_perfmodel_load_file(const char *filename, struct starpu_perfmodel *model);
int starpu_perfmodel_load_symbol(const char *symbol, struct starpu_perfmodel *model);
int starpu_perfmodel_unload_model(struct starpu_perfmodel *model);
void starpu_perfmodel_get_model_path(const char *symbol, char *path, size_t maxlen);
void starpu_perfmodel_dump_xml(FILE *output, struct starpu_perfmodel *model);
void starpu_perfmodel_free_sampling(void);
struct starpu_perfmodel_arch *starpu_worker_get_perf_archtype(int workerid, unsigned sched_ctx_id);
int starpu_perfmodel_get_narch_combs(void);
int starpu_perfmodel_arch_comb_add(int ndevices, struct starpu_perfmodel_device* devices);
int starpu_perfmodel_arch_comb_get(int ndevices, struct starpu_perfmodel_device *devices);
struct starpu_perfmodel_arch *starpu_perfmodel_arch_comb_fetch(int comb);
struct starpu_perfmodel_per_arch *starpu_perfmodel_get_model_per_arch(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, unsigned impl);
struct starpu_perfmodel_per_arch *starpu_perfmodel_get_model_per_devices(struct starpu_perfmodel *model, int impl, ...);
int starpu_perfmodel_set_per_devices_cost_function(struct starpu_perfmodel *model, int impl, starpu_perfmodel_per_arch_cost_function func, ...);
int starpu_perfmodel_set_per_devices_size_base(struct starpu_perfmodel *model, int impl, starpu_perfmodel_per_arch_size_base func, ...);
void starpu_perfmodel_debugfilepath(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, char *path, size_t maxlen, unsigned nimpl);
char* starpu_perfmodel_get_archtype_name(enum starpu_worker_archtype archtype);
void starpu_perfmodel_get_arch_name(struct starpu_perfmodel_arch *arch, char *archname, size_t maxlen, unsigned nimpl);
double starpu_perfmodel_history_based_expected_perf(struct starpu_perfmodel *model, struct starpu_perfmodel_arch* arch, uint32_t footprint);
void starpu_perfmodel_initialize(void);
int starpu_perfmodel_list(FILE *output);
void starpu_perfmodel_print(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, unsigned nimpl, char *parameter, uint32_t *footprint, FILE *output);
int starpu_perfmodel_print_all(struct starpu_perfmodel *model, char *arch, char *parameter, uint32_t *footprint, FILE *output);
int starpu_perfmodel_print_estimations(struct starpu_perfmodel *model, uint32_t footprint, FILE *output);
int starpu_perfmodel_list_combs(FILE *output, struct starpu_perfmodel *model);
void starpu_perfmodel_update_history(struct starpu_perfmodel *model, struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned cpuid, unsigned nimpl, double measured);
void starpu_perfmodel_directory(FILE *output);
void starpu_bus_print_bandwidth(FILE *f);
void starpu_bus_print_affinity(FILE *f);
void starpu_bus_print_filenames(FILE *f);
double starpu_transfer_bandwidth(unsigned src_node, unsigned dst_node);
double starpu_transfer_latency(unsigned src_node, unsigned dst_node);
double starpu_transfer_predict(unsigned src_node, unsigned dst_node, size_t size);
extern struct starpu_perfmodel starpu_perfmodel_nop;
#ifdef __cplusplus
}
#endif
#endif /* __STARPU_PERFMODEL_H__ */
starpu_data_descr
Definition: starpu_task.h:552
starpu_task
Definition: starpu_task.h:567
starpu_tag_t
uint64_t starpu_tag_t
Definition: starpu_task_dep.h:127
starpu_perfmodel_history_entry::sum2
double sum2
Definition: starpu_perfmodel.h:65
starpu_perfmodel::symbol
const char * symbol
Definition: starpu_perfmodel.h:255
starpu_perfmodel_per_arch::cost_function
starpu_perfmodel_per_arch_cost_function cost_function
Definition: starpu_perfmodel.h:132
starpu_perfmodel::cost_function
double(* cost_function)(struct starpu_task *, unsigned nimpl)
Definition: starpu_perfmodel.h:227
starpu_perfmodel_per_arch::regression
struct starpu_perfmodel_regression_model regression
Definition: starpu_perfmodel.h:157
starpu_perfmodel_per_arch::list
struct starpu_perfmodel_history_list * list
Definition: starpu_perfmodel.h:150
starpu_perfmodel_regression_model::valid
unsigned valid
Definition: starpu_perfmodel.h:100
starpu_perfmodel_history_entry::size
size_t size
Definition: starpu_perfmodel.h:69
starpu_perfmodel_history_entry::deviation
double deviation
Definition: starpu_perfmodel.h:63
starpu_perfmodel::ncombinations
unsigned ncombinations
Definition: starpu_perfmodel.h:294
starpu_perfmodel_arch::devices
struct starpu_perfmodel_device * devices
Definition: starpu_perfmodel.h:56
starpu_perfmodel::footprint
uint32_t(* footprint)(struct starpu_task *)
Definition: starpu_perfmodel.h:248
starpu_perfmodel::arch_cost_function
double(* arch_cost_function)(struct starpu_task *, struct starpu_perfmodel_arch *arch, unsigned nimpl)
Definition: starpu_perfmodel.h:233
starpu_perfmodel_regression_model::sumlnx2
double sumlnx2
Definition: starpu_perfmodel.h:91
starpu_perfmodel::combinations
unsigned ** combinations
Definition: starpu_perfmodel.h:288
starpu_perfmodel_device::ncores
int ncores
Definition: starpu_perfmodel.h:47
starpu_perfmodel_regression_model::ncoeff
unsigned ncoeff
Definition: starpu_perfmodel.h:110
starpu_perfmodel_device::devid
int devid
Definition: starpu_perfmodel.h:46
starpu_perfmodel_regression_model::minx
unsigned long minx
Definition: starpu_perfmodel.h:93
starpu_perfmodel_regression_model::sumlny
double sumlny
Definition: starpu_perfmodel.h:88
starpu_perfmodel::size_base
size_t(* size_base)(struct starpu_task *, unsigned nimpl)
Definition: starpu_perfmodel.h:241
starpu_perfmodel_history_entry::mean
double mean
Definition: starpu_perfmodel.h:62
starpu_perfmodel_regression_model::nl_valid
unsigned nl_valid
Definition: starpu_perfmodel.h:105
starpu_perfmodel_regression_model::sumlnxlny
double sumlnxlny
Definition: starpu_perfmodel.h:96
starpu_perfmodel::nparameters
unsigned nparameters
Definition: starpu_perfmodel.h:282
starpu_perfmodel_history_entry::nsample
unsigned nsample
Definition: starpu_perfmodel.h:66
starpu_perfmodel::parameters_names
const char ** parameters_names
Definition: starpu_perfmodel.h:277
starpu_perfmodel_regression_model::beta
double beta
Definition: starpu_perfmodel.h:99
starpu_perfmodel_per_arch::size_base
starpu_perfmodel_per_arch_size_base size_base
Definition: starpu_perfmodel.h:137
starpu_perfmodel_history_entry::sum
double sum
Definition: starpu_perfmodel.h:64
starpu_perfmodel_regression_model::a
double a
Definition: starpu_perfmodel.h:102
starpu_perfmodel_device::type
enum starpu_worker_archtype type
Definition: starpu_perfmodel.h:45
starpu_perfmodel_regression_model::c
double c
Definition: starpu_perfmodel.h:104
starpu_perfmodel_regression_model::sumlnx
double sumlnx
Definition: starpu_perfmodel.h:90
starpu_perfmodel_regression_model::nsample
unsigned nsample
Definition: starpu_perfmodel.h:107
starpu_perfmodel_regression_model::maxx
unsigned long maxx
Definition: starpu_perfmodel.h:94
starpu_perfmodel_history_entry::footprint
uint32_t footprint
Definition: starpu_perfmodel.h:68
starpu_perfmodel_arch::ndevices
int ndevices
Definition: starpu_perfmodel.h:55
starpu_perfmodel::is_loaded
unsigned is_loaded
Definition: starpu_perfmodel.h:261
starpu_perfmodel_per_arch::history
struct starpu_perfmodel_history_table * history
Definition: starpu_perfmodel.h:143
starpu_perfmodel_regression_model::multi_valid
unsigned multi_valid
Definition: starpu_perfmodel.h:111
starpu_perfmodel_regression_model::coeff
double * coeff
Definition: starpu_perfmodel.h:109
starpu_perfmodel_history_entry::flops
double flops
Definition: starpu_perfmodel.h:70
starpu_perfmodel_regression_model::b
double b
Definition: starpu_perfmodel.h:103
starpu_perfmodel_regression_model::alpha
double alpha
Definition: starpu_perfmodel.h:98
starpu_perfmodel::type
enum starpu_perfmodel_type type
Definition: starpu_perfmodel.h:221
starpu_perfmodel_history_based_expected_perf
double starpu_perfmodel_history_based_expected_perf(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, uint32_t footprint)
starpu_perfmodel_init
void starpu_perfmodel_init(struct starpu_perfmodel *model)
starpu_perfmodel_debugfilepath
void starpu_perfmodel_debugfilepath(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, char *path, size_t maxlen, unsigned nimpl)
starpu_perfmodel_get_model_path
void starpu_perfmodel_get_model_path(const char *symbol, char *path, size_t maxlen)
starpu_perfmodel_nop
struct starpu_perfmodel starpu_perfmodel_nop
starpu_perfmodel_load_symbol
int starpu_perfmodel_load_symbol(const char *symbol, struct starpu_perfmodel *model)
starpu_bus_print_affinity
void starpu_bus_print_affinity(FILE *f)
starpu_perfmodel_get_arch_name
void starpu_perfmodel_get_arch_name(struct starpu_perfmodel_arch *arch, char *archname, size_t maxlen, unsigned nimpl)
starpu_perfmodel_list
int starpu_perfmodel_list(FILE *output)
starpu_transfer_bandwidth
double starpu_transfer_bandwidth(unsigned src_node, unsigned dst_node)
starpu_transfer_latency
double starpu_transfer_latency(unsigned src_node, unsigned dst_node)
starpu_bus_print_filenames
void starpu_bus_print_filenames(FILE *f)
starpu_perfmodel_free_sampling
void starpu_perfmodel_free_sampling(void)
starpu_perfmodel_unload_model
int starpu_perfmodel_unload_model(struct starpu_perfmodel *model)
starpu_transfer_predict
double starpu_transfer_predict(unsigned src_node, unsigned dst_node, size_t size)
starpu_perfmodel_initialize
void starpu_perfmodel_initialize(void)
starpu_perfmodel_dump_xml
void starpu_perfmodel_dump_xml(FILE *output, struct starpu_perfmodel *model)
starpu_bus_print_bandwidth
void starpu_bus_print_bandwidth(FILE *f)
starpu_worker_get_perf_archtype
struct starpu_perfmodel_arch * starpu_worker_get_perf_archtype(int workerid, unsigned sched_ctx_id)
starpu_perfmodel_type
starpu_perfmodel_type
Definition: starpu_perfmodel.h:166
starpu_perfmodel_directory
void starpu_perfmodel_directory(FILE *output)
starpu_perfmodel_update_history
void starpu_perfmodel_update_history(struct starpu_perfmodel *model, struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned cpuid, unsigned nimpl, double measured)
starpu_perfmodel_load_file
int starpu_perfmodel_load_file(const char *filename, struct starpu_perfmodel *model)
STARPU_NL_REGRESSION_BASED
@ STARPU_NL_REGRESSION_BASED
Definition: starpu_perfmodel.h:172
STARPU_MULTIPLE_REGRESSION_BASED
@ STARPU_MULTIPLE_REGRESSION_BASED
Definition: starpu_perfmodel.h:173
STARPU_REGRESSION_BASED
@ STARPU_REGRESSION_BASED
Definition: starpu_perfmodel.h:171
STARPU_COMMON
@ STARPU_COMMON
Definition: starpu_perfmodel.h:169
STARPU_PER_ARCH
@ STARPU_PER_ARCH
Definition: starpu_perfmodel.h:168
STARPU_HISTORY_BASED
@ STARPU_HISTORY_BASED
Definition: starpu_perfmodel.h:170
starpu_perfmodel
Definition: starpu_perfmodel.h:189
starpu_perfmodel_arch
Definition: starpu_perfmodel.h:54
starpu_perfmodel_device
Definition: starpu_perfmodel.h:44
starpu_perfmodel_history_entry
Definition: starpu_perfmodel.h:61
starpu_perfmodel_history_list
Definition: starpu_perfmodel.h:78
starpu_perfmodel_per_arch
Definition: starpu_perfmodel.h:125
starpu_perfmodel_regression_model
Definition: starpu_perfmodel.h:87
starpu_worker_archtype
starpu_worker_archtype
Definition: starpu_worker.h:63
starpu.h