From 4a7fea3b1792bdd8e3b410ffb7734d4bb684066e Mon Sep 17 00:00:00 2001 From: tradke Date: Sat, 19 Jan 2002 16:18:26 +0000 Subject: Fix in parallel MPI code. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5Util/trunk@50 7842ec3a-9562-4be5-9c5b-06ba18f2b668 --- src/DumpVar.c | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/DumpVar.c b/src/DumpVar.c index b955599..96b441d 100644 --- a/src/DumpVar.c +++ b/src/DumpVar.c @@ -73,7 +73,7 @@ static void IOHDF5Util_procDump (const cGH *GH, int check_exisiting_objects, hid_t file); #ifdef CCTK_MPI -#ifdef HAVE_PARALLEL +#ifdef H5_HAVE_PARALLEL static void IOHDF5Util_collectiveDump (const cGH *GH, int vindex, int timelevel, @@ -81,8 +81,9 @@ static void IOHDF5Util_collectiveDump (const cGH *GH, const void *outme, const CCTK_INT *geom, int hdf5io_type, + int check_exisiting_objects, hid_t file); -#endif /* HAVE_PARALLEL */ +#endif /* H5_HAVE_PARALLEL */ #endif /* MPI */ @@ -394,7 +395,6 @@ static int IOHDF5Util_DumpGA (const cGH *GH, int check_exisiting_objects, hid_t file) { - DECLARE_CCTK_PARAMETERS ioGH *ioUtilGH; pGH *pughGH; int myproc; @@ -410,6 +410,7 @@ static int IOHDF5Util_DumpGA (const cGH *GH, int i, j; MPI_Status ms; #endif + DECLARE_CCTK_PARAMETERS /* Get the handles for PUGH and IOUtil extensions */ @@ -431,11 +432,11 @@ static int IOHDF5Util_DumpGA (const cGH *GH, nprocs = CCTK_nProcs (GH); #ifdef CCTK_MPI -#ifdef HAVE_PARALLEL +#ifdef H5_HAVE_PARALLEL if (ioUtilGH->unchunked) { IOHDF5Util_collectiveDump (GH, vindex, timelevel, request, outme, geom, - info->iohdf5_type, file); + info->iohdf5_type, check_exisiting_objects,file); if (free_outme) { free (outme); @@ -704,7 +705,6 @@ static void IOHDF5Util_procDump (const cGH *GH, int check_exisiting_objects, hid_t file) { - DECLARE_CCTK_PARAMETERS int i, sdim; int myproc; ioGH *ioUtilGH; @@ -715,6 +715,7 @@ static void IOHDF5Util_procDump (const cGH *GH, hsize_t *chunk_dims, *file_dims; hsize_t buffersize; int locpoints; + DECLARE_CCTK_PARAMETERS ioUtilGH = (ioGH *) CCTK_GHExtension (GH, "IO"); @@ -857,7 +858,7 @@ static void IOHDF5Util_procDump (const cGH *GH, #ifdef CCTK_MPI -#ifdef HAVE_PARALLEL +#ifdef H5_HAVE_PARALLEL /*@@ @routine IOHDF5Util_collectiveDump @author Thomas Radke @@ -924,35 +925,34 @@ static void IOHDF5Util_collectiveDump (const cGH *GH, int timelevel, const ioHDF5Geo_t *request, const void *outme, - CCTK_INT *geom, + const CCTK_INT *geom, int hdf5io_type, + int check_exisiting_objects, hid_t file) { - DECLARE_CCTK_PARAMETERS int i, dim; - ioHDF5GH *myGH; + ioHDF5UtilGH *myGH; hid_t dataset, memspace, filespace, plist; char *fullname, *datasetname; hssize_t *chunk_origin; hsize_t *chunk_dims, *file_dims; hsize_t buffersize; + DECLARE_CCTK_PARAMETERS - myGH = (ioHDF5GH *) CCTK_GHExtension (GH, "IOHDF5Util"); + myGH = (ioHDF5UtilGH *) CCTK_GHExtension (GH, "IOHDF5Util"); /* get the dimension of the variable */ - sdim = request->sdim; - - chunk_origin = (hssize_t *) malloc (sdim * sizeof (hssize_t)); - chunk_dims = (hsize_t *) malloc (2*sdim * sizeof (hsize_t)); - file_dims = chunk_dims + sdim; + chunk_origin = (hssize_t *) malloc (request->sdim * sizeof (hssize_t)); + chunk_dims = (hsize_t *) malloc (2*request->sdim * sizeof (hsize_t)); + file_dims = chunk_dims + request->sdim; /* HDF5 needs it in reverse order */ - for (i = 0; i < sdim; i++) + for (i = 0; i < request->sdim; i++) { - chunk_origin[i] = geom[1*sdim - 1 - i]; - chunk_dims [i] = geom[2*sdim - 1 - i]; - file_dims [i] = geom[3*sdim - 1 - i]; + chunk_origin[i] = geom[1*request->sdim - 1 - i]; + chunk_dims [i] = geom[2*request->sdim - 1 - i]; + file_dims [i] = geom[3*request->sdim - 1 - i]; } /* build the unique dataset name */ @@ -962,10 +962,10 @@ static void IOHDF5Util_collectiveDump (const cGH *GH, fullname, timelevel, GH->cctk_iteration); /* create the memspace according to chunk dims */ - IOHDF5_ERROR (memspace = H5Screate_simple (sdim, chunk_dims, NULL)); + IOHDF5_ERROR (memspace = H5Screate_simple (request->sdim, chunk_dims, NULL)); /* create the (global) filespace and set the hyperslab for the chunk */ - IOHDF5_ERROR (filespace = H5Screate_simple (sdim, file_dims, NULL)); + IOHDF5_ERROR (filespace = H5Screate_simple (request->sdim, file_dims, NULL)); IOHDF5_ERROR (H5Sselect_hyperslab (filespace, H5S_SELECT_SET, chunk_origin, NULL, chunk_dims, NULL)); @@ -983,7 +983,7 @@ static void IOHDF5Util_collectiveDump (const cGH *GH, IOHDF5_ERROR (plist = H5Pcreate (H5P_DATASET_CREATE)); if (compression_level) { - IOHDF5_ERROR (H5Pset_chunk (plist, sdim, chunk_dims)); + IOHDF5_ERROR (H5Pset_chunk (plist, request->sdim, chunk_dims)); IOHDF5_ERROR (H5Pset_deflate (plist, compression_level)); } IOHDF5_ERROR (dataset = H5Dcreate (file, datasetname, hdf5io_type, filespace, @@ -991,8 +991,8 @@ static void IOHDF5Util_collectiveDump (const cGH *GH, IOHDF5_ERROR (H5Pclose (plist)); if (CCTK_MyProc (GH) == 0) { - IOHDF5Util_DumpCommonAttributes (GH, vindex, timelevel, &geom[2*sdim], - request, dataset); + IOHDF5Util_DumpCommonAttributes (GH, vindex, timelevel, + &geom[2*request->sdim], request, dataset); } /* increase the buffer size if the default isn't sufficient */ @@ -1019,5 +1019,5 @@ static void IOHDF5Util_collectiveDump (const cGH *GH, free (chunk_origin); free (chunk_dims); } -#endif /* HAVE_PARALLEL */ +#endif /* H5_HAVE_PARALLEL */ #endif /* MPI */ -- cgit v1.2.3