aboutsummaryrefslogtreecommitdiff
path: root/src/Startup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Startup.c')
-rw-r--r--src/Startup.c85
1 files changed, 33 insertions, 52 deletions
diff --git a/src/Startup.c b/src/Startup.c
index 8e9ea7a..05bc401 100644
--- a/src/Startup.c
+++ b/src/Startup.c
@@ -28,12 +28,17 @@ static const char *rcsid = "$Id$";
CCTK_FILEVERSION(BetaThorns_IOStreamedHDF5_Startup_c)
-/* prototypes of routines defined in this source file */
+/********************************************************************
+ ******************** External Routines ************************
+ ********************************************************************/
void IOStreamedHDF5_Startup (void);
-void IOStreamedHDF5_Terminate (cGH *GH);
-static void *IOStreamedHDF5_SetupGH (tFleshConfig *config,
- int convergence_level,
- cGH *GH);
+void IOStreamedHDF5_Terminate (const cGH *GH);
+
+
+/********************************************************************
+ ******************** Internal Routines ************************
+ ********************************************************************/
+static void *SetupGH (tFleshConfig *config, int conv_level, cGH *GH);
/*@@
@@ -46,27 +51,13 @@ static void *IOStreamedHDF5_SetupGH (tFleshConfig *config,
along with its setup routine.
@enddesc
- @calls CCTK_RegisterGHExtensionSetupGH
+ @calls CCTK_RegisterGHExtension
+ CCTK_RegisterGHExtensionSetupGH
@@*/
void IOStreamedHDF5_Startup (void)
{
- /* check that thorn IOHDF5Util was activated */
- if (CCTK_GHExtensionHandle ("IOHDF5Util") < 0)
- {
- CCTK_WARN (1, "Thorn IOHDF5Util was not activated. "
- "No IOStreamedHDF5 IO methods will be registered.");
- return;
- }
-
- /* FIXME: this check can go as soon as the Stream VFD
- comes with the default HDF5 installation */
-#ifndef H5_HAVE_STREAM
- CCTK_WARN (1, "The Stream VFD was not configured in your HDF5 installation. "
- "No HDF5 streaming IO will be available !");
-#else
CCTK_RegisterGHExtensionSetupGH (CCTK_RegisterGHExtension ("IOStreamedHDF5"),
- IOStreamedHDF5_SetupGH);
-#endif
+ SetupGH);
}
@@ -83,11 +74,11 @@ void IOStreamedHDF5_Startup (void)
@var GH
@vdesc Pointer to CCTK grid hierarchy
- @vtype cGH *
+ @vtype const cGH *
@vio in
@endvar
@@*/
-void IOStreamedHDF5_Terminate (cGH *GH)
+void IOStreamedHDF5_Terminate (const cGH *GH)
{
int i;
ioStreamedHDF5GH *myGH;
@@ -125,11 +116,11 @@ void IOStreamedHDF5_Terminate (cGH *GH)
}
-/****************************************************************************/
-/* local routines */
-/****************************************************************************/
+/********************************************************************
+ ******************** Internal Routines ************************
+ ********************************************************************/
/*@@
- @routine IOStreamedHDF5_SetupGH
+ @routine SetupGH
@date Mon Jun 19 2000
@author Thomas Radke
@desc
@@ -154,7 +145,7 @@ void IOStreamedHDF5_Terminate (cGH *GH)
@vtype tFleshConfig *
@vio unused
@endvar
- @var convergence_level
+ @var conv_level
@vdesc the convergence level
@vtype int
@vio unused
@@ -170,47 +161,43 @@ void IOStreamedHDF5_Terminate (cGH *GH)
pointer to the allocated GH extension structure
@endreturndesc
@@*/
-static void *IOStreamedHDF5_SetupGH (tFleshConfig *config,
- int convergence_level,
- cGH *GH)
+static void *SetupGH (tFleshConfig *config, int conv_level, cGH *GH)
{
- DECLARE_CCTK_PARAMETERS
- int i;
- int myproc;
- int numvars;
+ int i, myproc, numvars;
char hostname[256];
ioStreamedHDF5GH *myGH;
+ H5FD_stream_fapl_t fapl;
FILE *advertised_file_fd;
ioAdvertisedFileDesc advertised_file;
const char *timer_names[4] = {"IOStreamedHDF5 time to dump parameters",
"IOStreamedHDF5 time to dump variables",
"IOStreamedHDF5 total time to checkpoint",
"IOStreamedHDF5 time to recover"};
+ DECLARE_CCTK_PARAMETERS
/* suppress compiler warnings about unused variables */
- config = config;
- convergence_level = convergence_level;
-
- myproc = CCTK_MyProc (GH);
+ (void) (config + 0);
+ (void) (conv_level + 0);
- /* Register IOStreamedHDF5 routines as output methods */
+ /* register IOStreamedHDF5 routines as a new I/O method */
i = CCTK_RegisterIOMethod ("IOStreamedHDF5");
CCTK_RegisterIOMethodOutputGH (i, IOStreamedHDF5_OutputGH);
CCTK_RegisterIOMethodOutputVarAs (i, IOStreamedHDF5_OutputVarAs);
CCTK_RegisterIOMethodTimeToOutput (i, IOStreamedHDF5_TimeFor);
CCTK_RegisterIOMethodTriggerOutput (i, IOStreamedHDF5_TriggerOutput);
- /* Register the IOStreamedHDF5 recovery routine to thorn IOUtil */
+ /* register the IOStreamedHDF5 recovery routine to thorn IOUtil */
if (IOUtil_RegisterRecover ("IOStreamedHDF5 recovery",
IOStreamedHDF5_Recover) < 0)
{
CCTK_WARN (1, "Failed to register IOStreamedHDF5 recovery routine");
}
+ /* allocate a new GH extension structure */
numvars = CCTK_NumVars ();
myGH = (ioStreamedHDF5GH *) malloc (sizeof (ioStreamedHDF5GH));
- myGH->geo_output = (ioHDF5Geo_t **) calloc (numvars, sizeof (ioHDF5Geo_t *));
+ myGH->slablist = (ioSlab **) calloc (numvars, sizeof (ioSlab *));
myGH->out_last = (int *) malloc (numvars * sizeof (int));
myGH->advertised_filename = NULL;
@@ -221,6 +208,7 @@ static void *IOStreamedHDF5_SetupGH (tFleshConfig *config,
/* only processor 0 is doing socket I/O */
myGH->data_socket = -1;
+ myproc = CCTK_MyProc (GH);
if (myproc == 0)
{
myGH->data_socket = Socket_TCPOpenServerSock (data_port);
@@ -310,9 +298,6 @@ static void *IOStreamedHDF5_SetupGH (tFleshConfig *config,
}
}
- /* FIXME: this check can go as soon as the Stream VFD
- comes with the default HDF5 installation */
-#ifdef H5_HAVE_STREAM
/* only processor 0 is doing socket I/O */
myGH->checkpoint_socket = -1;
myGH->checkpoint_fapl = -1;
@@ -335,9 +320,6 @@ static void *IOStreamedHDF5_SetupGH (tFleshConfig *config,
}
else
{
- H5FD_stream_fapl_t fapl;
-
-
/* setup file access property list and select Stream VFD */
fapl.increment = 0;
fapl.socket = myGH->checkpoint_socket;
@@ -345,8 +327,8 @@ static void *IOStreamedHDF5_SetupGH (tFleshConfig *config,
fapl.backlog = 5;
fapl.broadcast_fn = NULL;
fapl.broadcast_arg = NULL;
- IOHDF5_ERROR (myGH->checkpoint_fapl = H5Pcreate (H5P_FILE_ACCESS));
- IOHDF5_ERROR (H5Pset_fapl_stream (myGH->checkpoint_fapl, &fapl));
+ HDF5_ERROR (myGH->checkpoint_fapl = H5Pcreate (H5P_FILE_ACCESS));
+ HDF5_ERROR (H5Pset_fapl_stream (myGH->checkpoint_fapl, &fapl));
Util_GetHostName (hostname, sizeof (hostname));
CCTK_VInfo (CCTK_THORNSTRING,
@@ -355,7 +337,6 @@ static void *IOStreamedHDF5_SetupGH (tFleshConfig *config,
hostname, checkpoint_port);
}
}
-#endif
return (myGH);
}