[mpich2-dev] [PATCH 1/1] changes to pass testcases when MPI_Aint is 8-byte but (void *) is 4-byte

Douglas Miller dougmill at us.ibm.com
Tue Mar 25 10:29:00 CDT 2008


I now see that (kind=mpi_address_kind) is a F90 construct, so have another
way of fixing the shpositionf testcase. There is commented-out code that
got the type extent into an intermediate value and then assigned it to the
fileintsize variable.  Re-instating that commented-out code does fix the
problem when MPI_Aint is 8-byte and (void *) is 4-byte.


diff --git a/lib/mpi/mpich2/test/mpi/f77/io/shpositionf.f
b/lib/mpi/mpich2/test/mpi/f77/io/shpositio
index 6e24c73..6ac1996 100644
--- a/lib/mpi/mpich2/test/mpi/f77/io/shpositionf.f
+++ b/lib/mpi/mpich2/test/mpi/f77/io/shpositionf.f
@@ -7,7 +7,7 @@ C
         implicit none
         include 'mpif.h'
         integer comm, fh, r, s, i
-        integer(kind=mpi_address_kind) fileintsize
+        integer fileintsize
         integer errs, err, ierr
         character *(100) filename
         include 'iooffset.h'
@@ -31,10 +31,10 @@ C Try writing the file, then check it
         endif
 C
 C Get the size of an INTEGER in the file
-        ! call mpi_file_get_type_extent( fh, MPI_INTEGER, offset, ierr )
-        ! fileintsize = offset
-        call mpi_file_get_type_extent( fh, MPI_INTEGER,
-     &                                 fileintsize, ierr )
+        call mpi_file_get_type_extent( fh, MPI_INTEGER, offset, ierr )
+        fileintsize = offset
+C       call mpi_file_get_type_extent( fh, MPI_INTEGER,
+C    &                                 fileintsize, ierr )
 C
 C We let each process write in turn, getting the position after each
 C write

_______________________________________________
Douglas Miller                  BlueGene Messaging Development
IBM Corp., Rochester, MN USA                     Bldg 030-2 C214
dougmill at us.ibm.com               Douglas Miller/Rochester/IBM


                                                                           
             Douglas                                                       
             Miller/Rochester/                                             
             IBM at IBMUS                                                  To 
             Sent by:                  mpich2-dev at mcs.anl.gov              
             owner-mpich2-dev@                                          cc 
             mcs.anl.gov                                                   
                                                                   Subject 
                                       [mpich2-dev] [PATCH 1/1] changes to 
             03/24/2008 03:09          pass testcases when MPI_Aint is     
             PM                        8-byte but (void *) is 4-byte       
                                                                           
                                                                           
             Please respond to                                             
             mpich2-dev at mcs.an                                             
                   l.gov                                                   
                                                                           
                                                                           





Changes to make mpich tests pass for 8byte_aint.

1. In MPI_Win_get_attr changed size of output pointer to match interface.

2. MPID_Type_create_pairtype and MPID_Type_struct changes internal
variables from int to MPI_Aint to avoid problems when casting into
new->element_size (although, this may only require removal of the
unsigned cast which ruined the -1 special-value).

3. In testcase shpositionf change variable fileintsize to proper size
for the MPI call mpi_file_get_type_extent parameter.


