From a9c79d6b6168f6833a3683660ae2a15da4e2ec4e Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Wed, 15 Jan 2003 11:06:47 -0500 Subject: [svn-r6286] Purpose: bug fix Description: Added a barrier to ensure all processes have finished using the file before cleaning it away. Added H5close() to ensure all HDF5 stuff are closed before calling MPI_Finalize. Platforms tested: Tested h5committest {arabica (fortran), eirene (fortran, C++) modi4 (parallel, fortran)}? Yes --- testpar/t_mpi.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index 3a28146..2b5a4e3 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -1,3 +1,17 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + /* * MPIO independent overlapping writes. * @@ -267,7 +281,7 @@ test_mpio_gb_file(char *filename) mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE|MPI_MODE_RDWR, info, &fh); - VRFY((mrc==MPI_SUCCESS), ""); + VRFY((mrc==MPI_SUCCESS), "MPI_FILE_OPEN"); printf("MPIO GB file write test %s\n", filename); @@ -440,6 +454,7 @@ main(int argc, char **argv) printf("MPI functionality tests\n"); printf("===================================\n"); } + H5open(); h5_show_hostname(); fapl = H5Pcreate (H5P_FILE_ACCESS); @@ -457,6 +472,10 @@ main(int argc, char **argv) test_mpio_overlap_writes(filenames[0]); finish: + /* make sure all processes are finished before final report, cleanup + * and exit. + */ + MPI_Barrier(MPI_COMM_WORLD); if (MAINPROCESS){ /* only process 0 reports */ printf("===================================\n"); if (nerrors){ @@ -467,8 +486,13 @@ finish: } printf("===================================\n"); } - MPI_Finalize(); + h5_cleanup(FILENAME, fapl); + H5close(); + + /* MPI_Finalize must be called AFTER H5close which may use MPI calls */ + MPI_Finalize(); + /* always return 0 as this test is informational only. */ return(0); } -- cgit v0.12