StarPU Handbook
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Performance Model

Data Structures

struct  starpu_perfmodel_device
struct  starpu_perfmodel_arch
struct  starpu_perfmodel
struct  starpu_perfmodel_regression_model
struct  starpu_perfmodel_per_arch
struct  starpu_perfmodel_history_list
struct  starpu_perfmodel_history_entry

Enumerations

enum  starpu_perfmodel_type {
  STARPU_PERFMODEL_INVALID, STARPU_PER_ARCH, STARPU_COMMON, STARPU_HISTORY_BASED,
  STARPU_REGRESSION_BASED, STARPU_NL_REGRESSION_BASED
}

Functions

void starpu_perfmodel_init (struct starpu_perfmodel *model)
void starpu_perfmodel_free_sampling_directories (void)
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_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)
struct starpu_perfmodel_archstarpu_worker_get_perf_archtype (int workerid, unsigned sched_ctx_id)
void starpu_perfmodel_initialize (void)
int starpu_perfmodel_list (FILE *output)
void starpu_perfmodel_directory (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)
void starpu_bus_print_bandwidth (FILE *f)
void starpu_bus_print_affinity (FILE *f)
void starpu_bus_print_filenames (FILE *f)
void starpu_perfmodel_update_history (struct starpu_perfmodel *model, struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned cpuid, unsigned nimpl, double measured)
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)
double starpu_perfmodel_history_based_expected_perf (struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, uint32_t footprint)

Detailed Description


Data Structure Documentation

struct starpu_perfmodel_device

todo

Data Fields
enum starpu_worker_archtype type is the type of the device
int devid is the identifier of the precise device
int ncores
struct starpu_perfmodel_arch

todo

Data Fields
int ndevices is the number of the devices for the given arch
struct starpu_perfmodel_device * devices is the list of the devices for the given arch
struct starpu_perfmodel

Contains all information about a performance model. At least the type and symbol fields have to be filled when defining a performance model for a codelet. For compatibility, make sure to initialize the whole structure to zero, either by using explicit memset, or by letting the compiler implicitly do it in e.g. static storage case. If not provided, other fields have to be zero.

Data Fields

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
starpu_perfmodel_state_t state

Field Documentation

enum starpu_perfmodel_type starpu_perfmodel::type

is the type of performance model

double(* starpu_perfmodel::cost_function)(struct starpu_task *, unsigned nimpl)

Used by STARPU_COMMON: takes a task and implementation number, and must return a task duration estimation in micro-seconds.

double(* starpu_perfmodel::arch_cost_function)(struct starpu_task *, struct starpu_perfmodel_arch *arch, unsigned nimpl)

Used by STARPU_COMMON: takes a task, an arch and implementation number, and must return a task duration estimation in micro-seconds on that arch.

size_t(* starpu_perfmodel::size_base)(struct starpu_task *, unsigned nimpl)

Used by STARPU_HISTORY_BASED, STARPU_REGRESSION_BASED and STARPU_NL_REGRESSION_BASED. If not NULL, takes a task and implementation number, and returns the size to be used as index to distinguish histories and as a base for regressions.

uint32_t(* starpu_perfmodel::footprint)(struct starpu_task *)

Used by STARPU_HISTORY_BASED. If not NULL, takes a task and returns the footprint to be used as index to distinguish histories. The default is to use the starpu_task_data_footprint function.

const char * starpu_perfmodel::symbol

is the symbol name for the performance model, which will be used as file name to store the model. It must be set otherwise the model will be ignored.

unsigned starpu_perfmodel::is_loaded

Whether the performance model is already loaded from the disk.

unsigned starpu_perfmodel::is_init

todo

struct starpu_perfmodel_regression_model

...

Data Fields
double sumlny sum of ln(measured)
double sumlnx sum of ln(size)
double sumlnx2 sum of ln(size)^2
unsigned long minx minimum size
unsigned long maxx maximum size
double sumlnxlny sum of ln(size)*ln(measured)
double alpha estimated = alpha * size ^ beta
double beta estimated = alpha * size ^ beta
unsigned valid whether the linear regression model is valid (i.e. enough measures)
double a estimated = a size ^b + c
double b estimated = a size ^b + c
double c estimated = a size ^b + c
unsigned nl_valid whether the non-linear regression model is valid (i.e. enough measures)
unsigned nsample number of sample values for non-linear regression
struct starpu_perfmodel_per_arch

contains information about the performance model of a given arch.

Data Fields
starpu_perfmodel_per_arch_cost_function cost_function Used by STARPU_PER_ARCH, must point to functions which take a task, the target arch and implementation number (as mere conveniency, since the array is already indexed by these), and must return a task duration estimation in micro-seconds.
starpu_perfmodel_per_arch_size_base size_base Same as in structure starpu_perfmodel, but per-arch, in case it depends on the architecture-specific implementation.
struct
starpu_perfmodel_history_table *
history The history of performance measurements.
struct
starpu_perfmodel_history_list *
list Used by STARPU_HISTORY_BASED and STARPU_NL_REGRESSION_BASED, records all execution history measures.
struct
starpu_perfmodel_regression_model
regression Used by STARPU_REGRESSION_BASED and STARPU_NL_REGRESSION_BASED, contains the estimated factors of the regression.
char debug_path
struct starpu_perfmodel_history_list

