[mpich2-dev] Fw: [PATCH 21/21] Add read resized to the test.

Bob Cernohous bobc at us.ibm.com
Fri Apr 10 17:15:52 CDT 2009


How about adding a read of the resized type to the test?  Did I do this 
right?  It didn't work as written until I copied the ad_read_str.c changes 
into ad_bgl, so I think I got this correct.
 
 Signed-off-by: Bob Cernohous <bobc at us.ibm.com>
 ---
  mpich2/test/mpi/io/resized.c                   |   18 +++++++++++++++++-
  1 files changed, 17 insertions(+), 1 deletions(-)
 diff --git a/mpich2/test/mpi/io/resized.c b/mpich2/test/mpi/io/resized.c
 index 1abab1a..bba22c4 100644
 --- a/mpich2/test/mpi/io/resized.c
 +++ b/mpich2/test/mpi/io/resized.c
 @@ -52,7 +52,7 @@ int main(int argc, char **argv)
 
      MPI_File_delete(filename, MPI_INFO_NULL);
 
 -    /* create a resized type comprising an integer with an lb at 0 and 
extent = 3*sizeof(int) */
 +    /* create a resized type comprising an integer with an lb at 
sizeof(int) and extent = 3*sizeof(int) */
      lb = sizeof(int);
      extent = 3*sizeof(int);
      MPI_Type_create_resized(MPI_INT, lb, extent, &newtype); 
 @@ -82,6 +82,22 @@ int main(int argc, char **argv)
      MPI_File_close(&fh);
 
 
 +    /* read back file view with resized type  and verify */
 +
 +    MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, 
MPI_INFO_NULL, &fh);
 +
 +    mpi_errno = MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", 
MPI_INFO_NULL);
 +    if (mpi_errno != MPI_SUCCESS) errs++;
 +
 +    for (i=0; i<4; i++) newbuf[i] = 100;
 +    MPI_File_read(fh, newbuf, 2, MPI_INT, MPI_STATUS_IGNORE);
 +    if ((newbuf[0] != 10) || (newbuf[1] != 20) || (newbuf[2] !=100) || 
(newbuf[3] != 100)) {
 +   errs++;
 +   fprintf(stderr, "newbuf[0] is %d, should be 10,\n newbuf[1] is %d, 
should be 20\n newbuf[2] is %d, should be 100,\n newbuf[3] is %d, should 
be 100,\n", newbuf[0], newbuf[1], newbuf[2], newbuf[3]);
 +    }
 +
 +    MPI_File_close(&fh);
 +
      /* read file back and verify */
 
      MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_DELETE_ON_CLOSE | 
 -- 
 1.5.3.7
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mcs.anl.gov/mailman/private/mpich2-dev/attachments/20090410/59b8003a/attachment.htm>


More information about the mpich2-dev mailing list