diff --git a/lib/mpi/mpich2/src/mpi/attr/win_get_attr.c
b/lib/mpi/mpich2/src/mpi/attr/win_get_attr.c
index 958d193..4e09a44 100644
--- a/lib/mpi/mpich2/src/mpi/attr/win_get_attr.c
+++ b/lib/mpi/mpich2/src/mpi/attr/win_get_attr.c
@@ -130,7 +130,7 @@ int MPI_Win_get_attr(MPI_Win win, int win_keyval, void
*attribute_val,
 #ifdef HAVE_FORTRAN_BINDING
        /* Note that this routine only has a Fortran 90 binding,
           so the attribute value is an address-sized int */
-       MPI_Aint  *attr_int = (MPI_Aint *)attribute_val;
+       MPI_Fint  *attr_int = (MPI_Fint *)attribute_val;
 #endif
        *flag = 1;

diff --git
a/lib/mpi/mpich2/src/mpid/common/datatype/mpid_type_create_pairtype.c
b/lib/mpi/mpich2/src/mpid/common/datatype/mpid_type_create_pairtype.c
index 1484b86..ec1c155 100644
--- a/lib/mpi/mpich2/src/mpid/common/datatype/mpid_type_create_pairtype.c
+++ b/lib/mpi/mpich2/src/mpid/common/datatype/mpid_type_create_pairtype.c
@@ -66,8 +66,8 @@ int MPID_Type_create_pairtype(MPI_Datatype type,
                              MPID_Datatype *new_dtp)
 {
     int err, mpi_errno = MPI_SUCCESS;
-    int type_size, el_size, alignsize;
-    MPI_Aint type_extent, true_ub;
+    int type_size, alignsize;
+    MPI_Aint type_extent, true_ub, el_size;

     /* handle is filled in by MPIU_Handle_obj_alloc() */
     MPIU_Object_set_ref(new_dtp, 1);
diff --git a/lib/mpi/mpich2/src/mpid/common/datatype/mpid_type_struct.c
b/lib/mpi/mpich2/src/mpid/common/datatype/mpid_type_struct.c
index 2c72b60..0b2f509 100644
--- a/lib/mpi/mpich2/src/mpid/common/datatype/mpid_type_struct.c
+++ b/lib/mpi/mpich2/src/mpid/common/datatype/mpid_type_struct.c
@@ -151,7 +151,8 @@ int MPID_Type_struct(int count,
     int i, old_are_contig = 1, definitely_not_contig = 0;
     int found_sticky_lb = 0, found_sticky_ub = 0, found_true_lb = 0,
        found_true_ub = 0, found_el_type = 0;
-    int el_sz = 0, size = 0;
+    MPI_Aint el_sz = 0;
+    int size = 0;
     MPI_Datatype el_type = MPI_DATATYPE_NULL;
     MPI_Aint true_lb_disp = 0, true_ub_disp = 0, sticky_lb_disp = 0,
        sticky_ub_disp = 0;
@@ -214,7 +215,7 @@ int MPID_Type_struct(int count,
        int is_builtin =
            (HANDLE_GET_KIND(oldtype_array[i]) == HANDLE_KIND_BUILTIN);
        MPI_Aint tmp_lb, tmp_ub, tmp_true_lb, tmp_true_ub;
-       int tmp_el_sz;
+       MPI_Aint tmp_el_sz;
        MPI_Datatype tmp_el_type;
        MPID_Datatype *old_dtp = NULL;

@@ -231,8 +232,8 @@ int MPID_Type_struct(int count,
            MPID_DATATYPE_BLOCK_LB_UB((MPI_Aint)(unsigned
long)(blocklength_array[i]),
                                      displacement_array[i],
                                      0,
-                                     (MPI_Aint)(unsigned long)tmp_el_sz,
-                                     (MPI_Aint)(unsigned long)tmp_el_sz,
+                                     tmp_el_sz,
+                                     tmp_el_sz,
                                      tmp_lb,
                                      tmp_ub);
            tmp_true_lb = tmp_lb;
@@ -359,7 +360,7 @@ int MPID_Type_struct(int count,
     }

     new_dtp->n_elements = -1; /* TODO */
-    new_dtp->element_size = (MPI_Aint)(unsigned long)el_sz;
+    new_dtp->element_size = el_sz;
     new_dtp->eltype = el_type;

     new_dtp->has_sticky_lb = found_sticky_lb;
diff --git a/lib/mpi/mpich2/test/mpi/f77/io/shpositionf.f
b/lib/mpi/mpich2/test/mpi/f77/io/shpositionf.f
index aabea9a..6e24c73 100644
--- a/lib/mpi/mpich2/test/mpi/f77/io/shpositionf.f
+++ b/lib/mpi/mpich2/test/mpi/f77/io/shpositionf.f
@@ -7,7 +7,7 @@ C
         implicit none
         include 'mpif.h'
         integer comm, fh, r, s, i
-        integer fileintsize
+        integer(kind=mpi_address_kind) fileintsize
         integer errs, err, ierr
         character *(100) filename
         include 'iooffset.h'


_______________________________________________
Douglas Miller                  BlueGene Messaging Development
IBM Corp., Rochester, MN USA                     Bldg 030-2 C214
dougmill at us.ibm.com               Douglas Miller/Rochester/IBM






More information about the mpich2-dev mailing list