From 884b83d6069d3a90482203dd665dc49965fdc5a4 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Mon, 9 Oct 2000 21:32:45 -0500 Subject: [svn-r2646] Purpose: Bug fix (done by Kim Yates) Description: The optimized mpio code was broken and when read was done, it hanged. Solution: H5FDmpio.c: In H5FD_mpio_write, moved the 16-line block of code in which all procs other than p0 skip the actual write to be just before the call to MPI_File_write_at. Previously, the values of the local vars that controlled "allsame" were not always set correctly when the moved block was reached. H5S.c: Changed default value of H5_mpi_opt_types_g to TRUE, so that the MPI-IO hyperslab code is executed by default in parallel HDF5, rather than executing the serial hyperslab code. H5Smpio.c: In function H5S_mpio_hyper_type, added a call to free an intermediate type. Cures a small memory leak. Added code for cases of empty hyperslab Changed displacements to be MPI_Aint Platforms tested: modi4 -64: worked fine with mpich 1.2.0 but failed with the messages saying it ran out of entries for MPI_Types during the collective_read test. After tracing the code all the way to the collective read, all MPI Types have been freed properly. It aborted with the above message when it executed the line if (MPI_SUCCESS!= MPI_File_read_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat )) Could not see any problem with this line. It could be a bug in the SGI version of MPI. --- src/H5S.c | 2 +- src/H5Smpio.c | 32 +++++++++++++++++++++++++++----- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/H5S.c b/src/H5S.c index 94949e5..485d92f 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -42,7 +42,7 @@ static size_t H5S_nconv_g = 0; /*entries used*/ #ifdef H5_HAVE_PARALLEL /* Global var whose value comes from environment variable */ -hbool_t H5_mpi_opt_types_g = FALSE; +hbool_t H5_mpi_opt_types_g = TRUE; #endif /* Declare a free list to manage the H5S_simple_t struct */ diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 87ecd30..0c4c6e1 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -126,6 +126,9 @@ H5S_mpio_all_type( const H5S_t *space, const size_t elmt_size, * Programmer: rky 980813 * * Modifications: ppw 990401 + * rky, ppw 2000-09-26 Freed old type after creating struct type. + * rky 2000-10-05 Changed displacements to be MPI_Aint. + * rky 2000-10-06 Added code for cases of empty hyperslab. * *------------------------------------------------------------------------- */ @@ -145,20 +148,23 @@ H5S_mpio_hyper_type( const H5S_t *space, const size_t elmt_size, } d[32]; int i, err, new_rank, num_to_collapse; - int offset[32], max_xtent[32], block_length[2], displacement[2]; + int offset[32], max_xtent[32], block_length[2]; H5S_hyper_dim_t *diminfo; /* [rank] */ intn rank; MPI_Datatype inner_type, outer_type, old_type[32]; - MPI_Aint extent_len; + MPI_Aint extent_len, displacement[2]; FUNC_ENTER (H5S_mpio_hyper_type, FAIL); /* Check and abbreviate args */ assert (space); + assert(sizeof(MPI_Aint) >= sizeof(elmt_size)); diminfo = space->select.sel_info.hslab.diminfo; assert (diminfo); rank = space->extent.u.simple.rank; assert (rank >= 0); + if (0==rank) goto empty; + if (0==elmt_size) goto empty; /* make a local copy of the dimension info so we can transform them */ assert(rank<=32); /* within array bounds */ @@ -175,6 +181,9 @@ H5S_mpio_hyper_type( const H5S_t *space, const size_t elmt_size, if (i==0) fprintf(stdout, " rank=%d\n", rank ); else fprintf(stdout, "\n" ); #endif + if (0==d[i].block) goto empty; + if (0==d[i].count) goto empty; + if (0==d[i].xtent) goto empty; } /********************************************************************** @@ -232,11 +241,11 @@ H5S_mpio_hyper_type( const H5S_t *space, const size_t elmt_size, } /* end for */ num_to_collapse = i; if (num_to_collapse == rank) num_to_collapse--; - printf ("num_to_collapse=%d\n", num_to_collapse); assert(0<=num_to_collapse && num_to_collapseshared->base_addr + layout->addr; #ifdef H5Smpi_DEBUG - fprintf(stdout, "spaces_xfer: disp=%Hu\n", disp.offset ); + HDfprintf(stdout, "spaces_xfer: disp=%Hu\n", disp ); #endif /* Effective address determined by base addr and the MPI file type */ -- cgit v0.12