diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2000-10-10 02:32:45 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2000-10-10 02:32:45 (GMT) |
commit | 884b83d6069d3a90482203dd665dc49965fdc5a4 (patch) | |
tree | e2d7d01a44be537cd72fdc156ae7aba6182615e1 /src | |
parent | d68bdee92f4b26f9818cc84fc620971bd92cacab (diff) | |
download | hdf5-884b83d6069d3a90482203dd665dc49965fdc5a4.zip hdf5-884b83d6069d3a90482203dd665dc49965fdc5a4.tar.gz hdf5-884b83d6069d3a90482203dd665dc49965fdc5a4.tar.bz2 |
[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.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5S.c | 2 | ||||
-rw-r--r-- | src/H5Smpio.c | 32 |
2 files changed, 28 insertions, 6 deletions
@@ -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_collapse<rank); new_rank = rank - num_to_collapse; #ifdef H5Smpi_DEBUG + fprintf(stdout, "num_to_collapse=%d\n", num_to_collapse); fprintf(stdout, "hyper_type: new_rank=%d\n", new_rank ); #endif @@ -389,6 +398,10 @@ H5S_mpio_hyper_type( const H5S_t *space, const size_t elmt_size, if (err) { HRETURN_ERROR(H5E_DATASPACE, H5E_MPI, FAIL,"couldn't create MPI struct type"); } + MPI_Type_free (&old_type[0]); + if (err) { + HRETURN_ERROR(H5E_DATASPACE, H5E_MPI, FAIL,"couldn't resize MPI vector type"); + } } else { *new_type = inner_type; @@ -402,9 +415,18 @@ H5S_mpio_hyper_type( const H5S_t *space, const size_t elmt_size, /* fill in the remaining return values */ *count = 1; /* only have to move one of these suckers! */ *is_derived_type = 1; + goto done; + +empty: + /* special case: empty hyperslab */ + *new_type = MPI_BYTE; + *count = 0; + *is_derived_type = 0; +done: #ifdef H5Smpi_DEBUG - fprintf(stdout, "Leave %s\n", FUNC ); + HDfprintf(stdout, "Leave %s, count=%Hu is_derived_type=%d\n", + FUNC, *count, *is_derived_type ); #endif FUNC_LEAVE (SUCCEED); } @@ -574,7 +596,7 @@ H5S_mpio_spaces_xfer(H5F_t *f, const struct H5O_layout_t *layout, /* calculate the absolute base addr (i.e., the file view disp) */ disp = f->shared->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 */ |