[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.2-17-gb7b118d

Service Account noreply at mpich.org
Tue Dec 8 13:08:45 CST 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".

The branch, master has been updated
       via  b7b118dab7cd8c7d21a5fb8e16f9dfdcee29c2a6 (commit)
       via  40123bec2c27ed296b4c2c83809acbbee6dc5b53 (commit)
      from  8e6ce14305048395df675d3f8636f8996c620627 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/b7b118dab7cd8c7d21a5fb8e16f9dfdcee29c2a6

commit b7b118dab7cd8c7d21a5fb8e16f9dfdcee29c2a6
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Fri Oct 2 13:45:36 2015 -0500

    promote type size of intermediate values
    
    Ignacio Laguna applied static analysis to gather.c and found this
    location where the product of two large ints could overflow before being
    assigned to a 64 bit value.
    
    See discussion at http://lists.mpich.org/pipermail/discuss/2015-September/004186.html
    
    Signed-off-by: Lena Oden <loden at anl.gov>

diff --git a/src/mpi/coll/gather.c b/src/mpi/coll/gather.c
index e6387d3..5cd00f3 100644
--- a/src/mpi/coll/gather.c
+++ b/src/mpi/coll/gather.c
@@ -220,8 +220,8 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 			     * should cover the case where the root is
 			     * rank 0. */
 			    mpi_errno = MPIC_Recv(((char *)recvbuf +
-                                                      (((rank + mask) % comm_size)*recvcount*extent)),
-                                                     recvblks * recvcount, recvtype, src,
+                                                      (((rank + mask) % comm_size)*(MPI_Aint)recvcount*extent)),
+                                                     (MPI_Aint)recvblks * recvcount, recvtype, src,
                                                      MPIR_GATHER_TAG, comm_ptr,
                                                      &status, errflag);
                             if (mpi_errno) {

http://git.mpich.org/mpich.git/commitdiff/40123bec2c27ed296b4c2c83809acbbee6dc5b53

commit 40123bec2c27ed296b4c2c83809acbbee6dc5b53
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Fri Oct 2 11:25:59 2015 -0500

    type promotions for igather
    
    Similar to the fixes done for gather over the summer, the igather path
    also had many areas where ints could overflow.  Promote internal 'count'
    values on the non-blocking collective path to MPI_Aint.
    
    Signed-off-by: Lena Oden <loden at anl.gov>

diff --git a/src/include/mpiimpl.h b/src/include/mpiimpl.h
index e705e5d..91d6a62 100644
--- a/src/include/mpiimpl.h
+++ b/src/include/mpiimpl.h
@@ -3811,11 +3811,11 @@ int MPIC_Sendrecv_replace(void *buf, int count, MPI_Datatype datatype,
                              int dest, int sendtag,
                              int source, int recvtag,
                              MPID_Comm *comm_ptr, MPI_Status *status, MPIR_Errflag_t *errflag);
-int MPIC_Isend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag,
+int MPIC_Isend(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest, int tag,
                   MPID_Comm *comm_ptr, MPID_Request **request, MPIR_Errflag_t *errflag);
-int MPIC_Issend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag,
+int MPIC_Issend(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest, int tag,
                   MPID_Comm *comm_ptr, MPID_Request **request, MPIR_Errflag_t *errflag);
-int MPIC_Irecv(void *buf, int count, MPI_Datatype datatype, int source,
+int MPIC_Irecv(void *buf, MPI_Aint count, MPI_Datatype datatype, int source,
                   int tag, MPID_Comm *comm_ptr, MPID_Request **request);
 int MPIC_Waitall(int numreq, MPID_Request *requests[], MPI_Status statuses[], MPIR_Errflag_t *errflag);
 
diff --git a/src/include/mpir_nbc.h b/src/include/mpir_nbc.h
index 0e615e9..faca4ef 100644
--- a/src/include/mpir_nbc.h
+++ b/src/include/mpir_nbc.h
@@ -61,17 +61,17 @@ int MPID_Sched_clone(MPID_Sched_t orig, MPID_Sched_t *cloned);
 int MPID_Sched_start(MPID_Sched_t *sp, MPID_Comm *comm, int tag, MPID_Request **req);
 
 /* send and recv take a comm ptr to enable hierarchical collectives */
-int MPID_Sched_send(const void *buf, int count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s);
-int MPID_Sched_recv(void *buf, int count, MPI_Datatype datatype, int src, MPID_Comm *comm, MPID_Sched_t s);
+int MPID_Sched_send(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s);
+int MPID_Sched_recv(void *buf, MPI_Aint count, MPI_Datatype datatype, int src, MPID_Comm *comm, MPID_Sched_t s);
 
 /* just like MPI_Issend, can't complete until the matching recv is posted */
-int MPID_Sched_ssend(const void *buf, int count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s);
+int MPID_Sched_ssend(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s);
 
-int MPID_Sched_reduce(const void *inbuf, void *inoutbuf, int count, MPI_Datatype datatype, MPI_Op op, MPID_Sched_t s);
+int MPID_Sched_reduce(const void *inbuf, void *inoutbuf, MPI_Aint count, MPI_Datatype datatype, MPI_Op op, MPID_Sched_t s);
 /* packing/unpacking can be accomplished by passing MPI_PACKED as either intype
  * or outtype */
-int MPID_Sched_copy(const void *inbuf,  int incount,  MPI_Datatype intype,
-                    void *outbuf, int outcount, MPI_Datatype outtype, MPID_Sched_t s);
+int MPID_Sched_copy(const void *inbuf,  MPI_Aint incount,  MPI_Datatype intype,
+                    void *outbuf, MPI_Aint outcount, MPI_Datatype outtype, MPID_Sched_t s);
 /* require that all previously added ops are complete before subsequent ops
  * may begin to execute */
 int MPID_Sched_barrier(MPID_Sched_t s);
@@ -92,11 +92,11 @@ int MPID_Sched_barrier(MPID_Sched_t s);
  * A corresponding _recv_defer function is not currently provided because there
  * is no known use case.  The recv count is just an upper bound, not an exact
  * amount to be received, so an oversized recv is used instead of deferral. */
-int MPID_Sched_send_defer(const void *buf, const int *count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s);
+int MPID_Sched_send_defer(const void *buf, const MPI_Aint *count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s);
 /* Just like MPID_Sched_recv except it populates the given status object with
  * the received count and error information, much like a normal recv.  Often
  * useful in conjunction with MPID_Sched_send_defer. */
-int MPID_Sched_recv_status(void *buf, int count, MPI_Datatype datatype, int src, MPID_Comm *comm, MPI_Status *status, MPID_Sched_t s);
+int MPID_Sched_recv_status(void *buf, MPI_Aint count, MPI_Datatype datatype, int src, MPID_Comm *comm, MPI_Status *status, MPID_Sched_t s);
 
 /* Sched_cb_t funcitons take a comm parameter, the value of which will be the
  * comm passed to Sched_start */
diff --git a/src/mpi/coll/helper_fns.c b/src/mpi/coll/helper_fns.c
index 7b7fb83..6b2fd52 100644
--- a/src/mpi/coll/helper_fns.c
+++ b/src/mpi/coll/helper_fns.c
@@ -618,7 +618,7 @@ int MPIC_Sendrecv_replace(void *buf, int count, MPI_Datatype datatype,
 #define FUNCNAME MPIC_Isend
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
-int MPIC_Isend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag,
+int MPIC_Isend(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest, int tag,
                   MPID_Comm *comm_ptr, MPID_Request **request_ptr, MPIR_Errflag_t *errflag)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -659,7 +659,7 @@ int MPIC_Isend(const void *buf, int count, MPI_Datatype datatype, int dest, int
 #define FUNCNAME MPIC_Issend
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
-int MPIC_Issend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag,
+int MPIC_Issend(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest, int tag,
                   MPID_Comm *comm_ptr, MPID_Request **request_ptr, MPIR_Errflag_t *errflag)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -700,7 +700,7 @@ int MPIC_Issend(const void *buf, int count, MPI_Datatype datatype, int dest, int
 #define FUNCNAME MPIC_Irecv
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
-int MPIC_Irecv(void *buf, int count, MPI_Datatype datatype, int source,
+int MPIC_Irecv(void *buf, MPI_Aint count, MPI_Datatype datatype, int source,
                   int tag, MPID_Comm *comm_ptr, MPID_Request **request_ptr)
 {
     int mpi_errno = MPI_SUCCESS;
diff --git a/src/mpi/coll/igather.c b/src/mpi/coll/igather.c
index 961e73d..8cb2283 100644
--- a/src/mpi/coll/igather.c
+++ b/src/mpi/coll/igather.c
@@ -58,8 +58,9 @@ int MPIR_Igather_binomial(const void *sendbuf, int sendcount, MPI_Datatype sendt
 {
     int mpi_errno = MPI_SUCCESS;
     int comm_size, rank;
-    int curr_cnt=0, relative_rank, nbytes, is_homogeneous;
-    int mask, sendtype_size, recvtype_size, src, dst, relative_src;
+    int relative_rank, is_homogeneous;
+    int mask, src, dst, relative_src;
+    MPI_Aint recvtype_size, sendtype_size, curr_cnt=0, nbytes;
     int recvblks;
     int tmp_buf_size, missing;
     void *tmp_buf = NULL;
@@ -201,7 +202,7 @@ int MPIR_Igather_binomial(const void *sendbuf, int sendcount, MPI_Datatype sendt
                         }
                     }
                     else { /* Intermediate nodes store in temporary buffer */
-                        int offset;
+                        MPI_Aint offset;
 
                         /* Estimate the amount of data that is going to come in */
                         recvblks = mask;
@@ -243,9 +244,16 @@ int MPIR_Igather_binomial(const void *sendbuf, int sendcount, MPI_Datatype sendt
                     blocks[0] = sendcount;
                     struct_displs[0] = MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf;
                     types[0] = sendtype;
-                    blocks[1] = curr_cnt - nbytes;
+		    /* check for overflow.  work around int limits if needed*/
+		    if (curr_cnt - nbytes != (int)(curr_cnt-nbytes)) {
+			blocks[1] = 1;
+			MPIR_Type_contiguous_x_impl(curr_cnt - nbytes,
+				MPI_BYTE, &(types[1]));
+		    } else {
+			MPIU_Assign_trunc(blocks[1], curr_cnt - nbytes, int);
+			types[1] = MPI_BYTE;
+		    }
                     struct_displs[1] = MPIU_VOID_PTR_CAST_TO_MPI_AINT tmp_buf;
-                    types[1] = MPI_BYTE;
 
                     mpi_errno = MPIR_Type_create_struct_impl(2, blocks, struct_displs, types, &tmp_type);
                     if (mpi_errno) MPIR_ERR_POP(mpi_errno);
@@ -400,8 +408,10 @@ fn_fail:
 int MPIR_Igather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
-    int rank, local_size, remote_size;
-    int i, nbytes, sendtype_size, recvtype_size;
+    int rank;
+    MPI_Aint local_size, remote_size;
+    int i;
+    MPI_Aint recvtype_size, sendtype_size, nbytes;
     MPI_Aint extent, true_extent, true_lb = 0;
     void *tmp_buf = NULL;
     MPID_Comm *newcomm_ptr = NULL;
@@ -661,7 +671,7 @@ int MPI_Igather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
                     /* catch common aliasing cases */
                     if (recvbuf != MPI_IN_PLACE && sendtype == recvtype && sendcount == recvcount && sendcount != 0) {
-                        int recvtype_size;
+                        MPI_Aint recvtype_size;
                         MPID_Datatype_get_size_macro(recvtype, recvtype_size);
                         MPIR_ERRTEST_ALIAS_COLL(sendbuf, (char*)recvbuf + comm_ptr->rank*recvcount*recvtype_size, mpi_errno);
                     }
diff --git a/src/mpid/common/sched/mpid_sched.c b/src/mpid/common/sched/mpid_sched.c
index e3d7a76..6f873d8 100644
--- a/src/mpid/common/sched/mpid_sched.c
+++ b/src/mpid/common/sched/mpid_sched.c
@@ -476,7 +476,7 @@ fn_fail:
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
 /* do these ops need an entry handle returned? */
-int MPID_Sched_send(const void *buf, int count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s)
+int MPID_Sched_send(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
     struct MPIDU_Sched_entry *e = NULL;
@@ -514,7 +514,7 @@ fn_fail:
 #define FUNCNAME MPID_Sched_ssend
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
-int MPID_Sched_ssend(const void *buf, int count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s)
+int MPID_Sched_ssend(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
     struct MPIDU_Sched_entry *e = NULL;
@@ -552,7 +552,7 @@ fn_fail:
 #define FUNCNAME MPID_Sched_send_defer
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
-int MPID_Sched_send_defer(const void *buf, const int *count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s)
+int MPID_Sched_send_defer(const void *buf, const MPI_Aint *count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
     struct MPIDU_Sched_entry *e = NULL;
@@ -589,7 +589,7 @@ fn_fail:
 #define FUNCNAME MPID_Sched_recv_status
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
-int MPID_Sched_recv_status(void *buf, int count, MPI_Datatype datatype, int src, MPID_Comm *comm, MPI_Status *status, MPID_Sched_t s)
+int MPID_Sched_recv_status(void *buf, MPI_Aint count, MPI_Datatype datatype, int src, MPID_Comm *comm, MPI_Status *status, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
     struct MPIDU_Sched_entry *e = NULL;
@@ -622,7 +622,7 @@ fn_fail:
 #define FUNCNAME MPID_Sched_recv
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
-int MPID_Sched_recv(void *buf, int count, MPI_Datatype datatype, int src, MPID_Comm *comm, MPID_Sched_t s)
+int MPID_Sched_recv(void *buf, MPI_Aint count, MPI_Datatype datatype, int src, MPID_Comm *comm, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
     struct MPIDU_Sched_entry *e = NULL;
@@ -655,7 +655,7 @@ fn_fail:
 #define FUNCNAME MPID_Sched_reduce
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
-int MPID_Sched_reduce(const void *inbuf, void *inoutbuf, int count, MPI_Datatype datatype, MPI_Op op, MPID_Sched_t s)
+int MPID_Sched_reduce(const void *inbuf, void *inoutbuf, MPI_Aint count, MPI_Datatype datatype, MPI_Op op, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
     struct MPIDU_Sched_entry *e = NULL;
@@ -699,8 +699,8 @@ fn_fail:
  *
  * Packing/unpacking can be accomplished by passing MPI_PACKED as either intype
  * or outtype. */
-int MPID_Sched_copy(const void *inbuf,  int incount,  MPI_Datatype intype,
-                    void *outbuf, int outcount, MPI_Datatype outtype, MPID_Sched_t s)
+int MPID_Sched_copy(const void *inbuf,  MPI_Aint incount,  MPI_Datatype intype,
+                    void *outbuf, MPI_Aint outcount, MPI_Datatype outtype, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
     struct MPIDU_Sched_entry *e = NULL;
diff --git a/src/mpid/common/sched/mpid_sched.h b/src/mpid/common/sched/mpid_sched.h
index ef040e6..296f304 100644
--- a/src/mpid/common/sched/mpid_sched.h
+++ b/src/mpid/common/sched/mpid_sched.h
@@ -30,8 +30,8 @@ enum MPIDU_Sched_entry_type {
 
 struct MPIDU_Sched_send {
     const void *buf;
-    int count;
-    const int *count_p;
+    MPI_Aint count;
+    const MPI_Aint *count_p;
     MPI_Datatype datatype;
     int dest;
     MPID_Comm *comm;
@@ -41,7 +41,7 @@ struct MPIDU_Sched_send {
 
 struct MPIDU_Sched_recv {
     void *buf;
-    int count;
+    MPI_Aint count;
     MPI_Datatype datatype;
     int src;
     MPID_Comm *comm;
@@ -52,17 +52,17 @@ struct MPIDU_Sched_recv {
 struct MPIDU_Sched_reduce {
     const void *inbuf;
     void *inoutbuf;
-    int count;
+    MPI_Aint count;
     MPI_Datatype datatype;
     MPI_Op op;
 };
 
 struct MPIDU_Sched_copy {
     const void *inbuf;
-    int incount;
+    MPI_Aint incount;
     MPI_Datatype intype;
     void *outbuf;
-    int outcount;
+    MPI_Aint outcount;
     MPI_Datatype outtype;
 };
 

-----------------------------------------------------------------------

Summary of changes:
 src/include/mpiimpl.h              |    6 +++---
 src/include/mpir_nbc.h             |   16 ++++++++--------
 src/mpi/coll/gather.c              |    4 ++--
 src/mpi/coll/helper_fns.c          |    6 +++---
 src/mpi/coll/igather.c             |   26 ++++++++++++++++++--------
 src/mpid/common/sched/mpid_sched.c |   16 ++++++++--------
 src/mpid/common/sched/mpid_sched.h |   12 ++++++------
 7 files changed, 48 insertions(+), 38 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list