Changeset 40123b


Ignore:
Timestamp:
12/08/15 13:08:21 (2 months ago)
Author:
Rob Latham <robl@…>
Branches:
master
Children:
b7b118
Parents:
8e6ce1
git-author:
Rob Latham <robl@…> (10/02/15 11:25:59)
git-committer:
Rob Latham <robl@…> (12/08/15 13:08:21)
Message:

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@…>

Location:
src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/include/mpiimpl.h

    rbddf8a r40123b  
    38123812                             int source, int recvtag, 
    38133813                             MPID_Comm *comm_ptr, MPI_Status *status, MPIR_Errflag_t *errflag); 
    3814 int MPIC_Isend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, 
     3814int MPIC_Isend(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest, int tag, 
    38153815                  MPID_Comm *comm_ptr, MPID_Request **request, MPIR_Errflag_t *errflag); 
    3816 int MPIC_Issend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, 
     3816int MPIC_Issend(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest, int tag, 
    38173817                  MPID_Comm *comm_ptr, MPID_Request **request, MPIR_Errflag_t *errflag); 
    3818 int MPIC_Irecv(void *buf, int count, MPI_Datatype datatype, int source, 
     3818int MPIC_Irecv(void *buf, MPI_Aint count, MPI_Datatype datatype, int source, 
    38193819                  int tag, MPID_Comm *comm_ptr, MPID_Request **request); 
    38203820int MPIC_Waitall(int numreq, MPID_Request *requests[], MPI_Status statuses[], MPIR_Errflag_t *errflag); 
  • src/include/mpir_nbc.h

    r05a87d r40123b  
    6262 
    6363/* send and recv take a comm ptr to enable hierarchical collectives */ 
    64 int MPID_Sched_send(const void *buf, int count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s); 
    65 int MPID_Sched_recv(void *buf, int count, MPI_Datatype datatype, int src, MPID_Comm *comm, MPID_Sched_t s); 
     64int MPID_Sched_send(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s); 
     65int MPID_Sched_recv(void *buf, MPI_Aint count, MPI_Datatype datatype, int src, MPID_Comm *comm, MPID_Sched_t s); 
    6666 
    6767/* just like MPI_Issend, can't complete until the matching recv is posted */ 
    68 int MPID_Sched_ssend(const void *buf, int count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s); 
     68int MPID_Sched_ssend(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s); 
    6969 
    70 int MPID_Sched_reduce(const void *inbuf, void *inoutbuf, int count, MPI_Datatype datatype, MPI_Op op, MPID_Sched_t s); 
     70int MPID_Sched_reduce(const void *inbuf, void *inoutbuf, MPI_Aint count, MPI_Datatype datatype, MPI_Op op, MPID_Sched_t s); 
    7171/* packing/unpacking can be accomplished by passing MPI_PACKED as either intype 
    7272 * or outtype */ 
    73 int MPID_Sched_copy(const void *inbuf,  int incount,  MPI_Datatype intype, 
    74                     void *outbuf, int outcount, MPI_Datatype outtype, MPID_Sched_t s); 
     73int MPID_Sched_copy(const void *inbuf,  MPI_Aint incount,  MPI_Datatype intype, 
     74                    void *outbuf, MPI_Aint outcount, MPI_Datatype outtype, MPID_Sched_t s); 
    7575/* require that all previously added ops are complete before subsequent ops 
    7676 * may begin to execute */ 
     
    9393 * is no known use case.  The recv count is just an upper bound, not an exact 
    9494 * amount to be received, so an oversized recv is used instead of deferral. */ 
    95 int MPID_Sched_send_defer(const void *buf, const int *count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s); 
     95int MPID_Sched_send_defer(const void *buf, const MPI_Aint *count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s); 
    9696/* Just like MPID_Sched_recv except it populates the given status object with 
    9797 * the received count and error information, much like a normal recv.  Often 
    9898 * useful in conjunction with MPID_Sched_send_defer. */ 
    99 int MPID_Sched_recv_status(void *buf, int count, MPI_Datatype datatype, int src, MPID_Comm *comm, MPI_Status *status, MPID_Sched_t s); 
     99int MPID_Sched_recv_status(void *buf, MPI_Aint count, MPI_Datatype datatype, int src, MPID_Comm *comm, MPI_Status *status, MPID_Sched_t s); 
    100100 
    101101/* Sched_cb_t funcitons take a comm parameter, the value of which will be the 
  • src/mpi/coll/helper_fns.c

    r05a87d r40123b  
    619619#undef FCNAME 
    620620#define FCNAME MPL_QUOTE(FUNCNAME) 
    621 int MPIC_Isend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, 
     621int MPIC_Isend(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest, int tag, 
    622622                  MPID_Comm *comm_ptr, MPID_Request **request_ptr, MPIR_Errflag_t *errflag) 
    623623{ 
     
    660660#undef FCNAME 
    661661#define FCNAME MPL_QUOTE(FUNCNAME) 
    662 int MPIC_Issend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, 
     662int MPIC_Issend(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest, int tag, 
    663663                  MPID_Comm *comm_ptr, MPID_Request **request_ptr, MPIR_Errflag_t *errflag) 
    664664{ 
     
    701701#undef FCNAME 
    702702#define FCNAME MPL_QUOTE(FUNCNAME) 
    703 int MPIC_Irecv(void *buf, int count, MPI_Datatype datatype, int source, 
     703int MPIC_Irecv(void *buf, MPI_Aint count, MPI_Datatype datatype, int source, 
    704704                  int tag, MPID_Comm *comm_ptr, MPID_Request **request_ptr) 
    705705{ 
  • src/mpi/coll/igather.c

    r51b029 r40123b  
    5959    int mpi_errno = MPI_SUCCESS; 
    6060    int comm_size, rank; 
    61     int curr_cnt=0, relative_rank, nbytes, is_homogeneous; 
    62     int mask, sendtype_size, recvtype_size, src, dst, relative_src; 
     61    int relative_rank, is_homogeneous; 
     62    int mask, src, dst, relative_src; 
     63    MPI_Aint recvtype_size, sendtype_size, curr_cnt=0, nbytes; 
    6364    int recvblks; 
    6465    int tmp_buf_size, missing; 
     
    202203                    } 
    203204                    else { /* Intermediate nodes store in temporary buffer */ 
    204                         int offset; 
     205                        MPI_Aint offset; 
    205206 
    206207                        /* Estimate the amount of data that is going to come in */ 
     
    244245                    struct_displs[0] = MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf; 
    245246                    types[0] = sendtype; 
    246                     blocks[1] = curr_cnt - nbytes; 
     247                    /* check for overflow.  work around int limits if needed*/ 
     248                    if (curr_cnt - nbytes != (int)(curr_cnt-nbytes)) { 
     249                        blocks[1] = 1; 
     250                        MPIR_Type_contiguous_x_impl(curr_cnt - nbytes, 
     251                                MPI_BYTE, &(types[1])); 
     252                    } else { 
     253                        MPIU_Assign_trunc(blocks[1], curr_cnt - nbytes, int); 
     254                        types[1] = MPI_BYTE; 
     255                    } 
    247256                    struct_displs[1] = MPIU_VOID_PTR_CAST_TO_MPI_AINT tmp_buf; 
    248                     types[1] = MPI_BYTE; 
    249257 
    250258                    mpi_errno = MPIR_Type_create_struct_impl(2, blocks, struct_displs, types, &tmp_type); 
     
    401409{ 
    402410    int mpi_errno = MPI_SUCCESS; 
    403     int rank, local_size, remote_size; 
    404     int i, nbytes, sendtype_size, recvtype_size; 
     411    int rank; 
     412    MPI_Aint local_size, remote_size; 
     413    int i; 
     414    MPI_Aint recvtype_size, sendtype_size, nbytes; 
    405415    MPI_Aint extent, true_extent, true_lb = 0; 
    406416    void *tmp_buf = NULL; 
     
    662672                    /* catch common aliasing cases */ 
    663673                    if (recvbuf != MPI_IN_PLACE && sendtype == recvtype && sendcount == recvcount && sendcount != 0) { 
    664                         int recvtype_size; 
     674                        MPI_Aint recvtype_size; 
    665675                        MPID_Datatype_get_size_macro(recvtype, recvtype_size); 
    666676                        MPIR_ERRTEST_ALIAS_COLL(sendbuf, (char*)recvbuf + comm_ptr->rank*recvcount*recvtype_size, mpi_errno); 
  • src/mpid/common/sched/mpid_sched.c

    r05a87d r40123b  
    477477#define FCNAME MPL_QUOTE(FUNCNAME) 
    478478/* do these ops need an entry handle returned? */ 
    479 int MPID_Sched_send(const void *buf, int count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s) 
     479int MPID_Sched_send(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s) 
    480480{ 
    481481    int mpi_errno = MPI_SUCCESS; 
     
    515515#undef FCNAME 
    516516#define FCNAME MPL_QUOTE(FUNCNAME) 
    517 int MPID_Sched_ssend(const void *buf, int count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s) 
     517int MPID_Sched_ssend(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s) 
    518518{ 
    519519    int mpi_errno = MPI_SUCCESS; 
     
    553553#undef FCNAME 
    554554#define FCNAME MPL_QUOTE(FUNCNAME) 
    555 int MPID_Sched_send_defer(const void *buf, const int *count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s) 
     555int MPID_Sched_send_defer(const void *buf, const MPI_Aint *count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s) 
    556556{ 
    557557    int mpi_errno = MPI_SUCCESS; 
     
    590590#undef FCNAME 
    591591#define FCNAME MPL_QUOTE(FUNCNAME) 
    592 int MPID_Sched_recv_status(void *buf, int count, MPI_Datatype datatype, int src, MPID_Comm *comm, MPI_Status *status, MPID_Sched_t s) 
     592int MPID_Sched_recv_status(void *buf, MPI_Aint count, MPI_Datatype datatype, int src, MPID_Comm *comm, MPI_Status *status, MPID_Sched_t s) 
    593593{ 
    594594    int mpi_errno = MPI_SUCCESS; 
     
    623623#undef FCNAME 
    624624#define FCNAME MPL_QUOTE(FUNCNAME) 
    625 int MPID_Sched_recv(void *buf, int count, MPI_Datatype datatype, int src, MPID_Comm *comm, MPID_Sched_t s) 
     625int MPID_Sched_recv(void *buf, MPI_Aint count, MPI_Datatype datatype, int src, MPID_Comm *comm, MPID_Sched_t s) 
    626626{ 
    627627    int mpi_errno = MPI_SUCCESS; 
     
    656656#undef FCNAME 
    657657#define FCNAME MPL_QUOTE(FUNCNAME) 
    658 int MPID_Sched_reduce(const void *inbuf, void *inoutbuf, int count, MPI_Datatype datatype, MPI_Op op, MPID_Sched_t s) 
     658int MPID_Sched_reduce(const void *inbuf, void *inoutbuf, MPI_Aint count, MPI_Datatype datatype, MPI_Op op, MPID_Sched_t s) 
    659659{ 
    660660    int mpi_errno = MPI_SUCCESS; 
     
    700700 * Packing/unpacking can be accomplished by passing MPI_PACKED as either intype 
    701701 * or outtype. */ 
    702 int MPID_Sched_copy(const void *inbuf,  int incount,  MPI_Datatype intype, 
    703                     void *outbuf, int outcount, MPI_Datatype outtype, MPID_Sched_t s) 
     702int MPID_Sched_copy(const void *inbuf,  MPI_Aint incount,  MPI_Datatype intype, 
     703                    void *outbuf, MPI_Aint outcount, MPI_Datatype outtype, MPID_Sched_t s) 
    704704{ 
    705705    int mpi_errno = MPI_SUCCESS; 
  • src/mpid/common/sched/mpid_sched.h

    r2f4324 r40123b  
    3131struct MPIDU_Sched_send { 
    3232    const void *buf; 
    33     int count; 
    34     const int *count_p; 
     33    MPI_Aint count; 
     34    const MPI_Aint *count_p; 
    3535    MPI_Datatype datatype; 
    3636    int dest; 
     
    4242struct MPIDU_Sched_recv { 
    4343    void *buf; 
    44     int count; 
     44    MPI_Aint count; 
    4545    MPI_Datatype datatype; 
    4646    int src; 
     
    5353    const void *inbuf; 
    5454    void *inoutbuf; 
    55     int count; 
     55    MPI_Aint count; 
    5656    MPI_Datatype datatype; 
    5757    MPI_Op op; 
     
    6060struct MPIDU_Sched_copy { 
    6161    const void *inbuf; 
    62     int incount; 
     62    MPI_Aint incount; 
    6363    MPI_Datatype intype; 
    6464    void *outbuf; 
    65     int outcount; 
     65    MPI_Aint outcount; 
    6666    MPI_Datatype outtype; 
    6767}; 
Note: See TracChangeset for help on using the changeset viewer.