From e961965209efcaa0c7a227b946d7145e6eef79d4 Mon Sep 17 00:00:00 2001 From: tradke Date: Wed, 9 Jun 2004 10:42:16 +0000 Subject: After setup, do an initial I/O parameter parsing and warn/stop on parsing errors (depending on IO::strict_io_parameter_check). You will also need to update CactusBase/IOUtil. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOStreamedHDF5/trunk@107 0888f3d4-9f52-45d2-93bc-d00801ff5e46 --- src/Output.c | 43 +++++++++++++++++++------------------------ src/Startup.c | 17 +++++++++++++---- src/ioStreamedHDF5GH.h | 6 ++++++ 3 files changed, 38 insertions(+), 28 deletions(-) diff --git a/src/Output.c b/src/Output.c index 58b29bb..5e3374d 100644 --- a/src/Output.c +++ b/src/Output.c @@ -22,12 +22,6 @@ static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusPUGHIO_IOStreamedHDF5_Output_c) -/******************************************************************** - ******************** Internal Routines ************************ - ********************************************************************/ -static void CheckSteerableParameters (const cGH *GH); - - /*@@ @routine IOStreamedHDF5_OutputGH @date Sat March 6 1999 @@ -58,7 +52,7 @@ int IOStreamedHDF5_OutputGH (const cGH *GH) retval = 0; - myGH = (const ioStreamedHDF5GH *) CCTK_GHExtension (GH, "IOStreamedHDF5"); + myGH = CCTK_GHExtension (GH, "IOStreamedHDF5"); /* loop over all variables */ for (vindex = CCTK_NumVars () - 1; vindex >= 0; vindex--) @@ -141,7 +135,7 @@ int IOStreamedHDF5_OutputVarAs (const cGH *GH, const char *fullname, using the IOStreamedHDF5 I/O method. @enddesc - @calls CheckSteerableParameters + @calls IOStreamedHDF5_CheckSteerableParameters @var GH @vdesc Pointer to CCTK GH @@ -164,13 +158,13 @@ int IOStreamedHDF5_TimeFor (const cGH *GH, int vindex) { int retval; char *fullname; - const ioStreamedHDF5GH *myGH; + ioStreamedHDF5GH *myGH; - CheckSteerableParameters (GH); + myGH = CCTK_GHExtension (GH, "IOStreamedHDF5"); + IOStreamedHDF5_CheckSteerableParameters (GH, myGH); /* check if this variable should be output */ - myGH = (const ioStreamedHDF5GH *) CCTK_GHExtension (GH, "IOStreamedHDF5"); retval = myGH->requests[vindex] && myGH->requests[vindex]->out_every > 0 && GH->cctk_iteration % myGH->requests[vindex]->out_every == 0; if (retval) @@ -229,7 +223,7 @@ int IOStreamedHDF5_TriggerOutput (const cGH *GH, int vindex) varname = CCTK_VarName (vindex); - myGH = (ioStreamedHDF5GH *) CCTK_GHExtension (GH, "IOStreamedHDF5"); + myGH = CCTK_GHExtension (GH, "IOStreamedHDF5"); if (CCTK_Equals (verbose, "full")) { @@ -253,11 +247,8 @@ int IOStreamedHDF5_TriggerOutput (const cGH *GH, int vindex) } -/******************************************************************** - ******************** Internal Routines ************************ - ********************************************************************/ /*@@ - @routine CheckSteerableParameters + @routine IOStreamedHDF5_CheckSteerableParameters @date Mon Oct 10 2000 @author Thomas Radke @desc @@ -272,17 +263,21 @@ int IOStreamedHDF5_TriggerOutput (const cGH *GH, int vindex) @vtype const cGH * @vio in @endvar + @var myGH + @vdesc Pointer to IOStreamedHDF5 grid hierarchy + @vtype ioStreamedHDF5GH * + @vio inout + @endvar @@*/ -static void CheckSteerableParameters (const cGH *GH) +void IOStreamedHDF5_CheckSteerableParameters (const cGH *GH, + ioStreamedHDF5GH *myGH) { int i; - ioStreamedHDF5GH *myGH; char *fullname, *msg; DECLARE_CCTK_PARAMETERS /* how often to output */ - myGH = (ioStreamedHDF5GH *) CCTK_GHExtension (GH, "IOStreamedHDF5"); i = myGH->out_every_default; myGH->out_every_default = out_every >= 0 ? out_every : io_out_every; @@ -291,12 +286,12 @@ static void CheckSteerableParameters (const cGH *GH) { if (myGH->out_every_default > 0) { - CCTK_VInfo (CCTK_THORNSTRING, "IOStreamedHDF5: Periodic output every %d " + CCTK_VInfo (CCTK_THORNSTRING, "Periodic streamed HDF5 output every %d " "iterations", myGH->out_every_default); } else { - CCTK_INFO ("IOStreamedHDF5: Periodic output turned off"); + CCTK_INFO ("Periodic streamed HDF5 output turned off"); } } @@ -304,8 +299,8 @@ static void CheckSteerableParameters (const cGH *GH) if (strcmp (out_vars, myGH->out_vars) || myGH->out_every_default != i) { IOUtil_ParseVarsForOutput (GH, CCTK_THORNSTRING, "IOStreamedHDF5::out_vars", - out_vars, myGH->out_every_default, - myGH->requests); + myGH->stop_on_parse_errors, out_vars, + myGH->out_every_default, myGH->requests); if (myGH->out_every_default == i || ! CCTK_Equals (verbose, "none")) { @@ -317,7 +312,7 @@ static void CheckSteerableParameters (const cGH *GH) fullname = CCTK_FullName (i); if (! msg) { - Util_asprintf (&msg, "IOStreamedHDF5: Periodic output requested " + Util_asprintf (&msg, "Periodic streamed HDF5 output requested " "for '%s'", fullname); } else diff --git a/src/Startup.c b/src/Startup.c index e6b2775..fbef5bc 100644 --- a/src/Startup.c +++ b/src/Startup.c @@ -80,7 +80,7 @@ void IOStreamedHDF5_Terminate (const cGH *GH) ioStreamedHDF5GH *myGH; - myGH = (ioStreamedHDF5GH *) CCTK_GHExtension (GH, "IOStreamedHDF5"); + myGH = CCTK_GHExtension (GH, "IOStreamedHDF5"); if (myGH) { /* close the data and checkpoint output sockets */ @@ -192,9 +192,9 @@ static void *SetupGH (tFleshConfig *config, int conv_level, cGH *GH) /* allocate a new GH extension structure */ numvars = CCTK_NumVars (); - myGH = (ioStreamedHDF5GH *) malloc (sizeof (ioStreamedHDF5GH)); - myGH->requests = (ioRequest **) calloc (numvars, sizeof (ioRequest *)); - myGH->out_last = (int *) malloc (numvars * sizeof (int)); + myGH = malloc (sizeof (ioStreamedHDF5GH)); + myGH->requests = calloc (numvars, sizeof (ioRequest *)); + myGH->out_last = malloc (numvars * sizeof (int)); myGH->advertised_filename = NULL; myGH->out_vars = strdup (""); @@ -205,6 +205,15 @@ static void *SetupGH (tFleshConfig *config, int conv_level, cGH *GH) myGH->out_last[i] = -1; } + myGH->stop_on_parse_errors = strict_io_parameter_check; + if (! CCTK_Equals (verbose, "none")) + { + CCTK_INFO ("I/O Method 'IOStreamedHDF5' registered: streamed HDF5 output " + "of grid variables and hyperslabs thereof"); + } + IOStreamedHDF5_CheckSteerableParameters (GH, myGH); + myGH->stop_on_parse_errors = 0; + /* only processor 0 is doing socket I/O */ myGH->data_socket = INVALID_SOCKET; myproc = CCTK_MyProc (GH); diff --git a/src/ioStreamedHDF5GH.h b/src/ioStreamedHDF5GH.h index 6f7c1b5..7e337c8 100644 --- a/src/ioStreamedHDF5GH.h +++ b/src/ioStreamedHDF5GH.h @@ -49,6 +49,10 @@ typedef struct /* filename for advertising the hostname / port number information */ char *advertised_filename; + + /* stop on I/O parameter parsing errors ? */ + int stop_on_parse_errors; + } ioStreamedHDF5GH; #ifdef __cplusplus @@ -65,6 +69,8 @@ int IOStreamedHDF5_Recover (cGH *GH, const char *basefilename, int called_from); /* other function prototypes */ int IOStreamedHDF5_Write (const cGH *GH, int vindex, const char *alias); +void IOStreamedHDF5_CheckSteerableParameters (const cGH *GH, + ioStreamedHDF5GH *myGH); #ifdef __cplusplus } // extern "C" -- cgit v1.2.3