todo

Data Fields
struct
starpu_perfmodel_history_list *
next todo
struct
starpu_perfmodel_history_entry *
entry todo
struct starpu_perfmodel_history_entry

todo

Data Fields
double mean mean_n = 1/n sum
double deviation n dev_n = sum2 - 1/n (sum)^2
double sum sum of samples (in µs)
double sum2 sum of samples^2
unsigned nsample number of samples
unsigned nerror
uint32_t footprint data footprint
size_t size in bytes
double flops Provided by the application

Enumeration Type Documentation

TODO

Enumerator:
STARPU_PER_ARCH 

Application-provided per-arch cost model function

STARPU_COMMON 

Application-provided common cost model function, with per-arch factor

STARPU_HISTORY_BASED 

Automatic history-based cost model

STARPU_REGRESSION_BASED 

Automatic linear regression-based cost model (alpha * size ^ beta)

STARPU_NL_REGRESSION_BASED 

Automatic non-linear regression-based cost model (a * size ^ b + c)

Function Documentation

void starpu_perfmodel_init ( struct starpu_perfmodel model)

todo

void starpu_perfmodel_free_sampling_directories ( void  )

this function frees internal memory used for sampling directory management. It should only be called by an application which is not calling starpu_shutdown as this function already calls it. See for example tools/starpu_perfmodel_display.c.

int starpu_perfmodel_load_file ( const char *  filename,
struct starpu_perfmodel model 
)

loads the performance model found in the given file. The model structure has to be completely zero, and will be filled with the information stored in the given file.

int starpu_perfmodel_load_symbol ( const char *  symbol,
struct starpu_perfmodel model 
)

loads a given performance model. The model structure has to be completely zero, and will be filled with the information saved in $STARPU_HOME/.starpu. The function is intended to be used by external tools that should read the performance model files.

int starpu_perfmodel_unload_model ( struct starpu_perfmodel model)

unloads the given model which has been previously loaded through the function starpu_perfmodel_load_symbol()

void starpu_perfmodel_debugfilepath ( struct starpu_perfmodel model,
struct starpu_perfmodel_arch arch,
char *  path,
size_t  maxlen,
unsigned  nimpl 
)

returns the path to the debugging information for the performance model.

char * starpu_perfmodel_get_archtype_name ( enum starpu_worker_archtype  archtype)

todo

void starpu_perfmodel_get_arch_name ( struct starpu_perfmodel_arch arch,
char *  archname,
size_t  maxlen,
unsigned  nimpl 
)

returns the architecture name for arch

struct starpu_perfmodel_arch * starpu_worker_get_perf_archtype ( int  workerid,
unsigned  sched_ctx_id 
)
read

returns the architecture type of a given worker.

void starpu_perfmodel_initialize ( void  )

If starpu_init is not used, starpu_perfmodel_initialize should be used before calling starpu_perfmodel_* functions.

int starpu_perfmodel_list ( FILE *  output)

prints a list of all performance models on output

void starpu_perfmodel_directory ( FILE *  output)

prints the directory name storing performance models on output

void starpu_perfmodel_print ( struct starpu_perfmodel model,
struct starpu_perfmodel_arch arch,
unsigned  nimpl,
char *  parameter,
uint32_t *  footprint,
FILE *  output 
)

todo

int starpu_perfmodel_print_all ( struct starpu_perfmodel model,
char *  arch,
char *  parameter,
uint32_t *  footprint,
FILE *  output 
)

todo

int starpu_perfmodel_print_estimations ( struct starpu_perfmodel model,
uint32_t  footprint,
FILE *  output 
)

todo

void starpu_bus_print_bandwidth ( FILE *  f)

prints a matrix of bus bandwidths on f.

void starpu_bus_print_affinity ( FILE *  f)

prints the affinity devices on f.

void starpu_bus_print_filenames ( FILE *  f)

prints on f the name of the files containing the matrix of bus bandwidths, the affinity devices and the latency.

void starpu_perfmodel_update_history ( struct starpu_perfmodel model,
struct starpu_task task,
struct starpu_perfmodel_arch arch,
unsigned  cpuid,
unsigned  nimpl,
double  measured 
)

This feeds the performance model model with an explicit measurement measured (in µs), in addition to measurements done by StarPU itself. This can be useful when the application already has an existing set of measurements done in good conditions, that StarPU could benefit from instead of doing on-line measurements. And example of use can be seen in Performance Model Example.

double starpu_transfer_bandwidth ( unsigned  src_node,
unsigned  dst_node 
)

Return the bandwidth of data transfer between two memory nodes

double starpu_transfer_latency ( unsigned  src_node,
unsigned  dst_node 
)

Return the latency of data transfer between two memory nodes

double starpu_transfer_predict ( unsigned  src_node,
unsigned  dst_node,
size_t  size 
)

Return the estimated time to transfer a given size between two memory nodes.

double starpu_perfmodel_history_based_expected_perf ( struct starpu_perfmodel model,
struct starpu_perfmodel_arch arch,
uint32_t  footprint 
)

Return the estimated time of a task whose model is named and whose footprint is footprint