[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
Mon Mar 24 15:09:24 CDT 2008


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