| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 | /* StarPU --- Runtime system for heterogeneous multicore architectures. * * Copyright (C) 2010-2014  Université de Bordeaux 1 * Copyright (C) 2010, 2011, 2012, 2013, 2014  Centre National de la Recherche Scientifique * Copyright (C) 2011  Télécom-SudParis * * 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>#include <starpu_util.h>#include <starpu_worker.h>#ifdef __cplusplusextern "C"{#endifstruct starpu_task;struct starpu_data_descr;#define STARPU_NARCH STARPU_ANY_WORKERstruct starpu_perfmodel_device{	enum starpu_worker_archtype type;	int devid;	/* identifier of the precise device */	int ncores;	/* number of execution in parallel, minus 1 */	};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;#ifdef STARPU_HAVE_WINDOWS	unsigned size;#else	size_t size;#endif	double flops;};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, b, c;	unsigned nl_valid;	unsigned nsample;};struct starpu_perfmodel_history_table;#define starpu_per_arch_perfmodel starpu_perfmodel_per_arch STARPU_DEPRECATEDtypedef 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;#ifdef STARPU_MODEL_DEBUG	char debug_path[256];#endif};enum starpu_perfmodel_type{        STARPU_PERFMODEL_INVALID=0,	STARPU_PER_ARCH,	STARPU_COMMON,	STARPU_HISTORY_BASED,	STARPU_REGRESSION_BASED,	STARPU_NL_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);	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;};void starpu_perfmodel_init(FILE *f, struct starpu_perfmodel *model);//void starpu_perfmodel_init_with_file(FILE*f, struct starpu_perfmodel *model);struct starpu_perfmodel_arch *starpu_worker_get_perf_archtype(int workerid, unsigned sched_ctx_id);int starpu_perfmodel_load_symbol(const char *symbol, struct starpu_perfmodel *model);int starpu_perfmodel_unload_model(struct starpu_perfmodel *model);int starpu_get_narch_combs();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_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_permodel_history_based_expected_perf(struct starpu_perfmodel *model, struct starpu_perfmodel_arch* arch, uint32_t footprint);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_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);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);#ifdef __cplusplus}#endif#endif /* __STARPU_PERFMODEL_H__ */
 |