aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetIOHDF5
diff options
context:
space:
mode:
authorThomas Radke <tradke@aei.mpg.de>2005-10-05 10:01:00 +0000
committerThomas Radke <tradke@aei.mpg.de>2005-10-05 10:01:00 +0000
commit429744ced377b65d624d57187d410eb039314f87 (patch)
tree5341a4192d365f636c7bd37f815603393d0dc053 /Carpet/CarpetIOHDF5
parent5ec2fa35cd9a9f40b439ba152c9b31388e6835e7 (diff)
CarpetIOHDF5: implement "out_unchunked" option for individual variables to be output
Apart from setting the parameter IO::out_unchunked to choose the output mode for all variables, this can be overridden for individual variables in an option string appended to the variable's name in the IOHDF5::out_vars parameter. darcs-hash:20051005100152-776a0-9f6f2e4b691a46b12aefab555440625f39836aaf.gz
Diffstat (limited to 'Carpet/CarpetIOHDF5')
-rw-r--r--Carpet/CarpetIOHDF5/doc/documentation.tex18
-rw-r--r--Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc16
2 files changed, 28 insertions, 6 deletions
diff --git a/Carpet/CarpetIOHDF5/doc/documentation.tex b/Carpet/CarpetIOHDF5/doc/documentation.tex
index 28176c549..ef401153e 100644
--- a/Carpet/CarpetIOHDF5/doc/documentation.tex
+++ b/Carpet/CarpetIOHDF5/doc/documentation.tex
@@ -94,8 +94,9 @@ Parameters to control the \ThisThorn\ I/O method are:
all variables. Multiple names must be separated by whitespaces.
Each group/variable name can have an option string attached in which you
- can specify a different output frequency for that individual variable
- or a set of individual refinement levels to be output, e.g.
+ can specify a different output frequency for that individual variable,
+ a set of individual refinement levels to be output, or an individual
+ output mode, e.g.
\begin{verbatim}
IOHDF5::out_vars = "wavetoy::phi{ out_every = 4 refinement_levels = { 1 2 } }"
\end{verbatim}
@@ -152,9 +153,20 @@ for a global view on the data.
The default is to output distributed grid variables in parallel, each processor
writing a file
{\tt \textless varname\textgreater.file\_\textless processor ID\textgreater.h5}.
+The chunked/unchunked mode can also be set individually in a key/value
+option string (with the key {\tt out\_unchunked} and possible string values
+{\tt "true|false|yes|no"}) appended to a group/variable name in the
+{\tt out\_vars} parameter, eg.
+\begin{verbatim}
+ IOHDF5::out_vars = "wavetoy::phi{out_unchunked = 'true'} grid::coordinates"
+\end{verbatim}
+will cause the variable {\tt phi} to be output into a single unchunked file
+whereas other variables will still be output into separate chunked files
+(assuming the output mode is left to its default).
Grid scalars
and {\tt DISTRIB = CONST} grid arrays are always output as unchunked data
-on processor 0 only.\\
+on processor 0 only.
+
Parallel output in a parallel simulation will ensure maximum I/O
performance. Note that changing the output mode to serial I/O might only be
necessary if the data analysis and visualisation tools cannot deal with
diff --git a/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc b/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc
index bbace4a4b..74de7fe48 100644
--- a/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc
+++ b/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc
@@ -566,7 +566,12 @@ static int OutputVarAs (const cGH* const cctkGH, const char* const fullname,
}
// get the default I/O request for this variable
- ioRequest* request = IOUtil_DefaultIORequest (cctkGH, vindex, 1);
+ const CarpetIOHDF5GH *myGH =
+ (CarpetIOHDF5GH *) CCTK_GHExtension (cctkGH, CCTK_THORNSTRING);
+ ioRequest* request = myGH->requests[vindex];
+ if (not request) {
+ request = IOUtil_DefaultIORequest (cctkGH, vindex, 1);
+ }
// Get grid hierarchy extentsion from IOUtil
const ioGH * const iogh = (const ioGH *) CCTK_GHExtension (cctkGH, "IO");
@@ -574,12 +579,11 @@ static int OutputVarAs (const cGH* const cctkGH, const char* const fullname,
// Invent a file name
int ioproc = 0, nioprocs = 1;
- const CarpetIOHDF5GH *myGH =
- (CarpetIOHDF5GH *) CCTK_GHExtension (cctkGH, CCTK_THORNSTRING);
string filename;
filename.append (myGH->out_dir);
filename.append (alias);
if (not (CCTK_EQUALS (out_mode, "onefile") or
+ request->out_unchunked or
groupdata.disttype == CCTK_DISTRIB_CONSTANT or
dist::size() == 1)) {
char buffer[32];
@@ -654,6 +658,7 @@ static int OutputVarAs (const cGH* const cctkGH, const char* const fullname,
fullname, mglevel, reflevel);
}
if ((CCTK_EQUALS (out_mode, "onefile") and io_out_unchunked) or
+ request->out_unchunked or
groupdata.disttype == CCTK_DISTRIB_CONSTANT) {
WriteVarUnchunked (cctkGH, file, request, false);
} else if (CCTK_EQUALS (out_mode, "onefile")) {
@@ -662,6 +667,11 @@ static int OutputVarAs (const cGH* const cctkGH, const char* const fullname,
WriteVarChunkedParallel (cctkGH, file, request, false);
}
+ // free I/O request structure
+ if (request != myGH->requests[vindex]) {
+ IOUtil_FreeIORequest (&request);
+ }
+
// Close the file
if (file >= 0) {
HDF5_ERROR (H5Fclose (file));