| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 | /* * This file is part of the StarPU Handbook. * Copyright (C) 2009--2011  Universit@'e de Bordeaux 1 * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique * Copyright (C) 2011, 2012 Institut National de Recherche en Informatique et Automatique * See the file version.doxy for copying conditions. *//*! \defgroup API_Performance_Model Performance Model\enum starpu_perfmodel_archtype\ingroup API_Performance_ModelEnumerates the various types of architectures.it is possible that we have multiple versions of the same kind ofworkers, for instance multiple GPUs or even different CPUs withinthe same machine so we do not use the archtype enum type directlyfor performance models.<ul><li> CPU types range within ::STARPU_CPU_DEFAULT (1 CPU),::STARPU_CPU_DEFAULT+1 (2 CPUs), ... ::STARPU_CPU_DEFAULT +STARPU_MAXCPUS - 1 (STARPU_MAXCPUS CPUs).</li><li> CUDA types range within ::STARPU_CUDA_DEFAULT (GPU number 0),::STARPU_CUDA_DEFAULT + 1 (GPU number 1), ..., ::STARPU_CUDA_DEFAULT +STARPU_MAXCUDADEVS - 1 (GPU number STARPU_MAXCUDADEVS - 1).</li><li> OpenCL types range within ::STARPU_OPENCL_DEFAULT (GPU number0), ::STARPU_OPENCL_DEFAULT + 1 (GPU number 1), ...,::STARPU_OPENCL_DEFAULT + STARPU_MAXOPENCLDEVS - 1 (GPU numberSTARPU_MAXOPENCLDEVS - 1).</ul>\var starpu_perfmodel_archtype::STARPU_CPU_DEFAULT\ingroup API_Performance_ModelCPU combined workers between 0 and STARPU_MAXCPUS-1\var starpu_perfmodel_archtype::STARPU_CUDA_DEFAULT\ingroup API_Performance_ModelCUDA workers\var starpu_perfmodel_archtype::STARPU_OPENCL_DEFAULT\ingroup API_Performance_ModelOpenCL workers\var starpu_perfmodel_archtype::STARPU_MIC_DEFAULT\ingroup API_Performance_ModelMIC workers\var starpu_perfmodel_archtype::STARPU_SCC_DEFAULT\ingroup API_Performance_ModelSCC workers\enum starpu_perfmodel_type\ingroup API_Performance_ModelTODO\var starpu_perfmodel_type::STARPU_PER_ARCH\ingroup API_Performance_ModelApplication-provided per-arch cost model function\var starpu_perfmodel_type::STARPU_COMMON\ingroup API_Performance_ModelApplication-provided common cost model function, with per-arch factor\var starpu_perfmodel_type::STARPU_HISTORY_BASED\ingroup API_Performance_ModelAutomatic history-based cost model\var starpu_perfmodel_type::STARPU_REGRESSION_BASED\ingroup API_Performance_ModelAutomatic linear regression-based cost model  (alpha * size ^ beta)\var starpu_perfmodel_type::STARPU_NL_REGRESSION_BASED\ingroup API_Performance_ModelAutomatic non-linear regression-based cost model (a * size ^ b + c)\struct starpu_perfmodelContains all information about a performance model. At least thetype and symbol fields have to be filled when defining a performancemodel for a codelet. For compatibility, make sure to initialize thewhole structure to zero, either by using explicit memset, or byletting the compiler implicitly do it in e.g. static storage case. Ifnot provided, other fields have to be zero.\ingroup API_Performance_Model\var starpu_perfmodel::typeis the type of performance model<ul><li>::STARPU_HISTORY_BASED, ::STARPU_REGRESSION_BASED,::STARPU_NL_REGRESSION_BASED: No other fields needs to be provided,this is purely history-based.</li><li> ::STARPU_PER_ARCH: field starpu_perfmodel::per_arch has to befilled with functions which return the cost in micro-seconds.</li><li> ::STARPU_COMMON: field starpu_perfmodel::cost_function has to befilled with a function that returns the cost in micro-seconds on aCPU, timing on other archs will be determined by multiplying by anarch-specific factor.</li></ul>\var starpu_perfmodel::symbolis the symbol name for the performance model, which will be used asfile name to store the model. It must be set otherwise the model willbe ignored.\var starpu_perfmodel::cost_model\deprecatedThis field is deprecated. Use instead the field starpu_perfmodel::cost_function field.\var starpu_perfmodel::cost_functionUsed by ::STARPU_COMMON: takes a task and implementation number, andmust return a task duration estimation in micro-seconds.\var starpu_perfmodel::size_baseUsed by ::STARPU_HISTORY_BASED, ::STARPU_REGRESSION_BASED and::STARPU_NL_REGRESSION_BASED. If not NULL, takes a task andimplementation number, and returns the size to be used as index forhistory and regression.\var starpu_perfmodel::per_archUsed by ::STARPU_PER_ARCH: array of structures starpu_per_arch_perfmodel\var starpu_perfmodel::is_loaded\privateWhether the performance model is already loaded from the disk.\var starpu_perfmodel::benchmarking\privateWhether the performance model is still being calibrated.\var starpu_perfmodel::model_rwlock\privateLock to protect concurrency between loading from disk (W), updatingthe values (W), and making a performance estimation (R).\struct starpu_perfmodel_regression_model...\ingroup API_Performance_Model\var starpu_perfmodel_regression_model::sumlnysum of ln(measured)\var starpu_perfmodel_regression_model::sumlnxsum of ln(size)\var starpu_perfmodel_regression_model::sumlnx2sum of ln(size)^2\var starpu_perfmodel_regression_model::minxminimum size\var starpu_perfmodel_regression_model::maxxmaximum size\var starpu_perfmodel_regression_model::sumlnxlnysum of ln(size)*ln(measured)\var starpu_perfmodel_regression_model::alphaestimated = alpha * size ^ beta\var starpu_perfmodel_regression_model::betaestimated = alpha * size ^ beta\var starpu_perfmodel_regression_model::validwhether the linear regression model is valid (i.e. enough measures)\var starpu_perfmodel_regression_model::aestimated = a size ^b + c\var starpu_perfmodel_regression_model::bestimated = a size ^b + c\var starpu_perfmodel_regression_model::cestimated = a size ^b + c\var starpu_perfmodel_regression_model::nl_validwhether the non-linear regression model is valid (i.e. enough measures)\var starpu_perfmodel_regression_model::nsamplenumber of sample values for non-linear regression\struct starpu_perfmodel_per_archcontains information about the performance model of a givenarch.\ingroup API_Performance_Model\var starpu_perfmodel_per_arch::cost_model\deprecatedThis field is deprecated. Use instead the fieldstarpu_perfmodel_per_arch::cost_function.\var starpu_perfmodel_per_arch::cost_functionUsed by ::STARPU_PER_ARCH, must point to functions which take a task,the target arch and implementation number (as mere conveniency, sincethe array is already indexed by these), and must return a taskduration estimation in micro-seconds.\var starpu_perfmodel_per_arch::size_baseSame as in structure starpu_perfmodel, but per-arch, in case itdepends on the architecture-specific implementation.\var starpu_perfmodel_per_arch::history\privateThe history of performance measurements.\var starpu_perfmodel_per_arch::list\privateUsed by ::STARPU_HISTORY_BASED and ::STARPU_NL_REGRESSION_BASED,records all execution history measures.\var starpu_perfmodel_per_arch::regression\privateUsed by ::STARPU_REGRESSION_BASED and::STARPU_NL_REGRESSION_BASED, contains the estimated factors of theregression.\struct starpu_perfmodel_history_listtodo\ingroup API_Performance_Model\var starpu_perfmodel_history_list::nexttodo\var starpu_perfmodel_history_list::entrytodo\struct starpu_perfmodel_history_entrytodo\ingroup API_Performance_Model\var starpu_perfmodel_history_entry::meanmean_n = 1/n sum\var starpu_perfmodel_history_entry::deviationn dev_n = sum2 - 1/n (sum)^2\var starpu_perfmodel_history_entry::sumsum of samples (in µs)\var starpu_perfmodel_history_entry::sum2sum of samples^2\var starpu_perfmodel_history_entry::nsamplenumber of samples\var starpu_perfmodel_history_entry::footprintdata footprint\var starpu_perfmodel_history_entry::sizein bytes\var starpu_perfmodel_history_entry::flopsProvided by the application\fn int starpu_perfmodel_load_symbol(const char *symbol, struct starpu_perfmodel *model)\ingroup API_Performance_Modelloads a given performance model. The model structure has to becompletely zero, and will be filled with the information saved in<c>$STARPU_HOME/.starpu</c>. The function is intended to be used byexternal tools that should read the performance model files.\fn int starpu_perfmodel_unload_model(struct starpu_perfmodel *model)\ingroup API_Performance_Modelunloads the given model which has been previously loadedthrough the function starpu_perfmodel_load_symbol()\fn void starpu_perfmodel_debugfilepath(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, char *path, size_t maxlen, unsigned nimpl)\ingroup API_Performance_Modelreturns the path to the debugging information for the performance model.\fn void starpu_perfmodel_get_arch_name(struct starpu_perfmodel_arch *arch, char *archname, size_t maxlen, unsigned nimpl)\ingroup API_Performance_Modelreturns the architecture name for \p arch\fn struct starpu_perfmodel_arch *starpu_worker_get_perf_archtype(int workerid)\ingroup API_Performance_Modelreturns the architecture type of a given worker.\fn int starpu_perfmodel_list(FILE *output)\ingroup API_Performance_Modelprints a list of all performance models on \p output\fn void starpu_perfmodel_directory(FILE *output)\ingroup API_Performance_Modelprints the directory name storing performance models on \p output\fn void starpu_perfmodel_print(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, unsigned nimpl, char *parameter, uint32_t *footprint, FILE *output)\ingroup API_Performance_Modeltodo\fn int starpu_perfmodel_print_all(struct starpu_perfmodel *model, char *arch, char *parameter, uint32_t *footprint, FILE *output)\ingroup API_Performance_Modeltodo\fn void starpu_bus_print_bandwidth(FILE *f)\ingroup API_Performance_Modelprints a matrix of bus bandwidths on \p f.\fn void starpu_bus_print_affinity(FILE *f)\ingroup API_Performance_Modelprints the affinity devices on \p f.\fn void starpu_perfmodel_update_history(struct starpu_perfmodel *model, struct starpu_task *task, struct starpu_perfmodel_arch *arch, unsigned cpuid, unsigned nimpl, double measured);\ingroup API_Performance_ModelThis feeds the performance model model with an explicitmeasurement measured (in µs), in addition to measurements done by StarPUitself. This can be useful when the application already has anexisting set of measurements done in good conditions, that StarPUcould benefit from instead of doing on-line measurements. And exampleof use can be seen in \ref PerformanceModelExample.\fn double starpu_transfer_bandwidth(unsigned src_node, unsigned dst_node)\ingroup API_Performance_ModelReturn the bandwidth of data transfer between two memory nodes\fn double starpu_transfer_latency(unsigned src_node, unsigned dst_node)\ingroup API_Performance_ModelReturn the latency of data transfer between two memory nodes\fn double starpu_transfer_predict(unsigned src_node, unsigned dst_node, size_t size)\ingroup API_Performance_ModelReturn the estimated time to transfer a given size between two memory nodes.*/
 |