Commit d1bf4161 authored by Dave Goodell's avatar Dave Goodell Committed by Rob Latham
Browse files

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.
Signed-off-by: Pavan Balaji's avatarPavan Balaji <balaji@mcs.anl.gov>
parent 4f691ba8
......@@ -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); \
......
......@@ -195,7 +195,10 @@ int MPIR_Assert_fail_fmt(const char *cond, const char *file_name, int line_num,
unsigned short: USHRT_MAX, \
unsigned int: UINT_MAX, \
unsigned long: ULONG_MAX, \
unsigned long long: ULLONG_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, \
......@@ -207,7 +210,10 @@ int MPIR_Assert_fail_fmt(const char *cond, const char *file_name, int line_num,
unsigned short: 0, \
unsigned int: 0, \
unsigned long: 0, \
unsigned long 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
......
......@@ -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 */
......
......@@ -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 nbytes = 0;
......
......@@ -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;
......
......@@ -455,7 +455,7 @@ void MPIR_T_strncpy(char *dst, const char *src, int *len)
MPIU_Assert(*len > 0);
if (src != NULL) {
MPL_strncpy(dst, src, *len);
*len = strlen(dst) + 1;
*len = (int)strlen(dst) + 1;
} else {
/* As if an empty string is copied */
*dst = '\0';
......
......@@ -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
......
......@@ -217,7 +217,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;
......@@ -352,7 +352,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;
......
......@@ -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";
......
......@@ -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 {
......
......@@ -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);
......
......@@ -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)
{
......
......@@ -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)
{
......
......@@ -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;
......
......@@ -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);
......
......@@ -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>
......
......@@ -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;
......
......@@ -340,7 +340,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
......
......@@ -47,7 +47,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
......@@ -707,7 +707,8 @@ static inline int MPIDI_CH3I_Shm_acc_op(const void *origin_addr, int origin_coun
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);
......@@ -866,7 +867,7 @@ static inline int MPIDI_CH3I_Shm_get_acc_op(const void *origin_addr, int origin_
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);
......@@ -943,7 +944,8 @@ static inline int MPIDI_CH3I_Shm_cas_op(const void *origin_addr, const void *com
{
void *base = NULL, *dest_addr = NULL;
int disp_unit;
int len, shm_locked = 0;
MPI_Aint len;
int shm_locked = 0;
int mpi_errno = MPI_SUCCESS;
MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_SHM_CAS_OP);
......@@ -999,7 +1001,8 @@ static inline int MPIDI_CH3I_Shm_fop_op(const void *origin_addr, void *result_ad
void *base = NULL, *dest_addr = NULL;
MPI_User_function *uop = NULL;
int disp_unit;
int len, one, shm_locked = 0;
MPI_Aint len;
int one, shm_locked = 0;
int mpi_errno = MPI_SUCCESS;
MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_SHM_FOP_OP);
......
......@@ -424,7 +424,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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment