Skip to content

Commit

Permalink
When defined the variable STARPU_PERF_MODEL_DIR will be used to dump …
Browse files Browse the repository at this point in the history
…perfmodel files.
  • Loading branch information
nfurmento committed Oct 16, 2024
1 parent 893af0e commit 6b9b6ea
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Changes:

Small changes:
* Fix build system for StarPU Python interface
* When defined the variable STARPU_PERF_MODEL_DIR will be used to
dump perfmodel files.

New features:
* Add starpu_data_register_victim_selector to let schedulers select eviction
Expand Down
11 changes: 11 additions & 0 deletions doc/doxygen/chapters/starpu_basics/starpu_applications.doxy
Original file line number Diff line number Diff line change
Expand Up @@ -441,4 +441,15 @@ mv $HOME/.starpu/sampling /usr/local/starpu/sampling
STARPU_PERF_MODEL_DIR=/usr/local/starpu/sampling ./application
\endverbatim

When defined the variable \ref STARPU_PERF_MODEL_DIR will be used to
dump perfmodel files. The application will read bus performance files
and codelet performance files from <c>$HOME/.starpu</c> when
available, and will write in the directory \ref STARPU_PERF_MODEL_DIR.

\verbatim
$ STARPU_PERF_MODEL_DIR=$(mktemp -d) STARPU_SCHED=dmda STARPU_CALIBRATE=1 ./examples/cholesky/cholesky_implicit
...
[starpu][starpu_save_history_based_model] Going to write performance model in file </tmp/tmp.wZSizZncuU/codelets/45/chol_model_potrf.vesubie> for model <chol_model_potrf>
\endverbatim

*/
9 changes: 5 additions & 4 deletions src/core/perfmodel/perfmodel.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#endif

static int _starpu_expected_transfer_time_writeback;
char *_starpu_perf_model_dir = NULL;

void _starpu_init_perfmodel(void)
{
Expand Down Expand Up @@ -772,10 +773,10 @@ void _starpu_set_perf_model_dirs()
{
if (_perf_model_paths_nb != 0) return;

char *env = starpu_getenv("STARPU_PERF_MODEL_DIR");
if (env)
_starpu_perf_model_dir = starpu_getenv("STARPU_PERF_MODEL_DIR");
if (_starpu_perf_model_dir)
{
_perf_model_add_dir(env, 0, "by variable STARPU_PERF_MODEL_DIR");
_perf_model_add_dir(_starpu_perf_model_dir, 0, "by variable STARPU_PERF_MODEL_DIR");
}

#ifdef STARPU_PERF_MODEL_DIR
Expand All @@ -786,7 +787,7 @@ void _starpu_set_perf_model_dirs()
_perf_model_add_dir(home, 0, "by STARPU_HOME directory");
#endif

env = starpu_getenv("STARPU_PERF_MODEL_PATH");
char *env = starpu_getenv("STARPU_PERF_MODEL_PATH");
if (env)
{
char *saveptr, *token;
Expand Down
1 change: 1 addition & 0 deletions src/core/perfmodel/perfmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ struct starpu_perfmodel_arch;

extern unsigned _starpu_calibration_minimum;
extern int _starpu_benchmarking_bus;
extern char *_starpu_perf_model_dir;

void _starpu_find_perf_model_codelet(const char *symbol, const char *hostname, char *path, size_t maxlen);
void _starpu_find_perf_model_codelet_debug(const char *symbol, const char *hostname, const char *arch, char *path, size_t maxlen);
Expand Down
6 changes: 4 additions & 2 deletions src/core/perfmodel/perfmodel_history.c
Original file line number Diff line number Diff line change
Expand Up @@ -1236,12 +1236,14 @@ void starpu_save_history_based_model(struct starpu_perfmodel *model)
char path[STR_LONG_LENGTH];
starpu_perfmodel_get_model_path(model->symbol, path, sizeof(path));

if (path[0] == '\0')
if (path[0] == '\0' || _starpu_perf_model_dir)
{
starpu_perfmodel_get_model_path_default_location(model->symbol, path, sizeof(path));
}

free(model->path);
model->path = strdup(path);
_STARPU_DEBUG("Opening performance model file <%s> for model <%s>\n", path, model->symbol);
_STARPU_DEBUG("Going to write performance model in file <%s> for model <%s>\n", path, model->symbol);

/* overwrite existing file, or create it */
FILE *f;
Expand Down

0 comments on commit 6b9b6ea

Please sign in to comment.