[mpich] MPICH primary repository branch, large-count, created. v3.0.4-125-g0228281
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, large-count has been created at 02282816b3711a0a2443ad2070698bf19f409c44 (commit) - Log ----------------------------------------------------------------- http://git.mpich.org/mpich.git/commitdiff/02282816b3711a0a2443ad2070698bf19f... commit 02282816b3711a0a2443ad2070698bf19f409c44 Author: Dave Goodell <[email protected]> Date: Thu Apr 4 13:02:16 2013 -0500 WIP large count work, use MPI_Aint for dtype size and collectives Also includes random fixes to `-Wshorten-64-to-32` warnings which might need to be teased out. diff --git a/src/include/mpierrs.h b/src/include/mpierrs.h index 330c296..e467d3f 100644 --- a/src/include/mpierrs.h +++ b/src/include/mpierrs.h @@ -298,7 +298,7 @@ int ferr = 0; \ if (HANDLE_GET_KIND(dtype) == HANDLE_KIND_BUILTIN) { ferr=1; } \ else { \ - int errsize; \ + MPI_Aint errsize; \ MPID_Datatype *errdtypeptr; \ MPID_Datatype_get_ptr(dtype,errdtypeptr); \ MPID_Datatype_get_size_macro(dtype,errsize); \ diff --git a/src/include/mpiutil.h b/src/include/mpiutil.h index 0e0dfaa..40d5b87 100644 --- a/src/include/mpiutil.h +++ b/src/include/mpiutil.h @@ -184,30 +184,36 @@ int MPIR_Assert_fail_fmt(const char *cond, const char *file_name, int line_num, * "std::numeric_limits<TYPE>" functionality. These rely on either C11 * "_Generic" functionality or some unfortunately complicated GCC builtins. */ #if HAVE_C11__GENERIC -#define expr_inttype_max(expr_) \ - _Generic(expr_, \ - signed char: SCHAR_MAX, \ - signed short: SHRT_MAX, \ - signed int: INT_MAX, \ - signed long: LONG_MAX, \ - signed long long: LLONG_MAX, \ - unsigned char: UCHAR_MAX, \ - unsigned short: USHRT_MAX, \ - unsigned int: UINT_MAX, \ - unsigned long: ULONG_MAX, \ - unsigned long long: ULLONG_MAX) -#define expr_inttype_min(expr_) \ - _Generic(expr_, \ - signed char: SCHAR_MIN, \ - signed short: SHRT_MIN, \ - signed int: INT_MIN, \ - signed long: LONG_MIN, \ - signed long long: LLONG_MIN, \ - unsigned char: 0, \ - unsigned short: 0, \ - unsigned int: 0, \ - unsigned long: 0, \ - unsigned long long: 0) +#define expr_inttype_max(expr_) \ + _Generic(expr_, \ + signed char: SCHAR_MAX, \ + signed short: SHRT_MAX, \ + signed int: INT_MAX, \ + signed long: LONG_MAX, \ + signed long long: LLONG_MAX, \ + unsigned char: UCHAR_MAX, \ + unsigned short: USHRT_MAX, \ + unsigned int: UINT_MAX, \ + unsigned long: ULONG_MAX, \ + unsigned long long: ULLONG_MAX, \ + /* _Generic cares about cv-qualifiers */ \ + volatile signed int: INT_MAX, \ + volatile unsigned int: UINT_MAX) +#define expr_inttype_min(expr_) \ + _Generic(expr_, \ + signed char: SCHAR_MIN, \ + signed short: SHRT_MIN, \ + signed int: INT_MIN, \ + signed long: LONG_MIN, \ + signed long long: LLONG_MIN, \ + unsigned char: 0, \ + unsigned short: 0, \ + unsigned int: 0, \ + unsigned long: 0, \ + unsigned long long: 0, \ + /* _Generic cares about cv-qualifiers */ \ + volatile signed int: INT_MIN, \ + volatile unsigned int: 0) #endif /* Assigns (src_) to (dst_), checking that (src_) fits in (dst_) without @@ -218,18 +224,19 @@ int MPIR_Assert_fail_fmt(const char *cond, const char *file_name, int line_num, * can be found in Chapter 5 of "Secure Coding in C and C++" by Robert Seacord. */ #if defined(expr_inttype_max) && defined(expr_inttype_min) -# define MPIU_Assign_trunc(dst_,src_) \ - do { \ - MPIU_Assert((src_) <= expr_inttype_max(dst_)); \ - MPIU_Assert((src_) >= expr_inttype_min(dst_)); \ - dst_ = (src_); \ +# define MPIU_Assign_trunc(dst_,src_,dst_type_) \ + do { \ + MPIU_Assert_has_type((dst_), dst_type_); \ + MPIU_Assert((src_) <= expr_inttype_max(dst_)); \ + MPIU_Assert((src_) >= expr_inttype_min(dst_)); \ + dst_ = (dst_type_)(src_); \ } while (0) #else -# define MPIU_Assign_trunc(dst_,src_) \ - do { \ - dst_ = (src_); \ +# define MPIU_Assign_trunc(dst_,src_,dst_type_) \ + do { \ + dst_ = (dst_type_)(src_); \ /* will catch some of the cases if the expr_inttype macros aren't available */ \ - MPIU_Assert((dst_) == (src_)); \ + MPIU_Assert((dst_) == (src_)); \ } while (0) #endif diff --git a/src/mpi/coll/allred_group.c b/src/mpi/coll/allred_group.c index 24c514e..50ee36e 100644 --- a/src/mpi/coll/allred_group.c +++ b/src/mpi/coll/allred_group.c @@ -29,7 +29,7 @@ int MPIR_Allreduce_group_intra(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr, MPID_Group *group_ptr, int tag, int *errflag) { - int type_size; + MPI_Aint type_size; int mpi_errno = MPI_SUCCESS; int mpi_errno_ret = MPI_SUCCESS; /* newrank is a rank in group_ptr */ diff --git a/src/mpi/coll/allreduce.c b/src/mpi/coll/allreduce.c index 02999d0..bca64e2 100644 --- a/src/mpi/coll/allreduce.c +++ b/src/mpi/coll/allreduce.c @@ -136,7 +136,8 @@ int MPIR_Allreduce_intra ( int is_homogeneous; int rc; #endif - int comm_size, rank, type_size; + int comm_size, rank; + MPI_Aint type_size; int mpi_errno = MPI_SUCCESS; int mpi_errno_ret = MPI_SUCCESS; int mask, dst, is_commutative, pof2, newrank, rem, newdst, i, diff --git a/src/mpi/coll/bcast.c b/src/mpi/coll/bcast.c index cf9ac0a..cab8c70 100644 --- a/src/mpi/coll/bcast.c +++ b/src/mpi/coll/bcast.c @@ -45,7 +45,8 @@ static int MPIR_Bcast_binomial( int nbytes=0; int recvd_size; MPI_Status status; - int type_size, is_contig, is_homogeneous; + int is_contig, is_homogeneous; + MPI_Aint type_size; int position; void *tmp_buf=NULL; MPI_Comm comm; @@ -399,8 +400,9 @@ static int MPIR_Bcast_scatter_doubling_allgather( int relative_rank, mask; int mpi_errno = MPI_SUCCESS; int mpi_errno_ret = MPI_SUCCESS; - int scatter_size, nbytes=0, curr_size, recv_size = 0; - int type_size, j, k, i, tmp_mask, is_contig, is_homogeneous; + int scatter_size, curr_size, recv_size = 0; + int j, k, i, tmp_mask, is_contig, is_homogeneous; + MPI_Aint type_size, nbytes = 0; int relative_dst, dst_tree_root, my_tree_root, send_offset; int recv_offset, tree_root, nprocs_completed, offset, position; MPIU_CHKLMEM_DECL(1); @@ -706,7 +708,8 @@ static int MPIR_Bcast_scatter_ring_allgather( int mpi_errno = MPI_SUCCESS; int mpi_errno_ret = MPI_SUCCESS; int scatter_size, nbytes; - int type_size, j, i, is_contig, is_homogeneous; + int j, i, is_contig, is_homogeneous; + MPI_Aint type_size; int position; int left, right, jnext; int curr_size = 0; @@ -912,8 +915,8 @@ static int MPIR_SMP_Bcast( { int mpi_errno = MPI_SUCCESS; int mpi_errno_ret = MPI_SUCCESS; - int type_size, is_homogeneous; - int nbytes=0; + int is_homogeneous; + MPI_Aint type_size, nbytes=0; MPI_Status status; int recvd_size; diff --git a/src/mpi_t/mpi_t_util.c b/src/mpi_t/mpi_t_util.c index 8c28b2e..0c71dae 100644 --- a/src/mpi_t/mpi_t_util.c +++ b/src/mpi_t/mpi_t_util.c @@ -139,12 +139,12 @@ void MPIU_Tool_strncpy(char *dst, const char *src, int *len) if (!dst || !*len) { /* just return the space needed to hold src, including the terminator */ - *len = strlen(src) + 1; + *len = (int)(strlen(src) + 1); } else { /* MPL_strncpy will always terminate the string */ MPL_strncpy(dst, src, *len); - *len = strlen(dst) + 1; + *len = (int)(strlen(dst) + 1); } } } diff --git a/src/mpid/ch3/channels/nemesis/include/mpid_nem_datatypes.h b/src/mpid/ch3/channels/nemesis/include/mpid_nem_datatypes.h index 04b3c56..bbc7b98 100644 --- a/src/mpid/ch3/channels/nemesis/include/mpid_nem_datatypes.h +++ b/src/mpid/ch3/channels/nemesis/include/mpid_nem_datatypes.h @@ -147,7 +147,7 @@ #define MPID_NEM_PKT_HEADER_FIELDS \ int source; \ int dest; \ - int datalen; \ + MPIDI_msg_sz_t datalen; \ unsigned short seqno; \ unsigned short type /* currently used only with checkpointing */ typedef struct MPID_nem_pkt_header diff --git a/src/mpid/ch3/channels/nemesis/include/mpid_nem_inline.h b/src/mpid/ch3/channels/nemesis/include/mpid_nem_inline.h index 6d215a1..5e489ac 100644 --- a/src/mpid/ch3/channels/nemesis/include/mpid_nem_inline.h +++ b/src/mpid/ch3/channels/nemesis/include/mpid_nem_inline.h @@ -216,7 +216,7 @@ MPID_nem_mpich_sendv (MPID_IOV **iov, int *n_iov, MPIDI_VC_t *vc, int *again) while (*n_iov && payload_len >= (*iov)->MPID_IOV_LEN) { - int _iov_len = (*iov)->MPID_IOV_LEN; + size_t _iov_len = (*iov)->MPID_IOV_LEN; MPIU_Memcpy (cell_buf, (*iov)->MPID_IOV_BUF, _iov_len); payload_len -= _iov_len; cell_buf += _iov_len; @@ -351,7 +351,7 @@ MPID_nem_mpich_sendv_header (MPID_IOV **iov, int *n_iov, MPIDI_VC_t *vc, int *ag payload_len = MPID_NEM_MPICH_DATA_LEN - sizeof(MPIDI_CH3_Pkt_t); while (*n_iov && payload_len >= (*iov)->MPID_IOV_LEN) { - int _iov_len = (*iov)->MPID_IOV_LEN; + size_t _iov_len = (*iov)->MPID_IOV_LEN; MPIU_Memcpy (cell_buf, (*iov)->MPID_IOV_BUF, _iov_len); payload_len -= _iov_len; cell_buf += _iov_len; diff --git a/src/mpid/ch3/channels/nemesis/netmod/tcp/socksm.c b/src/mpid/ch3/channels/nemesis/netmod/tcp/socksm.c index a26cfb2..d27a525 100644 --- a/src/mpid/ch3/channels/nemesis/netmod/tcp/socksm.c +++ b/src/mpid/ch3/channels/nemesis/netmod/tcp/socksm.c @@ -459,7 +459,9 @@ static int send_id_info(const sockconn_t *const sc) MPIDI_nem_tcp_idinfo_t id_info; MPIDI_nem_tcp_header_t hdr; struct iovec iov[3]; - int pg_id_len = 0, offset, buf_size, iov_cnt = 2; + int buf_size, iov_cnt = 2; + ssize_t offset; + size_t pg_id_len = 0; MPIDI_STATE_DECL(MPID_STATE_SEND_ID_INFO); MPIDI_FUNC_ENTER(MPID_STATE_SEND_ID_INFO); @@ -503,7 +505,7 @@ static int send_id_info(const sockconn_t *const sc) MPIDI_FUNC_EXIT(MPID_STATE_SEND_ID_INFO); return mpi_errno; fn_fail: - MPIU_DBG_MSG_FMT(NEM_SOCK_DET, VERBOSE, (MPIU_DBG_FDEST, "failure. mpi_errno = %d, offset=%d, errno=%d %s", mpi_errno, offset, errno, MPIU_Strerror(errno))); + MPIU_DBG_MSG_FMT(NEM_SOCK_DET, VERBOSE, (MPIU_DBG_FDEST, "failure. mpi_errno = %d, offset=%lld, errno=%d %s", mpi_errno, (long long)offset, errno, MPIU_Strerror(errno))); goto fn_exit; } @@ -518,7 +520,8 @@ static int send_tmpvc_info(const sockconn_t *const sc) MPIDI_nem_tcp_portinfo_t port_info; MPIDI_nem_tcp_header_t hdr; struct iovec iov[3]; - int offset, buf_size, iov_cnt = 2; + int buf_size, iov_cnt = 2; + ssize_t offset; MPIDI_STATE_DECL(MPID_STATE_SEND_TMPVC_INFO); MPIDI_FUNC_ENTER(MPID_STATE_SEND_TMPVC_INFO); @@ -552,7 +555,7 @@ static int send_tmpvc_info(const sockconn_t *const sc) MPIDI_FUNC_EXIT(MPID_STATE_SEND_TMPVC_INFO); return mpi_errno; fn_fail: - MPIU_DBG_MSG_FMT(NEM_SOCK_DET, VERBOSE, (MPIU_DBG_FDEST, "failure. mpi_errno = %d, offset=%d, errno=%d %s", mpi_errno, offset, errno, MPIU_Strerror(errno))); + MPIU_DBG_MSG_FMT(NEM_SOCK_DET, VERBOSE, (MPIU_DBG_FDEST, "failure. mpi_errno = %d, offset=%lld, errno=%d %s", mpi_errno, (long long)offset, errno, MPIU_Strerror(errno))); goto fn_exit; } @@ -564,7 +567,9 @@ static int recv_id_or_tmpvc_info(sockconn_t *const sc, int *got_sc_eof) { int mpi_errno = MPI_SUCCESS; MPIDI_nem_tcp_header_t hdr; - int pg_id_len = 0, nread, iov_cnt = 1; + int iov_cnt = 1; + size_t pg_id_len = 0; + ssize_t nread; int hdr_len = sizeof(MPIDI_nem_tcp_header_t); struct iovec iov[2]; char *pg_id = NULL; @@ -695,7 +700,8 @@ static int recv_id_or_tmpvc_info(sockconn_t *const sc, int *got_sc_eof) #define FCNAME MPIDI_QUOTE(FUNCNAME) static int send_cmd_pkt(int fd, MPIDI_nem_tcp_socksm_pkt_type_t pkt_type) { - int mpi_errno = MPI_SUCCESS, offset; + int mpi_errno = MPI_SUCCESS; + ssize_t offset; MPIDI_nem_tcp_header_t pkt; int pkt_len = sizeof(MPIDI_nem_tcp_header_t); @@ -729,7 +735,8 @@ static int send_cmd_pkt(int fd, MPIDI_nem_tcp_socksm_pkt_type_t pkt_type) #define FCNAME MPIDI_QUOTE(FUNCNAME) static int recv_cmd_pkt(int fd, MPIDI_nem_tcp_socksm_pkt_type_t *pkt_type) { - int mpi_errno = MPI_SUCCESS, nread; + int mpi_errno = MPI_SUCCESS; + ssize_t nread; MPIDI_nem_tcp_header_t pkt; int pkt_len = sizeof(MPIDI_nem_tcp_header_t); MPIDI_STATE_DECL(MPID_STATE_RECV_CMD_PKT); @@ -1597,11 +1604,11 @@ static int MPID_nem_tcp_recv_handler(sockconn_t *const sc) { iov->MPID_IOV_BUF = (char *)iov->MPID_IOV_BUF + bytes_recvd; iov->MPID_IOV_LEN -= bytes_recvd; - rreq->dev.iov_count = &rreq->dev.iov[rreq->dev.iov_offset + rreq->dev.iov_count] - iov; + rreq->dev.iov_count = (int)(&rreq->dev.iov[rreq->dev.iov_offset + rreq->dev.iov_count] - iov); rreq->dev.iov_offset = iov - rreq->dev.iov; MPIU_DBG_MSG_D(CH3_CHANNEL, VERBOSE, "bytes_recvd = %ld", (long int)bytes_recvd); MPIU_DBG_MSG_D(CH3_CHANNEL, VERBOSE, "iov len = %ld", (long int)iov->MPID_IOV_LEN); - MPIU_DBG_MSG_D(CH3_CHANNEL, VERBOSE, "iov_offset = %d", rreq->dev.iov_offset); + MPIU_DBG_MSG_D(CH3_CHANNEL, VERBOSE, "iov_offset = %lld", (long long)rreq->dev.iov_offset); goto fn_exit; } bytes_recvd -= iov->MPID_IOV_LEN; @@ -1811,7 +1818,7 @@ int MPID_nem_tcp_connpoll(int in_blocking_poll) * on many platforms, including modern Linux. */ if (it_plfd->revents & POLLERR || it_plfd->revents & POLLNVAL) { int req_errno = MPI_SUCCESS; - int rc; + ssize_t rc; char dummy; const char *err_str = "UNKNOWN"; diff --git a/src/mpid/ch3/channels/nemesis/netmod/tcp/socksm.h b/src/mpid/ch3/channels/nemesis/netmod/tcp/socksm.h index ea3e02e..270de1a 100644 --- a/src/mpid/ch3/channels/nemesis/netmod/tcp/socksm.h +++ b/src/mpid/ch3/channels/nemesis/netmod/tcp/socksm.h @@ -162,7 +162,7 @@ typedef enum MPIDI_nem_tcp_socksm_pkt_type { typedef struct MPIDI_nem_tcp_header { MPIDI_nem_tcp_socksm_pkt_type_t pkt_type; - int datalen; + MPIDI_msg_sz_t datalen; } MPIDI_nem_tcp_header_t; typedef struct MPIDI_nem_tcp_idinfo { diff --git a/src/mpid/ch3/channels/nemesis/netmod/tcp/tcp_utility.c b/src/mpid/ch3/channels/nemesis/netmod/tcp/tcp_utility.c index b4bca79..fbc9d2c 100644 --- a/src/mpid/ch3/channels/nemesis/netmod/tcp/tcp_utility.c +++ b/src/mpid/ch3/channels/nemesis/netmod/tcp/tcp_utility.c @@ -179,7 +179,8 @@ int MPID_nem_tcp_is_sock_connected(int fd) { int rc = FALSE; char buf[1]; - int buf_len = sizeof(buf)/sizeof(buf[0]), ret_recv, error=0; + int buf_len = sizeof(buf)/sizeof(buf[0]), error=0; + size_t ret_recv; socklen_t n = sizeof(error); n = sizeof(error); diff --git a/src/mpid/ch3/channels/nemesis/src/ch3_isend.c b/src/mpid/ch3/channels/nemesis/src/ch3_isend.c index 1b15039..da5141a 100644 --- a/src/mpid/ch3/channels/nemesis/src/ch3_isend.c +++ b/src/mpid/ch3/channels/nemesis/src/ch3_isend.c @@ -51,8 +51,9 @@ int MPIDI_CH3_iSend (MPIDI_VC_t *vc, MPID_Request *sreq, void * hdr, MPIDI_msg_s if (MPIDI_CH3I_Sendq_empty(MPIDI_CH3I_shm_sendq)) { + MPIU_Assert(hdr_sz <= INT_MAX); MPIU_DBG_MSG_D (CH3_CHANNEL, VERBOSE, "iSend %d", (int) hdr_sz); - mpi_errno = MPID_nem_mpich_send_header (hdr, hdr_sz, vc, &again); + mpi_errno = MPID_nem_mpich_send_header (hdr, (int)hdr_sz, vc, &again); if (mpi_errno) MPIU_ERR_POP (mpi_errno); if (again) { diff --git a/src/mpid/ch3/channels/nemesis/src/ch3_istartmsg.c b/src/mpid/ch3/channels/nemesis/src/ch3_istartmsg.c index a21219e..4e97a0a 100644 --- a/src/mpid/ch3/channels/nemesis/src/ch3_istartmsg.c +++ b/src/mpid/ch3/channels/nemesis/src/ch3_istartmsg.c @@ -55,8 +55,9 @@ int MPIDI_CH3_iStartMsg (MPIDI_VC_t *vc, void *hdr, MPIDI_msg_sz_t hdr_sz, MPID_ if (MPIDI_CH3I_Sendq_empty(MPIDI_CH3I_shm_sendq)) /* MT */ { + MPIU_Assert(hdr_sz <= INT_MAX); MPIU_DBG_MSG_D (CH3_CHANNEL, VERBOSE, "iStartMsg %d", (int) hdr_sz); - mpi_errno = MPID_nem_mpich_send_header (hdr, hdr_sz, vc, &again); + mpi_errno = MPID_nem_mpich_send_header (hdr, (int)hdr_sz, vc, &again); if (mpi_errno) MPIU_ERR_POP (mpi_errno); if (again) { diff --git a/src/mpid/ch3/channels/nemesis/src/ch3_progress.c b/src/mpid/ch3/channels/nemesis/src/ch3_progress.c index 19810fe..76a50e6 100644 --- a/src/mpid/ch3/channels/nemesis/src/ch3_progress.c +++ b/src/mpid/ch3/channels/nemesis/src/ch3_progress.c @@ -723,8 +723,8 @@ int MPID_nem_handle_pkt(MPIDI_VC_t *vc, char *buf, MPIDI_msg_sz_t buflen) while (n_iov && buflen >= iov->MPID_IOV_LEN) { - int iov_len = iov->MPID_IOV_LEN; - MPIU_DBG_MSG_D(CH3_CHANNEL, VERBOSE, " %d", iov_len); + size_t iov_len = iov->MPID_IOV_LEN; + MPIU_DBG_MSG_D(CH3_CHANNEL, VERBOSE, " %d", (int)iov_len); MPIU_Memcpy (iov->MPID_IOV_BUF, buf, iov_len); buflen -= iov_len; diff --git a/src/mpid/ch3/channels/nemesis/src/mpid_nem_debug.c b/src/mpid/ch3/channels/nemesis/src/mpid_nem_debug.c index 1ab1fe1..44dfd0b 100644 --- a/src/mpid/ch3/channels/nemesis/src/mpid_nem_debug.c +++ b/src/mpid/ch3/channels/nemesis/src/mpid_nem_debug.c @@ -20,7 +20,7 @@ void MPID_nem_dbg_dump_cell (volatile struct MPID_nem_cell *cell) MPIU_DBG_MSG_D (ALL, TERSE, " src = %6d", cell->pkt.mpich.source); MPIU_DBG_MSG_D (ALL, TERSE, " dst = %6d", cell->pkt.mpich.dest); - MPIU_DBG_MSG_D (ALL, TERSE, " len = %6d", cell->pkt.mpich.datalen); + MPIU_DBG_MSG_D (ALL, TERSE, " len = %6d", (int)cell->pkt.mpich.datalen); MPIU_DBG_MSG_D (ALL, TERSE, " sqn = %6d", cell->pkt.mpich.seqno); MPIU_DBG_MSG_D (ALL, TERSE, " typ = %6d", cell->pkt.mpich.type); diff --git a/src/mpid/ch3/channels/nemesis/src/mpid_nem_init.c b/src/mpid/ch3/channels/nemesis/src/mpid_nem_init.c index 19df691..7a45652 100644 --- a/src/mpid/ch3/channels/nemesis/src/mpid_nem_init.c +++ b/src/mpid/ch3/channels/nemesis/src/mpid_nem_init.c @@ -4,7 +4,7 @@ * See COPYRIGHT in top-level directory. */ -#include "mpid_nem_pre.h" +#include "mpiimpl.h" #include "mpid_nem_impl.h" #include "mpid_nem_nets.h" #include <errno.h> diff --git a/src/mpid/ch3/channels/nemesis/src/mpid_nem_lmt_shm.c b/src/mpid/ch3/channels/nemesis/src/mpid_nem_lmt_shm.c index 489de5c..e8ccc6d 100644 --- a/src/mpid/ch3/channels/nemesis/src/mpid_nem_lmt_shm.c +++ b/src/mpid/ch3/channels/nemesis/src/mpid_nem_lmt_shm.c @@ -494,7 +494,7 @@ static int lmt_shm_send_progress(MPIDI_VC_t *vc, MPID_Request *req, int *done) last = (data_sz - first <= copy_limit) ? data_sz : first + copy_limit; MPID_Segment_pack(req->dev.segment_ptr, first, &last, (void *)copy_buf->buf[buf_num]); /* cast away volatile */ OPA_write_barrier(); - copy_buf->len[buf_num].val = last - first; + MPIU_Assign_trunc(copy_buf->len[buf_num].val, (last - first), volatile int); first = last; buf_num = (buf_num+1) % NUM_BUFS; diff --git a/src/mpid/ch3/include/mpidpre.h b/src/mpid/ch3/include/mpidpre.h index 032670a..ec37912 100644 --- a/src/mpid/ch3/include/mpidpre.h +++ b/src/mpid/ch3/include/mpidpre.h @@ -329,7 +329,7 @@ typedef struct MPIDI_Request { iov_offset points to the current head element in the IOV */ MPID_IOV iov[MPID_IOV_LIMIT]; int iov_count; - int iov_offset; + size_t iov_offset; /* OnDataAvail is the action to take when data is now available. For example, when an operation described by an iov has diff --git a/src/mpid/ch3/include/mpidrma.h b/src/mpid/ch3/include/mpidrma.h index 26d1b17..1d354e4 100644 --- a/src/mpid/ch3/include/mpidrma.h +++ b/src/mpid/ch3/include/mpidrma.h @@ -40,7 +40,7 @@ enum MPID_Lock_state { typedef struct MPIDI_RMA_dtype_info { /* for derived datatypes */ int is_contig; int max_contig_blocks; - int size; + MPI_Aint size; MPI_Aint extent; int dataloop_size; /* not needed because this info is sent in packet header. remove it after lock/unlock diff --git a/src/mpid/ch3/src/ch3u_handle_connection.c b/src/mpid/ch3/src/ch3u_handle_connection.c index 6db836a..64a4743 100644 --- a/src/mpid/ch3/src/ch3u_handle_connection.c +++ b/src/mpid/ch3/src/ch3u_handle_connection.c @@ -423,7 +423,7 @@ static int terminate_failed_VCs(MPID_Group *new_failed_group) while (isspace(*c)) /* skip spaces */ \ ++c; \ MPIU_ERR_CHKINTERNAL(!isdigit(*c), mpi_errno, "error parsing failed process list"); \ - *(r_p) = strtol(c, &c, 0); \ + *(r_p) = (int)strtol(c, &c, 0); \ while (isspace(*c)) /* skip spaces */ \ ++c; \ } while (0) diff --git a/src/mpid/ch3/src/ch3u_handle_recv_req.c b/src/mpid/ch3/src/ch3u_handle_recv_req.c index 872cfb8..deb4138 100644 --- a/src/mpid/ch3/src/ch3u_handle_recv_req.c +++ b/src/mpid/ch3/src/ch3u_handle_recv_req.c @@ -90,7 +90,8 @@ int MPIDI_CH3_ReqHandler_PutAccumRespComplete( MPIDI_VC_t *vc, /* Perform get in get-accumulate */ if (rreq->dev.resp_request_handle != MPI_REQUEST_NULL) { - int predefined, type_size; + int predefined; + MPI_Aint type_size; MPIDI_CH3_Pkt_t upkt; MPIDI_CH3_Pkt_get_accum_resp_t *get_accum_resp_pkt = &upkt.get_accum_resp; MPID_Request *resp_req; @@ -484,7 +485,8 @@ int MPIDI_CH3_ReqHandler_FOPComplete( MPIDI_VC_t *vc, MPID_Request *resp_req; MPID_Win *win_ptr; MPI_User_function *uop; - int len, one; + MPI_Aint len; + int one; MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_REQHANDLER_FOPCOMPLETE); MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_REQHANDLER_FOPCOMPLETE); @@ -810,7 +812,8 @@ static int do_accumulate_op(MPID_Request *rreq) MPID_Segment *segp; DLOOP_VECTOR *dloop_vec; MPI_Aint first, last; - int vec_len, i, type_size, count; + int vec_len, i, count; + MPI_Aint type_size; MPI_Datatype type; MPID_Datatype *dtp; @@ -848,7 +851,7 @@ static int do_accumulate_op(MPID_Request *rreq) MPID_Datatype_get_size_macro(type, type_size); for (i=0; i<vec_len; i++) { - count = (dloop_vec[i].DLOOP_VECTOR_LEN)/type_size; + MPIU_Assign_trunc(count, (dloop_vec[i].DLOOP_VECTOR_LEN)/type_size, int); (*uop)((char *)rreq->dev.user_buf + MPIU_PtrToAint(dloop_vec[i].DLOOP_VECTOR_BUF), (char *)rreq->dev.real_user_buf + MPIU_PtrToAint(dloop_vec[i].DLOOP_VECTOR_BUF), &count, &type); @@ -1155,7 +1158,8 @@ static int do_simple_get(MPID_Win *win_ptr, MPIDI_Win_lock_queue *lock_queue) MPIDI_CH3_Pkt_get_resp_t * get_resp_pkt = &upkt.get_resp; MPID_Request *req; MPID_IOV iov[MPID_IOV_LIMIT]; - int type_size, mpi_errno=MPI_SUCCESS; + int mpi_errno=MPI_SUCCESS; + MPI_Aint type_size; MPIDI_STATE_DECL(MPID_STATE_DO_SIMPLE_GET); MPIDI_FUNC_ENTER(MPID_STATE_DO_SIMPLE_GET); diff --git a/src/mpid/ch3/src/ch3u_request.c b/src/mpid/ch3/src/ch3u_request.c index 5842b7b..8d44993 100644 --- a/src/mpid/ch3/src/ch3u_request.c +++ b/src/mpid/ch3/src/ch3u_request.c @@ -366,8 +366,8 @@ int MPIDI_CH3U_Request_load_recv_iov(MPID_Request * const rreq) rreq->dev.segment_first, &last, &rreq->dev.iov[0], &rreq->dev.iov_count); MPIU_DBG_MSG_FMT(CH3_CHANNEL,VERBOSE,(MPIU_DBG_FDEST, - "post-upv: first=" MPIDI_MSG_SZ_FMT ", last=" MPIDI_MSG_SZ_FMT ", iov_n=%d, iov_offset=%d", - rreq->dev.segment_first, last, rreq->dev.iov_count, rreq->dev.iov_offset)); + "post-upv: first=" MPIDI_MSG_SZ_FMT ", last=" MPIDI_MSG_SZ_FMT ", iov_n=%d, iov_offset=%lld", + rreq->dev.segment_first, last, rreq->dev.iov_count, (long long)rreq->dev.iov_offset)); MPIU_Assert(rreq->dev.iov_count >= 0 && rreq->dev.iov_count <= MPID_IOV_LIMIT); diff --git a/src/mpid/ch3/src/ch3u_rma_acc_ops.c b/src/mpid/ch3/src/ch3u_rma_acc_ops.c index 29a46b1..7ff08c3 100644 --- a/src/mpid/ch3/src/ch3u_rma_acc_ops.c +++ b/src/mpid/ch3/src/ch3u_rma_acc_ops.c @@ -185,7 +185,7 @@ int MPIDI_Get_accumulate(const void *origin_addr, int origin_count, type_size = MPID_Datatype_get_basic_size(type); for (i=0; i<vec_len; i++) { - count = (dloop_vec[i].DLOOP_VECTOR_LEN)/type_size; + MPIU_Assign_trunc(count, (dloop_vec[i].DLOOP_VECTOR_LEN)/type_size, int); (*uop)((char *)source_buf + MPIU_PtrToAint(dloop_vec[i].DLOOP_VECTOR_BUF), (char *)target_buf + MPIU_PtrToAint(dloop_vec[i].DLOOP_VECTOR_BUF), &count, &type); @@ -298,7 +298,7 @@ int MPIDI_Compare_and_swap(const void *origin_addr, const void *compare_addr, { void *base, *dest_addr; int disp_unit; - int len; + MPI_Aint len; if (win_ptr->create_flavor == MPI_WIN_FLAVOR_SHARED) { base = win_ptr->shm_base_addrs[target_rank]; @@ -405,7 +405,8 @@ int MPIDI_Fetch_and_op(const void *origin_addr, void *result_addr, MPI_User_function *uop; void *base, *dest_addr; int disp_unit; - int len, one; + MPI_Aint len; + int one; if (win_ptr->create_flavor == MPI_WIN_FLAVOR_SHARED) { base = win_ptr->shm_base_addrs[target_rank]; diff --git a/src/mpid/ch3/src/ch3u_rma_ops.c b/src/mpid/ch3/src/ch3u_rma_ops.c index f2fc7ca..cfaaf68 100644 --- a/src/mpid/ch3/src/ch3u_rma_ops.c +++ b/src/mpid/ch3/src/ch3u_rma_ops.c @@ -545,7 +545,7 @@ int MPIDI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype if (shm_op) MPIDI_CH3I_SHM_MUTEX_LOCK(win_ptr); for (i=0; i<vec_len; i++) { - count = (dloop_vec[i].DLOOP_VECTOR_LEN)/type_size; + MPIU_Assign_trunc(count, (dloop_vec[i].DLOOP_VECTOR_LEN)/type_size, int); (*uop)((char *)source_buf + MPIU_PtrToAint(dloop_vec[i].DLOOP_VECTOR_BUF), (char *)target_buf + MPIU_PtrToAint(dloop_vec[i].DLOOP_VECTOR_BUF), &count, &type); diff --git a/src/mpid/ch3/src/ch3u_rma_sync.c b/src/mpid/ch3/src/ch3u_rma_sync.c index 1f6cbf9..bba3853 100644 --- a/src/mpid/ch3/src/ch3u_rma_sync.c +++ b/src/mpid/ch3/src/ch3u_rma_sync.c @@ -481,7 +481,7 @@ static int create_datatype(const MPIDI_RMA_dtype_info *dtype_info, datatypes[0] = MPI_BYTE; displaces[1] = MPIU_PtrToAint(dataloop); - blocklens[1] = dataloop_sz; + MPIU_Assign_trunc(blocklens[1], dataloop_sz, int); datatypes[1] = MPI_BYTE; displaces[2] = MPIU_PtrToAint(o_addr); @@ -547,7 +547,8 @@ static int MPIDI_CH3I_Send_rma_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr, MPIDI_CH3_Pkt_accum_t *accum_pkt = &upkt.accum; MPID_IOV iov[MPID_IOV_LIMIT]; int mpi_errno=MPI_SUCCESS, predefined; - int origin_dt_derived, target_dt_derived, origin_type_size, iovcnt; + int origin_dt_derived, target_dt_derived, iovcnt; + MPI_Aint origin_type_size; MPIDI_VC_t * vc; MPID_Comm *comm_ptr; MPID_Datatype *target_dtp=NULL, *origin_dtp=NULL; @@ -862,10 +863,11 @@ static int MPIDI_CH3I_Send_contig_acc_msg(MPIDI_RMA_Op_t *rma_op, MPIDI_CH3_Pkt_accum_t *accum_pkt = &upkt.accum; MPID_IOV iov[MPID_IOV_LIMIT]; int mpi_errno=MPI_SUCCESS; - int origin_type_size, iovcnt; + int iovcnt; + MPI_Aint origin_type_size; MPIDI_VC_t * vc; MPID_Comm *comm_ptr; - int len; + size_t len; MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_SEND_CONTIG_ACC_MSG); MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_SEND_CONTIG_ACC_MSG); @@ -874,7 +876,7 @@ static int MPIDI_CH3I_Send_contig_acc_msg(MPIDI_RMA_Op_t *rma_op, MPID_Datatype_get_size_macro(rma_op->origin_datatype, origin_type_size); /* FIXME: Make this size check efficient and match the packet type */ - len = rma_op->origin_count * origin_type_size; + MPIU_Assign_trunc(len, rma_op->origin_count * origin_type_size, size_t); if (MPIR_PARAM_RMA_ACC_IMMED && len <= MPIDI_RMA_IMMED_INTS*sizeof(int)) { MPIDI_CH3_Pkt_accum_immed_t * accumi_pkt = &upkt.accum_immed; void *dest = accumi_pkt->data, *src = rma_op->origin_addr; @@ -977,7 +979,7 @@ static int MPIDI_CH3I_Send_immed_rmw_msg(MPIDI_RMA_Op_t *rma_op, MPID_Request *rmw_req = NULL, *resp_req = NULL; MPIDI_VC_t *vc; MPID_Comm *comm_ptr; - int len; + MPI_Aint len; MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_SEND_IMMED_RMW_MSG); MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_SEND_IMMED_RMW_MSG); @@ -2033,7 +2035,8 @@ int MPIDI_Win_unlock(int dest, MPID_Win *win_ptr) * do an optimization where the lock and the RMA operation are * sent in a single packet. Otherwise, we send a separate lock * request first. */ - int type_size, predefined; + int predefined; + MPI_Aint type_size; MPIDI_VC_t *vc; MPIDI_RMA_Op_t *curr_op = rma_op; @@ -2931,7 +2934,8 @@ static int MPIDI_CH3I_Send_lock_put_or_acc(MPID_Win *win_ptr, int target_rank) MPID_IOV iov[MPID_IOV_LIMIT]; MPID_Comm *comm_ptr; MPID_Datatype *origin_dtp=NULL; - int origin_type_size, predefined; + int predefined; + MPI_Aint origin_type_size; MPIDI_CH3_Pkt_t upkt; MPIDI_CH3_Pkt_lock_put_unlock_t *lock_put_unlock_pkt = &upkt.lock_put_unlock; @@ -3309,7 +3313,7 @@ int MPIDI_CH3_PktHandler_Put( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, MPIDI_CH3_Pkt_put_t * put_pkt = &pkt->put; MPID_Request *req = NULL; int predefined; - int type_size; + MPI_Aint type_size; int complete = 0; char *data_buf = NULL; MPIDI_msg_sz_t data_len; @@ -3481,7 +3485,7 @@ int MPIDI_CH3_PktHandler_Get( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, MPIDI_msg_sz_t data_len; MPID_Win *win_ptr; int mpi_errno = MPI_SUCCESS; - int type_size; + MPI_Aint type_size; MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PKTHANDLER_GET); MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_PKTHANDLER_GET); @@ -3616,7 +3620,7 @@ int MPIDI_CH3_PktHandler_Accumulate( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, MPIDI_msg_sz_t data_len; MPID_Win *win_ptr; int mpi_errno = MPI_SUCCESS; - int type_size; + MPI_Aint type_size; MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PKTHANDLER_ACCUMULATE); MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_PKTHANDLER_ACCUMULATE); @@ -3809,7 +3813,8 @@ int MPIDI_CH3_PktHandler_Accumulate_Immed( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, /* Data is already present */ if (accum_pkt->op == MPI_REPLACE) { /* no datatypes required */ - int len = accum_pkt->count * extent; + int len; + MPIU_Assign_trunc(len, (accum_pkt->count * extent), int); /* FIXME: use immediate copy because this is short */ MPIUI_Memcpy( accum_pkt->addr, accum_pkt->data, len ); } @@ -3865,7 +3870,7 @@ int MPIDI_CH3_PktHandler_CAS( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, MPIDI_CH3_Pkt_cas_t *cas_pkt = &pkt->cas; MPID_Win *win_ptr; MPID_Request *req; - int len; + MPI_Aint len; MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PKTHANDLER_CAS); MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_PKTHANDLER_CAS); @@ -3937,7 +3942,7 @@ int MPIDI_CH3_PktHandler_CASResp( MPIDI_VC_t *vc ATTRIBUTE((unused)), int mpi_errno = MPI_SUCCESS; MPIDI_CH3_Pkt_cas_resp_t *cas_resp_pkt = &pkt->cas_resp; MPID_Request *req; - int len; + MPI_Aint len; MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PKTHANDLER_CASRESP); MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_PKTHANDLER_CASRESP); @@ -3972,7 +3977,8 @@ int MPIDI_CH3_PktHandler_FOP( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, MPIDI_CH3_Pkt_fop_t *fop_pkt = &pkt->fop; MPID_Request *req; MPID_Win *win_ptr; - int len, data_complete = 0; + int data_complete = 0; + MPI_Aint len; MPIU_CHKPMEM_DECL(1); MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PKTHANDLER_FOP); @@ -4064,7 +4070,8 @@ int MPIDI_CH3_PktHandler_FOPResp( MPIDI_VC_t *vc ATTRIBUTE((unused)), int mpi_errno = MPI_SUCCESS; MPIDI_CH3_Pkt_fop_resp_t *fop_resp_pkt = &pkt->fop_resp; MPID_Request *req; - int len, complete = 0; + int complete = 0; + MPI_Aint len; MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PKTHANDLER_FOPRESP); MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_PKTHANDLER_FOPRESP); @@ -4127,7 +4134,7 @@ int MPIDI_CH3_PktHandler_Get_AccumResp( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, char *data_buf = NULL; MPIDI_msg_sz_t data_len; int mpi_errno = MPI_SUCCESS; - int type_size; + MPI_Aint type_size; MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PKTHANDLER_GET_ACCUM_RESP); MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_PKTHANDLER_GET_ACCUM_RESP); @@ -4255,7 +4262,7 @@ int MPIDI_CH3_PktHandler_LockPutUnlock( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, &pkt->lock_put_unlock; MPID_Win *win_ptr = NULL; MPID_Request *req = NULL; - int type_size; + MPI_Aint type_size; int complete; char *data_buf = NULL; MPIDI_msg_sz_t data_len; @@ -4402,7 +4409,7 @@ int MPIDI_CH3_PktHandler_LockGetUnlock( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, MPIDI_CH3_Pkt_lock_get_unlock_t * lock_get_unlock_pkt = &pkt->lock_get_unlock; MPID_Win *win_ptr = NULL; - int type_size; + MPI_Aint type_size; int mpi_errno = MPI_SUCCESS; MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PKTHANDLER_LOCKGETUNLOCK); @@ -4521,7 +4528,7 @@ int MPIDI_CH3_PktHandler_LockAccumUnlock( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, MPID_Request *req = NULL; MPID_Win *win_ptr = NULL; MPIDI_Win_lock_queue *curr_ptr = NULL, *prev_ptr = NULL, *new_ptr = NULL; - int type_size; + MPI_Aint type_size; int complete; char *data_buf = NULL; MPIDI_msg_sz_t data_len; @@ -4655,7 +4662,7 @@ int MPIDI_CH3_PktHandler_GetResp( MPIDI_VC_t *vc ATTRIBUTE((unused)), char *data_buf = NULL; MPIDI_msg_sz_t data_len; int mpi_errno = MPI_SUCCESS; - int type_size; + MPI_Aint type_size; MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PKTHANDLER_GETRESP); MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_PKTHANDLER_GETRESP); diff --git a/src/mpid/ch3/src/mpid_vc.c b/src/mpid/ch3/src/mpid_vc.c index 0d4afa6..52fda47 100644 --- a/src/mpid/ch3/src/mpid_vc.c +++ b/src/mpid/ch3/src/mpid_vc.c @@ -919,7 +919,7 @@ static int parse_mapping(char *map_str, mapping_type_t *type, map_block_t **map, if (!isdigit(*c)) parse_error(); - (*map)[i].start_id = strtol(c, &c, 0); + (*map)[i].start_id = (int)strtol(c, &c, 0); skip_space(c); expect_and_skip_c(c, ','); @@ -927,7 +927,7 @@ static int parse_mapping(char *map_str, mapping_type_t *type, map_block_t **map, if (!isdigit(*c)) parse_error(); - (*map)[i].count = strtol(c, &c, 0); + (*map)[i].count = (int)strtol(c, &c, 0); skip_space(c); expect_and_skip_c(c, ','); @@ -935,7 +935,7 @@ static int parse_mapping(char *map_str, mapping_type_t *type, map_block_t **map, if (!isdigit(*c)) parse_error(); - (*map)[i].size = strtol(c, &c, 0); + (*map)[i].size = (int)strtol(c, &c, 0); expect_and_skip_c(c, ')'); skip_space(c); diff --git a/src/mpid/ch3/src/mpidi_isend_self.c b/src/mpid/ch3/src/mpidi_isend_self.c index 8ec7f82..a18ec48 100644 --- a/src/mpid/ch3/src/mpidi_isend_self.c +++ b/src/mpid/ch3/src/mpidi_isend_self.c @@ -85,7 +85,7 @@ int MPIDI_Isend_self(const void * buf, int count, MPI_Datatype datatype, int ran { if (type != MPIDI_REQUEST_TYPE_RSEND) { - int dt_sz; + MPI_Aint dt_sz; /* FIXME: Insert code here to buffer small sends in a temporary buffer? */ diff --git a/src/mpid/common/datatype/dataloop/segment_packunpack.c b/src/mpid/common/datatype/dataloop/segment_packunpack.c index 661bd93..8ed64ad 100644 --- a/src/mpid/common/datatype/dataloop/segment_packunpack.c +++ b/src/mpid/common/datatype/dataloop/segment_packunpack.c @@ -166,8 +166,8 @@ int PREPEND_PREFIX(Segment_vector_m2m)(DLOOP_Offset *blocks_p, cbufp = (char*) paramp->userbuf + rel_off; DLOOP_Handle_get_size_macro(el_type, el_size); - whole_count = (blksz > 0) ? (*blocks_p / (DLOOP_Offset) blksz) : 0; - blocks_left = (blksz > 0) ? (*blocks_p % (DLOOP_Offset) blksz) : 0; + whole_count = (DLOOP_Count)((blksz > 0) ? (*blocks_p / (DLOOP_Offset) blksz) : 0); + blocks_left = (DLOOP_Count)((blksz > 0) ? (*blocks_p % (DLOOP_Offset) blksz) : 0); if (paramp->direction == DLOOP_M2M_TO_USERBUF) { if (el_size == 8 @@ -295,7 +295,8 @@ int PREPEND_PREFIX(Segment_blkidx_m2m)(DLOOP_Offset *blocks_p, rel_off + offsetarray[curblock]); cbufp = (char*) paramp->userbuf + rel_off + offsetarray[curblock]; - if (blocklen > blocks_left) blocklen = blocks_left; + /* TODO check for truncation b/c of DLOOP_Offset-->DLOOP_Count */ + if (blocklen > blocks_left) blocklen = (DLOOP_Count)blocks_left; if (paramp->direction == DLOOP_M2M_TO_USERBUF) { src = paramp->streambuf; diff --git a/src/mpid/common/datatype/dataloop/veccpy.h b/src/mpid/common/datatype/dataloop/veccpy.h index ea138a8..e1afabb 100644 --- a/src/mpid/common/datatype/dataloop/veccpy.h +++ b/src/mpid/common/datatype/dataloop/veccpy.h @@ -56,23 +56,26 @@ type * tmp_src = l_src; \ register int _i, j, k; \ unsigned long total_count = count * nelms; \ - const DLOOP_Offset l_stride = stride; \ + const DLOOP_Offset l_stride = stride; \ \ + DLOOP_Assert(stride <= INT_MAX); \ + DLOOP_Assert(total_count <= INT_MAX); \ + DLOOP_Assert(nelms <= INT_MAX); \ if (nelms == 1) { \ - for (_i = total_count; _i; _i--) { \ + for (_i = (int)total_count; _i; _i--) { \ *l_dest++ = *l_src; \ l_src += l_stride; \ } \ } \ else if (nelms == 2) { \ - for (_i = total_count; _i; _i -= 2) { \ + for (_i = (int)total_count; _i; _i -= 2) { \ *l_dest++ = l_src[0]; \ *l_dest++ = l_src[1]; \ l_src += l_stride; \ } \ } \ else if (nelms == 3) { \ - for (_i = total_count; _i; _i -= 3) { \ + for (_i = (int)total_count; _i; _i -= 3) { \ *l_dest++ = l_src[0]; \ *l_dest++ = l_src[1]; \ *l_dest++ = l_src[2]; \ @@ -80,7 +83,7 @@ } \ } \ else if (nelms == 4) { \ - for (_i = total_count; _i; _i -= 4) { \ + for (_i = (int)total_count; _i; _i -= 4) { \ *l_dest++ = l_src[0]; \ *l_dest++ = l_src[1]; \ *l_dest++ = l_src[2]; \ @@ -89,7 +92,7 @@ } \ } \ else if (nelms == 5) { \ - for (_i = total_count; _i; _i -= 5) { \ + for (_i = (int)total_count; _i; _i -= 5) { \ *l_dest++ = l_src[0]; \ *l_dest++ = l_src[1]; \ *l_dest++ = l_src[2]; \ @@ -99,7 +102,7 @@ } \ } \ else if (nelms == 6) { \ - for (_i = total_count; _i; _i -= 6) { \ + for (_i = (int)total_count; _i; _i -= 6) { \ *l_dest++ = l_src[0]; \ *l_dest++ = l_src[1]; \ *l_dest++ = l_src[2]; \ @@ -110,7 +113,7 @@ } \ } \ else if (nelms == 7) { \ - for (_i = total_count; _i; _i -= 7) { \ + for (_i = (int)total_count; _i; _i -= 7) { \ *l_dest++ = l_src[0]; \ *l_dest++ = l_src[1]; \ *l_dest++ = l_src[2]; \ @@ -122,7 +125,7 @@ } \ } \ else if (nelms == 8) { \ - for (_i = total_count; _i; _i -= 8) { \ + for (_i = (int)total_count; _i; _i -= 8) { \ *l_dest++ = l_src[0]; \ *l_dest++ = l_src[1]; \ *l_dest++ = l_src[2]; \ @@ -135,10 +138,10 @@ } \ } \ else { \ - _i = total_count; \ + _i = (int)total_count; \ while (_i) { \ tmp_src = l_src; \ - j = nelms; \ + j = (int)nelms; \ while (j >= 8) { \ *l_dest++ = tmp_src[0]; \ *l_dest++ = tmp_src[1]; \ @@ -170,21 +173,24 @@ unsigned long total_count = count * nelms; \ const DLOOP_Offset l_stride = stride; \ \ + DLOOP_Assert(stride <= INT_MAX); \ + DLOOP_Assert(total_count <= INT_MAX); \ + DLOOP_Assert(nelms <= INT_MAX); \ if (nelms == 1) { \ - for (_i = total_count; _i; _i--) { \ + for (_i = (int)total_count; _i; _i--) { \ *l_dest++ = *l_src; \ l_src = (type *) ((char *) l_src + l_stride); \ } \ } \ else if (nelms == 2) { \ - for (_i = total_count; _i; _i -= 2) { \ + for (_i = (int)total_count; _i; _i -= 2) { \ *l_dest++ = l_src[0]; \ *l_dest++ = l_src[1]; \ l_src = (type *) ((char *) l_src + l_stride); \ } \ } \ else if (nelms == 3) { \ - for (_i = total_count; _i; _i -= 3) { \ + for (_i = (int)total_count; _i; _i -= 3) { \ *l_dest++ = l_src[0]; \ *l_dest++ = l_src[1]; \ *l_dest++ = l_src[2]; \ @@ -192,7 +198,7 @@ } \ } \ else if (nelms == 4) { \ - for (_i = total_count; _i; _i -= 4) { \ + for (_i = (int)total_count; _i; _i -= 4) { \ *l_dest++ = l_src[0]; \ *l_dest++ = l_src[1]; \ *l_dest++ = l_src[2]; \ @@ -201,7 +207,7 @@ } \ } \ else if (nelms == 5) { \ - for (_i = total_count; _i; _i -= 5) { \ + for (_i = (int)total_count; _i; _i -= 5) { \ *l_dest++ = l_src[0]; \ *l_dest++ = l_src[1]; \ *l_dest++ = l_src[2]; \ @@ -211,7 +217,7 @@ } \ } \ else if (nelms == 6) { \ - for (_i = total_count; _i; _i -= 6) { \ + for (_i = (int)total_count; _i; _i -= 6) { \ *l_dest++ = l_src[0]; \ *l_dest++ = l_src[1]; \ *l_dest++ = l_src[2]; \ @@ -222,7 +228,7 @@ } \ } \ else if (nelms == 7) { \ - for (_i = total_count; _i; _i -= 7) { \ + for (_i = (int)total_count; _i; _i -= 7) { \ *l_dest++ = l_src[0]; \ *l_dest++ = l_src[1]; \ *l_dest++ = l_src[2]; \ @@ -234,7 +240,7 @@ } \ } \ else if (nelms == 8) { \ - for (_i = total_count; _i; _i -= 8) { \ + for (_i = (int)total_count; _i; _i -= 8) { \ *l_dest++ = l_src[0]; \ *l_dest++ = l_src[1]; \ *l_dest++ = l_src[2]; \ @@ -247,10 +253,10 @@ } \ } \ else { \ - _i = total_count; \ + _i = (int)total_count; \ while (_i) { \ tmp_src = l_src; \ - j = nelms; \ + j = (int)nelms; \ while (j >= 8) { \ *l_dest++ = tmp_src[0]; \ *l_dest++ = tmp_src[1]; \ @@ -282,21 +288,24 @@ unsigned long total_count = count * nelms; \ const DLOOP_Offset l_stride = stride; \ \ + DLOOP_Assert(stride <= INT_MAX); \ + DLOOP_Assert(total_count <= INT_MAX); \ + DLOOP_Assert(nelms <= INT_MAX); \ if (nelms == 1) { \ - for (_i = total_count; _i; _i--) { \ + for (_i = (int)total_count; _i; _i--) { \ *l_dest = *l_src++; \ l_dest += l_stride; \ } \ } \ else if (nelms == 2) { \ - for (_i = total_count; _i; _i -= 2) { \ + for (_i = (int)total_count; _i; _i -= 2) { \ l_dest[0] = *l_src++; \ l_dest[1] = *l_src++; \ l_dest += l_stride; \ } \ } \ else if (nelms == 3) { \ - for (_i = total_count; _i; _i -= 3) { \ + for (_i = (int)total_count; _i; _i -= 3) { \ l_dest[0] = *l_src++; \ l_dest[1] = *l_src++; \ l_dest[2] = *l_src++; \ @@ -304,7 +313,7 @@ } \ } \ else if (nelms == 4) { \ - for (_i = total_count; _i; _i -= 4) { \ + for (_i = (int)total_count; _i; _i -= 4) { \ l_dest[0] = *l_src++; \ l_dest[1] = *l_src++; \ l_dest[2] = *l_src++; \ @@ -313,7 +322,7 @@ } \ } \ else if (nelms == 5) { \ - for (_i = total_count; _i; _i -= 5) { \ + for (_i = (int)total_count; _i; _i -= 5) { \ l_dest[0] = *l_src++; \ l_dest[1] = *l_src++; \ l_dest[2] = *l_src++; \ @@ -323,7 +332,7 @@ } \ } \ else if (nelms == 6) { \ - for (_i = total_count; _i; _i -= 6) { \ + for (_i = (int)total_count; _i; _i -= 6) { \ l_dest[0] = *l_src++; \ l_dest[1] = *l_src++; \ l_dest[2] = *l_src++; \ @@ -334,7 +343,7 @@ } \ } \ else if (nelms == 7) { \ - for (_i = total_count; _i; _i -= 7) { \ + for (_i = (int)total_count; _i; _i -= 7) { \ l_dest[0] = *l_src++; \ l_dest[1] = *l_src++; \ l_dest[2] = *l_src++; \ @@ -346,7 +355,7 @@ } \ } \ else if (nelms == 8) { \ - for (_i = total_count; _i; _i -= 8) { \ + for (_i = (int)total_count; _i; _i -= 8) { \ l_dest[0] = *l_src++; \ l_dest[1] = *l_src++; \ l_dest[2] = *l_src++; \ @@ -359,10 +368,10 @@ } \ } \ else { \ - _i = total_count; \ + _i = (int)total_count; \ while (_i) { \ tmp_dest = l_dest; \ - j = nelms; \ + j = (int)nelms; \ while (j >= 8) { \ tmp_dest[0] = *l_src++; \ tmp_dest[1] = *l_src++; \ @@ -392,23 +401,26 @@ type * tmp_dest = l_dest; \ register int _i, j, k; \ unsigned long total_count = count * nelms; \ - const DLOOP_Offset l_stride = stride; \ + const DLOOP_Offset l_stride = stride; \ \ + DLOOP_Assert(stride <= INT_MAX); \ + DLOOP_Assert(total_count <= INT_MAX); \ + DLOOP_Assert(nelms <= INT_MAX); \ if (nelms == 1) { \ - for (_i = total_count; _i; _i--) { \ + for (_i = (int)total_count; _i; _i--) { \ *l_dest = *l_src++; \ l_dest = (type *) ((char *) l_dest + l_stride); \ } \ } \ else if (nelms == 2) { \ - for (_i = total_count; _i; _i -= 2) { \ + for (_i = (int)total_count; _i; _i -= 2) { \ l_dest[0] = *l_src++; \ l_dest[1] = *l_src++; \ l_dest = (type *) ((char *) l_dest + l_stride); \ } \ } \ else if (nelms == 3) { \ - for (_i = total_count; _i; _i -= 3) { \ + for (_i = (int)total_count; _i; _i -= 3) { \ l_dest[0] = *l_src++; \ l_dest[1] = *l_src++; \ l_dest[2] = *l_src++; \ @@ -416,7 +428,7 @@ } \ } \ else if (nelms == 4) { \ - for (_i = total_count; _i; _i -= 4) { \ + for (_i = (int)total_count; _i; _i -= 4) { \ l_dest[0] = *l_src++; \ l_dest[1] = *l_src++; \ l_dest[2] = *l_src++; \ @@ -425,7 +437,7 @@ } \ } \ else if (nelms == 5) { \ - for (_i = total_count; _i; _i -= 5) { \ + for (_i = (int)total_count; _i; _i -= 5) { \ l_dest[0] = *l_src++; \ l_dest[1] = *l_src++; \ l_dest[2] = *l_src++; \ @@ -435,7 +447,7 @@ } \ } \ else if (nelms == 6) { \ - for (_i = total_count; _i; _i -= 6) { \ + for (_i = (int)total_count; _i; _i -= 6) { \ l_dest[0] = *l_src++; \ l_dest[1] = *l_src++; \ l_dest[2] = *l_src++; \ @@ -446,7 +458,7 @@ } \ } \ else if (nelms == 7) { \ - for (_i = total_count; _i; _i -= 7) { \ + for (_i = (int)total_count; _i; _i -= 7) { \ l_dest[0] = *l_src++; \ l_dest[1] = *l_src++; \ l_dest[2] = *l_src++; \ @@ -458,7 +470,7 @@ } \ } \ else if (nelms == 8) { \ - for (_i = total_count; _i; _i -= 8) { \ + for (_i = (int)total_count; _i; _i -= 8) { \ l_dest[0] = *l_src++; \ l_dest[1] = *l_src++; \ l_dest[2] = *l_src++; \ @@ -471,10 +483,10 @@ } \ } \ else { \ - _i = total_count; \ + _i = (int)total_count; \ while (_i) { \ tmp_dest = l_dest; \ - j = nelms; \ + j = (int)nelms; \ while (j >= 8) { \ tmp_dest[0] = *l_src++; \ tmp_dest[1] = *l_src++; \ diff --git a/src/mpid/common/datatype/mpid_datatype.h b/src/mpid/common/datatype/mpid_datatype.h index 22041b2..84ad551 100644 --- a/src/mpid/common/datatype/mpid_datatype.h +++ b/src/mpid/common/datatype/mpid_datatype.h @@ -358,7 +358,7 @@ typedef struct MPID_Datatype { MPIU_OBJECT_HEADER; /* adds handle and ref_count fields */ /* basic parameters for datatype, accessible via MPI calls */ - int size; + MPI_Aint size; MPI_Aint extent, ub, lb, true_ub, true_lb; /* chars affecting subsequent datatype processing and creation */ diff --git a/src/mpid/common/datatype/mpid_type_indexed.c b/src/mpid/common/datatype/mpid_type_indexed.c index 48d4642..0e3e259 100644 --- a/src/mpid/common/datatype/mpid_type_indexed.c +++ b/src/mpid/common/datatype/mpid_type_indexed.c @@ -41,7 +41,8 @@ int MPID_Type_indexed(int count, int mpi_errno = MPI_SUCCESS; int is_builtin, old_is_contig; int i, contig_count; - int el_sz, el_ct, old_ct, old_sz; + int el_ct, old_ct; + MPI_Aint el_sz, old_sz; MPI_Aint old_lb, old_ub, old_extent, old_true_lb, old_true_ub; MPI_Aint min_lb = 0, max_ub = 0, eff_disp; MPI_Datatype el_type; @@ -109,8 +110,8 @@ int MPID_Type_indexed(int count, new_dtp->has_sticky_ub = 0; new_dtp->has_sticky_lb = 0; - new_dtp->alignsize = el_sz; /* ??? */ - new_dtp->element_size = (MPI_Aint) el_sz; + MPIU_Assign_trunc(new_dtp->alignsize, el_sz, int); + new_dtp->element_size = el_sz; new_dtp->eltype = el_type; new_dtp->max_contig_blocks = count; diff --git a/src/mpid/common/sched/mpid_sched.c b/src/mpid/common/sched/mpid_sched.c index a07e8e1..d44412a 100644 --- a/src/mpid/common/sched/mpid_sched.c +++ b/src/mpid/common/sched/mpid_sched.c @@ -122,7 +122,7 @@ fn_fail: /* initiates the schedule entry "e" in the NBC described by "s", where * "e" is at "idx" in "s". This means posting nonblocking sends/recvs, * performing reductions, calling callbacks, etc. */ -static int MPIDU_Sched_start_entry(struct MPIDU_Sched *s, int idx, struct MPIDU_Sched_entry *e) +static int MPIDU_Sched_start_entry(struct MPIDU_Sched *s, size_t idx, struct MPIDU_Sched_entry *e) { int mpi_errno = MPI_SUCCESS; int context_offset; @@ -237,7 +237,7 @@ fn_fail: static int MPIDU_Sched_continue(struct MPIDU_Sched *s) { int mpi_errno = MPI_SUCCESS; - int i; + size_t i; for (i = s->idx; i < s->num_entries; ++i) { struct MPIDU_Sched_entry *e = &s->entries[i]; @@ -680,12 +680,12 @@ int MPID_Sched_copy(const void *inbuf, int incount, MPI_Datatype intype, /* some sanity checking up front */ #if defined(HAVE_ERROR_CHECKING) && !defined(NDEBUG) { - int intype_size, outtype_size; + MPI_Aint intype_size, outtype_size; MPID_Datatype_get_size_macro(intype, intype_size); MPID_Datatype_get_size_macro(outtype, outtype_size); if (incount * intype_size > outcount * outtype_size) { - MPIU_Error_printf("truncation: intype=%#x, intype_size=%d, incount=%d, outtype=%#x, outtype_size=%d outcount=%d\n", - intype, intype_size, incount, outtype, outtype_size, outcount); + MPIU_Error_printf("truncation: intype=%#x, intype_size=%lld, incount=%d, outtype=%#x, outtype_size=%lld outcount=%d\n", + intype, (long long)intype_size, incount, outtype, (long long)outtype_size, outcount); } } #endif @@ -787,7 +787,7 @@ fn_fail: static int MPIDU_Sched_progress_state(struct MPIDU_Sched_state *state, int *made_progress) { int mpi_errno = MPI_SUCCESS; - int i; + size_t i; struct MPIDU_Sched *s; struct MPIDU_Sched *tmp; diff --git a/src/util/dbg/dbg_printf.c b/src/util/dbg/dbg_printf.c index 0810ca0..dc674ee 100644 --- a/src/util/dbg/dbg_printf.c +++ b/src/util/dbg/dbg_printf.c @@ -625,7 +625,7 @@ static int MPIU_DBG_ProcessArgs( int *argc_p, char ***argv_p ) if (*p == '=' && p[1] != 0) { char *sOut; p++; - whichRank = strtol( p, &sOut, 10 ); + whichRank = (int)strtol( p, &sOut, 10 ); if (p == sOut) { MPIU_DBG_Usage( "-mpich-dbg-rank", 0 ); whichRank = -1; @@ -678,7 +678,7 @@ static int MPIU_DBG_ProcessEnv( void ) s = getenv( "MPICH_DBG_RANK" ); if (s) { char *sOut; - whichRank = strtol( s, &sOut, 10 ); + whichRank = (int)strtol( s, &sOut, 10 ); if (s == sOut) { MPIU_DBG_Usage( "MPICH_DBG_RANK", 0 ); whichRank = -1; @@ -1129,17 +1129,17 @@ static int MPIU_DBG_OpenFile(FILE **dbg_fp) static int setDBGClass( const char *s ) { int i; - int slen = 0; - int len = 0; - + size_t slen = 0; + size_t len = 0; + if (s && *s) slen = strlen(s); while (s && *s) { for (i=0; MPIU_Classnames[i].LCName; i++) { /* The LCLen and UCLen *should* be the same, but just in case, we separate them */ - int LClen = strlen(MPIU_Classnames[i].LCName); - int UClen = strlen(MPIU_Classnames[i].UCName); + size_t LClen = strlen(MPIU_Classnames[i].LCName); + size_t UClen = strlen(MPIU_Classnames[i].UCName); int matchClass = 0; /* Allow the upper case and lower case in all cases */ diff --git a/src/util/instrm/instr.c b/src/util/instrm/instr.c index cf94ed4..340cc3a 100644 --- a/src/util/instrm/instr.c +++ b/src/util/instrm/instr.c @@ -116,7 +116,7 @@ int MPIU_INSTR_ToStr_Duration_Count( char *buf, size_t maxBuf, void *ptr ) snprintf( buf, maxBuf, "%-40s:\t%d\t%e", dPtr->desc, dPtr->count, ttime ); if (dPtr->nitems) { char *p; - int len = strlen(buf); + size_t len = strlen(buf); int i; /* Add each integer value, separated by a tab. */ maxBuf -= len; diff --git a/src/util/wrappers/mpiu_shm_wrappers.h b/src/util/wrappers/mpiu_shm_wrappers.h index 02774e4..3224faf 100644 --- a/src/util/wrappers/mpiu_shm_wrappers.h +++ b/src/util/wrappers/mpiu_shm_wrappers.h @@ -301,7 +301,7 @@ fn_fail: #undef FCNAME #define FCNAME MPIU_QUOTE(FUNCNAME) static inline int MPIU_SHMW_Hnd_deserialize( - MPIU_SHMW_Hnd_t hnd, const char *str_hnd, int str_hnd_len) + MPIU_SHMW_Hnd_t hnd, const char *str_hnd, size_t str_hnd_len) { int mpi_errno = MPI_SUCCESS; int rc = -1; @@ -615,7 +615,7 @@ static inline int MPIU_SHMW_Seg_create_attach_templ( MPI_ERR_OTHER, "**lseek", "**lseek %s", MPIU_OSW_Strerror(MPIU_OSW_Get_errno())); - MPIU_OSW_RETRYON_INTR((rc == -1), (rc = write(lhnd, "", 1))); + MPIU_OSW_RETRYON_INTR((rc == -1), (rc = (int)write(lhnd, "", 1))); MPIU_ERR_CHKANDJUMP((rc == -1), mpi_errno, MPI_ERR_OTHER, "**write"); ----------------------------------------------------------------------- hooks/post-receive -- MPICH primary repository
participants (1)
-
noreply@mpich.org