From b795b592cb960dec7e39009f4fd33983648a4d65 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 20 Sep 2006 17:50:51 +0000 Subject: [PATCH] test/H5BlockTestAttributes.c - can be compiled parallel and non-parallel now --- test/H5BlockTestAttributes.c | 64 +++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 22 deletions(-) diff --git a/test/H5BlockTestAttributes.c b/test/H5BlockTestAttributes.c index a221ccd..e37bf73 100644 --- a/test/H5BlockTestAttributes.c +++ b/test/H5BlockTestAttributes.c @@ -7,9 +7,11 @@ #ifdef PARALLEL_IO #include #else -typedef MPI_Comm int; +typedef int MPI_Comm; +#ifndef MPI_COMM_WORLD #define MPI_COMM_WORLD 0 #endif +#endif struct H5BlockPartition Layout1[1] = { { 0, 63, 0, 63, 0, 511 } @@ -78,14 +80,20 @@ _write_file ( printf ("PROC[%d]: Open file \"%s\" for writing ...\n", myproc, fname ); - + +#ifdef PARALLEL_IO f = H5PartOpenFileParallel ( fname, - H5PART_WRITE -#ifdef PARALLEL_IO - , comm -#endif + H5PART_WRITE, + comm ); +#else + f = H5PartOpenFile ( + fname, + H5PART_WRITE + ); + +#endif if ( f == NULL ) return -1; herr = H5PartSetStep ( f, timestep ); @@ -114,13 +122,19 @@ _write_attributes ( printf ("PROC[%d]: Open file \"%s\" for writing ...\n", myproc, fname ); +#ifdef PARALLEL_IO H5PartFile *f = H5PartOpenFileParallel ( fname, - H5PART_WRITE -#ifdef PARALLEL_IO - , comm -#endif + H5PART_APPEND, + comm ); +#else + H5PartFile *f = H5PartOpenFile ( + fname, + H5PART_APPEND + ); + +#endif if ( f == NULL ) return -1; h5part_int64_t herr = H5PartSetStep ( f, timestep ); @@ -275,14 +289,18 @@ _read_file ( printf ("PROC[%d]: Open file \"%s\" for reading ...\n", myproc, fname ); - +#ifdef PARALLEL_IO f = H5PartOpenFileParallel ( fname, - H5PART_READ -#ifdef PARALLEL_IO - , comm -#endif + H5PART_READ, + comm ); +#else + f = H5PartOpenFile ( + fname, + H5PART_READ + ); +#endif if ( f == NULL ) return -1; herr = H5PartSetStep ( f, timestep ); @@ -311,19 +329,23 @@ _read_attributes ( printf ("PROC[%d]: Open file \"%s\" for writing ...\n", myproc, fname ); +#ifdef PARALLEL_IO H5PartFile *f = H5PartOpenFileParallel ( fname, - H5PART_WRITE -#ifdef PARALLEL_IO - , comm -#endif + H5PART_WRITE, + comm ); +#else + H5PartFile *f = H5PartOpenFile ( + fname, + H5PART_WRITE + ); +#endif if ( f == NULL ) return -1; h5part_int64_t herr = H5PartSetStep ( f, timestep ); if ( herr < 0 ) return herr; - char sval[16]; herr = H5BlockReadFieldAttrib ( f, @@ -376,7 +398,6 @@ main ( ) { char *fname = "blockfile0.h5"; int myproc =0; - int nprocs = 1; int opt_read = 0; int opt_write = 0; @@ -435,4 +456,3 @@ cleanup: #endif return ex; } -