|
@@ -462,16 +462,7 @@ void _starpu_get_perf_model_dir(char *path, size_t maxlen)
|
|
|
/* use the directory specified at configure time */
|
|
|
snprintf(path, maxlen, "%s", STARPU_PERF_MODEL_DIR);
|
|
|
#else
|
|
|
- const char *home_path = getenv("XDG_CACHE_HOME");
|
|
|
- if (!home_path)
|
|
|
- home_path = getenv("STARPU_HOME");
|
|
|
- if (!home_path)
|
|
|
- home_path = getenv("HOME");
|
|
|
- if (!home_path)
|
|
|
- home_path = getenv("USERPROFILE");
|
|
|
- if (!home_path)
|
|
|
- _STARPU_ERROR("couldn't find a home place to put starpu data\n");
|
|
|
- snprintf(path, maxlen, "%s/.starpu/sampling/", home_path);
|
|
|
+ snprintf(path, maxlen, "%s/.starpu/sampling/", _starpu_get_home_path());
|
|
|
#endif
|
|
|
}
|
|
|
|
|
@@ -508,93 +499,23 @@ void _starpu_create_sampling_directory_if_needed(void)
|
|
|
may not be safe: it is possible that the permission are
|
|
|
changed in between. Instead, we create it and check if
|
|
|
it already existed before */
|
|
|
- int ret;
|
|
|
- ret = _starpu_mkpath(perf_model_dir, S_IRWXU);
|
|
|
+ _starpu_mkpath_and_check(perf_model_dir, S_IRWXU);
|
|
|
|
|
|
- if (ret == -1)
|
|
|
- {
|
|
|
- if (errno != EEXIST) {
|
|
|
- fprintf(stderr,"Error making starpu directory %s:\n", perf_model_dir);
|
|
|
- perror("mkdir");
|
|
|
- STARPU_ASSERT(0);
|
|
|
- }
|
|
|
-
|
|
|
- /* make sure that it is actually a directory */
|
|
|
- struct stat sb;
|
|
|
- stat(perf_model_dir, &sb);
|
|
|
- if (!S_ISDIR(sb.st_mode)) {
|
|
|
- fprintf(stderr,"Error: %s is not a directory:\n", perf_model_dir);
|
|
|
- STARPU_ASSERT(0);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
/* Per-task performance models */
|
|
|
char perf_model_dir_codelets[256];
|
|
|
_starpu_get_perf_model_dir_codelets(perf_model_dir_codelets, 256);
|
|
|
-
|
|
|
- ret = _starpu_mkpath(perf_model_dir_codelets, S_IRWXU);
|
|
|
- if (ret == -1)
|
|
|
- {
|
|
|
- if (errno != EEXIST) {
|
|
|
- fprintf(stderr,"Error making starpu directory %s:\n", perf_model_dir);
|
|
|
- perror("mkdir");
|
|
|
- STARPU_ASSERT(0);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /* make sure that it is actually a directory */
|
|
|
- struct stat sb;
|
|
|
- stat(perf_model_dir_codelets, &sb);
|
|
|
- if (!S_ISDIR(sb.st_mode)) {
|
|
|
- fprintf(stderr,"Error: %s is not a directory:\n", perf_model_dir);
|
|
|
- STARPU_ASSERT(0);
|
|
|
- }
|
|
|
- }
|
|
|
+ _starpu_mkpath_and_check(perf_model_dir_codelets, S_IRWXU);
|
|
|
|
|
|
/* Performance of the memory subsystem */
|
|
|
char perf_model_dir_bus[256];
|
|
|
_starpu_get_perf_model_dir_bus(perf_model_dir_bus, 256);
|
|
|
-
|
|
|
- ret = _starpu_mkpath(perf_model_dir_bus, S_IRWXU);
|
|
|
- if (ret == -1)
|
|
|
- {
|
|
|
- if (errno != EEXIST) {
|
|
|
- fprintf(stderr,"Error making starpu directory %s:\n", perf_model_dir);
|
|
|
- perror("mkdir");
|
|
|
- STARPU_ASSERT(0);
|
|
|
- }
|
|
|
-
|
|
|
- /* make sure that it is actually a directory */
|
|
|
- struct stat sb;
|
|
|
- stat(perf_model_dir_bus, &sb);
|
|
|
- if (!S_ISDIR(sb.st_mode)) {
|
|
|
- fprintf(stderr,"Error: %s is not a directory:\n", perf_model_dir);
|
|
|
- STARPU_ASSERT(0);
|
|
|
- }
|
|
|
- }
|
|
|
+ _starpu_mkpath_and_check(perf_model_dir_bus, S_IRWXU);
|
|
|
|
|
|
/* Performance debug measurements */
|
|
|
char perf_model_dir_debug[256];
|
|
|
_starpu_get_perf_model_dir_debug(perf_model_dir_debug, 256);
|
|
|
-
|
|
|
- ret = _starpu_mkpath(perf_model_dir_debug, S_IRWXU);
|
|
|
- if (ret == -1)
|
|
|
- {
|
|
|
- if (errno != EEXIST) {
|
|
|
- fprintf(stderr,"Error making starpu directory %s:\n", perf_model_dir);
|
|
|
- perror("mkdir");
|
|
|
- STARPU_ASSERT(0);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /* make sure that it is actually a directory */
|
|
|
- struct stat sb;
|
|
|
- stat(perf_model_dir_debug, &sb);
|
|
|
- if (!S_ISDIR(sb.st_mode)) {
|
|
|
- fprintf(stderr,"Error: %s is not a directory:\n", perf_model_dir);
|
|
|
- STARPU_ASSERT(0);
|
|
|
- }
|
|
|
- }
|
|
|
+ _starpu_mkpath_and_check(perf_model_dir_debug, S_IRWXU);
|
|
|
|
|
|
directory_existence_was_tested = 1;
|
|
|
}
|