aboutsummaryrefslogtreecommitdiff
path: root/Carpet/LoopControl
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2013-03-14 10:00:03 -0400
committerErik Schnetter <schnetter@gmail.com>2013-03-14 10:00:03 -0400
commit3fa30e248e3cd8e9bb2fc7aee4b07040be7b6df1 (patch)
treee60098a1307fda5f1c6c1afb67686cbb8566c251 /Carpet/LoopControl
parentdd002d5066c6e4ef3c14d0a0793bd58c95366d43 (diff)
LoopControl: Output statistics into per-process files, not into a single file
Diffstat (limited to 'Carpet/LoopControl')
-rw-r--r--Carpet/LoopControl/param.ccl2
-rw-r--r--Carpet/LoopControl/src/loopcontrol.cc12
2 files changed, 9 insertions, 5 deletions
diff --git a/Carpet/LoopControl/param.ccl b/Carpet/LoopControl/param.ccl
index 42246a6af..acb46857d 100644
--- a/Carpet/LoopControl/param.ccl
+++ b/Carpet/LoopControl/param.ccl
@@ -16,7 +16,7 @@ STRING statistics_filename "File name for LoopControl statistics" STEERABLE=alwa
{
"" :: "disable statistics output"
".+" :: "file name"
-} "LoopControl-statistics.txt"
+} "LoopControl-statistics"
SHARES: IO
diff --git a/Carpet/LoopControl/src/loopcontrol.cc b/Carpet/LoopControl/src/loopcontrol.cc
index 9d9a30130..2a9615607 100644
--- a/Carpet/LoopControl/src/loopcontrol.cc
+++ b/Carpet/LoopControl/src/loopcontrol.cc
@@ -16,6 +16,8 @@
#include <string>
#include <vector>
+#include <unistd.h>
+
#ifdef _OPENMP
# include <omp.h>
#else
@@ -804,8 +806,10 @@ void lc_statistics(CCTK_ARGUMENTS)
if (strlen(statistics_filename) == 0) return;
- string const filename = string(out_dir) + "/" + statistics_filename;
- FILE *const statsfile = fopen(filename.c_str(), "a");
+ char filename[10000];
+ snprintf(filename, sizeof filename,
+ "%s/%s.%06d.txt", out_dir, statistics_filename, CCTK_MyProc(cctkGH));
+ FILE *const statsfile = fopen(filename, "a");
fprintf(statsfile, "\n");
fprintf(statsfile, "LoopControl statistics:\n");
@@ -823,8 +827,8 @@ void lc_statistics(CCTK_ARGUMENTS)
stats->sum * stats->threads / (stats->count * stats->points);
fprintf(statsfile,
" Loop %s (%s:%d): count=%g, avg/thread=%g s, avg/point=%g s\n",
- stats->name.c_str(), stats->file.c_str(), stats->line,
- stats->count, avg_thread, avg_point);
+ stats->name.c_str(), stats->file.c_str(), stats->line,
+ stats->count, avg_thread, avg_point);
}
}
fclose(statsfile);