Skip to content

Commit

Permalink
Merge pull request open-mpi#10423 from markalle/nbc_counts_v40x
Browse files Browse the repository at this point in the history
Nbc counts v40x
  • Loading branch information
gpaulsen authored Jun 6, 2022
2 parents 9acb25c + e09ee72 commit aa2514c
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 33 deletions.
10 changes: 5 additions & 5 deletions ompi/mca/coll/libnbc/nbc_iallgather.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2017-2022 IBM Corporation. All rights reserved.
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -72,7 +72,7 @@ static int nbc_allgather_init(const void* sendbuf, int sendcount, MPI_Datatype s
sendcount = recvcount;
} else if (!persistent) { /* for persistent, the copy must be scheduled */
/* copy my data to receive buffer */
rbuf = (char *) recvbuf + rank * recvcount * rcvext;
rbuf = (char *) recvbuf + (MPI_Aint)rcvext * rank * recvcount;
res = NBC_Copy (sendbuf, sendcount, sendtype, rbuf, recvcount, recvtype, comm);
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
return res;
Expand All @@ -98,7 +98,7 @@ static int nbc_allgather_init(const void* sendbuf, int sendcount, MPI_Datatype s
return OMPI_ERR_OUT_OF_RESOURCE;
}

sbuf = (char *)recvbuf + rank * recvcount * rcvext;
sbuf = (char *)recvbuf + (MPI_Aint) rcvext * rank * recvcount;

if (persistent && !inplace) { /* for nonblocking, data has been copied already */
/* copy my data to receive buffer (= send buffer of NBC_Sched_send) */
Expand All @@ -114,7 +114,7 @@ static int nbc_allgather_init(const void* sendbuf, int sendcount, MPI_Datatype s
for(int r = 0 ; r < p ; ++r) {
if(r != rank) {
/* recv from rank r */
rbuf = (char *)recvbuf + r * recvcount * rcvext;
rbuf = (char *)recvbuf + (MPI_Aint) rcvext * r * recvcount;
res = NBC_Sched_recv (rbuf, false, recvcount, recvtype, r, schedule, false);
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
OBJ_RELEASE(schedule);
Expand Down Expand Up @@ -221,7 +221,7 @@ static int nbc_allgather_inter_init(const void* sendbuf, int sendcount, MPI_Data
/* do rsize - 1 rounds */
for (int r = 0 ; r < rsize ; ++r) {
/* recv from rank r */
rbuf = (char *) recvbuf + r * recvcount * rcvext;
rbuf = (char *) recvbuf + (MPI_Aint) rcvext * r * recvcount;
res = NBC_Sched_recv (rbuf, false, recvcount, recvtype, r, schedule, false);
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
OBJ_RELEASE(schedule);
Expand Down
12 changes: 6 additions & 6 deletions ompi/mca/coll/libnbc/nbc_ialltoall.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Copyright (c) 2014 NVIDIA Corporation. All rights reserved.
* Copyright (c) 2014-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2017-2022 IBM Corporation. All rights reserved.
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -331,14 +331,14 @@ static int nbc_alltoall_inter_init (const void* sendbuf, int sendcount, MPI_Data

for (int i = 0; i < rsize; i++) {
/* post all sends */
sbuf = (char *) sendbuf + i * sendcount * sndext;
sbuf = (char *) sendbuf + (MPI_Aint) sndext * i * sendcount;
res = NBC_Sched_send (sbuf, false, sendcount, sendtype, i, schedule, false);
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
break;
}

/* post all receives */
rbuf = (char *) recvbuf + i * recvcount * rcvext;
rbuf = (char *) recvbuf + (MPI_Aint) rcvext * i * recvcount;
res = NBC_Sched_recv (rbuf, false, recvcount, recvtype, i, schedule, false);
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
break;
Expand Down Expand Up @@ -397,13 +397,13 @@ static inline int a2a_sched_pairwise(int rank, int p, MPI_Aint sndext, MPI_Aint
int sndpeer = (rank + r) % p;
int rcvpeer = (rank - r + p) % p;

char *rbuf = (char *) recvbuf + rcvpeer * recvcount * rcvext;
char *rbuf = (char *) recvbuf + (MPI_Aint) rcvext * rcvpeer * recvcount;
res = NBC_Sched_recv (rbuf, false, recvcount, recvtype, rcvpeer, schedule, false);
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
return res;
}

char *sbuf = (char *) sendbuf + sndpeer * sendcount * sndext;
char *sbuf = (char *) sendbuf + (MPI_Aint) sndext * sndpeer * sendcount;
res = NBC_Sched_send (sbuf, false, sendcount, sendtype, sndpeer, schedule, true);
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
return res;
Expand Down Expand Up @@ -523,7 +523,7 @@ static inline int a2a_sched_diss(int rank, int p, MPI_Aint sndext, MPI_Aint rcve

/* phase 3 - reorder - data is now in wrong order in tmpbuf - reorder it into recvbuf */
for (int i = 0 ; i < p; ++i) {
rbuf = (char *) recvbuf + ((rank - i + p) % p) * recvcount * rcvext;
rbuf = (char *) recvbuf + (MPI_Aint) rcvext * ((rank - i + p) % p) * recvcount;
res = NBC_Sched_unpack ((void *)(intptr_t) (i * datasize), true, recvcount, recvtype, rbuf, false, schedule,
false);
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
Expand Down
6 changes: 3 additions & 3 deletions ompi/mca/coll/libnbc/nbc_ibcast.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
* Copyright (c) 2016-2022 IBM Corporation. All rights reserved.
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -307,11 +307,11 @@ static inline int bcast_sched_chain(int rank, int p, int root, NBC_Schedule *sch
fragcount = count/numfrag;

for (int fragnum = 0 ; fragnum < numfrag ; ++fragnum) {
buf = (char *) buffer + fragnum * fragcount * ext;
buf = (char *) buffer + (MPI_Aint)ext * fragnum * fragcount;
thiscount = fragcount;
if (fragnum == numfrag-1) {
/* last fragment may not be full */
thiscount = count - fragcount * fragnum;
thiscount = count - (size_t)fragcount * fragnum;
}

/* root does not receive */
Expand Down
6 changes: 3 additions & 3 deletions ompi/mca/coll/libnbc/nbc_igather.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2017-2022 IBM Corporation. All rights reserved.
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -103,7 +103,7 @@ static int nbc_gather_init(const void* sendbuf, int sendcount, MPI_Datatype send
}
} else {
for (int i = 0 ; i < p ; ++i) {
rbuf = (char *)recvbuf + i * recvcount * rcvext;
rbuf = (char *)recvbuf + (MPI_Aint) rcvext * i * recvcount;
if (i == root) {
if (!inplace) {
/* if I am the root - just copy the message */
Expand Down Expand Up @@ -228,7 +228,7 @@ static int nbc_gather_inter_init (const void* sendbuf, int sendcount, MPI_Dataty
}
} else if (MPI_ROOT == root) {
for (int i = 0 ; i < rsize ; ++i) {
rbuf = ((char *)recvbuf) + (i * recvcount * rcvext);
rbuf = ((char *)recvbuf) + ((MPI_Aint) rcvext * i * recvcount);
/* root receives message to the right buffer */
res = NBC_Sched_recv (rbuf, false, recvcount, recvtype, i, schedule, false);
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
Expand Down
4 changes: 2 additions & 2 deletions ompi/mca/coll/libnbc/nbc_ineighbor_allgather.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2017-2022 IBM Corporation. All rights reserved.
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -86,7 +86,7 @@ static int nbc_neighbor_allgather_init(const void *sbuf, int scount, MPI_Datatyp

for (int i = 0 ; i < indegree ; ++i) {
if (MPI_PROC_NULL != srcs[i]) {
res = NBC_Sched_recv ((char *) rbuf + i * rcount * rcvext, true, rcount, rtype, srcs[i], schedule, false);
res = NBC_Sched_recv ((char *) rbuf + (MPI_Aint) rcvext * i * rcount, true, rcount, rtype, srcs[i], schedule, false);
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
break;
}
Expand Down
6 changes: 3 additions & 3 deletions ompi/mca/coll/libnbc/nbc_ineighbor_alltoall.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2017-2022 IBM Corporation. All rights reserved.
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -89,7 +89,7 @@ static int nbc_neighbor_alltoall_init(const void *sbuf, int scount, MPI_Datatype

for (int i = 0 ; i < indegree ; ++i) {
if (MPI_PROC_NULL != srcs[i]) {
res = NBC_Sched_recv ((char *) rbuf + i * rcount * rcvext, true, rcount, rtype, srcs[i], schedule, false);
res = NBC_Sched_recv ((char *) rbuf + (MPI_Aint) rcvext * i * rcount, true, rcount, rtype, srcs[i], schedule, false);
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
break;
}
Expand All @@ -106,7 +106,7 @@ static int nbc_neighbor_alltoall_init(const void *sbuf, int scount, MPI_Datatype

for (int i = 0 ; i < outdegree ; ++i) {
if (MPI_PROC_NULL != dsts[i]) {
res = NBC_Sched_send ((char *) sbuf + i * scount * sndext, false, scount, stype, dsts[i], schedule, false);
res = NBC_Sched_send ((char *) sbuf + (MPI_Aint) sndext * i * scount, false, scount, stype, dsts[i], schedule, false);
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
break;
}
Expand Down
10 changes: 5 additions & 5 deletions ompi/mca/coll/libnbc/nbc_ireduce.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* reserved.
* Copyright (c) 2014-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2017-2022 IBM Corporation. All rights reserved.
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
* $COPYRIGHT$
*
Expand All @@ -27,7 +27,7 @@
static inline int red_sched_binomial (int rank, int p, int root, const void *sendbuf, void *redbuf, char tmpredbuf, int count, MPI_Datatype datatype,
MPI_Op op, char inplace, NBC_Schedule *schedule, void *tmpbuf);
static inline int red_sched_chain (int rank, int p, int root, const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
MPI_Op op, int ext, size_t size, NBC_Schedule *schedule, void *tmpbuf, int fragsize);
MPI_Op op, MPI_Aint ext, size_t size, NBC_Schedule *schedule, void *tmpbuf, int fragsize);

static inline int red_sched_linear (int rank, int rsize, int root, const void *sendbuf, void *recvbuf, void *tmpbuf, int count, MPI_Datatype datatype,
MPI_Op op, NBC_Schedule *schedule);
Expand Down Expand Up @@ -430,7 +430,7 @@ static inline int red_sched_binomial (int rank, int p, int root, const void *sen

/* chain send ... */
static inline int red_sched_chain (int rank, int p, int root, const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
MPI_Op op, int ext, size_t size, NBC_Schedule *schedule, void *tmpbuf, int fragsize) {
MPI_Op op, MPI_Aint ext, size_t size, NBC_Schedule *schedule, void *tmpbuf, int fragsize) {
int res, vrank, rpeer, speer, numfrag, fragcount, thiscount;
long offset;

Expand All @@ -450,11 +450,11 @@ static inline int red_sched_chain (int rank, int p, int root, const void *sendbu
fragcount = count / numfrag;

for (int fragnum = 0 ; fragnum < numfrag ; ++fragnum) {
offset = fragnum * fragcount * ext;
offset = (MPI_Aint) ext * fragnum * fragcount;
thiscount = fragcount;
if(fragnum == numfrag - 1) {
/* last fragment may not be full */
thiscount = count - fragcount * fragnum;
thiscount = count - (size_t)fragcount * fragnum;
}

/* last node does not recv */
Expand Down
6 changes: 3 additions & 3 deletions ompi/mca/coll/libnbc/nbc_ireduce_scatter_block.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* reserved.
* Copyright (c) 2014-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2017-2021 IBM Corporation. All rights reserved.
* Copyright (c) 2017-2022 IBM Corporation. All rights reserved.
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -70,7 +70,7 @@ static int nbc_reduce_scatter_block_init(const void* sendbuf, void* recvbuf, int

maxr = (int)ceil((log((double)p)/LOG2));

count = p * recvcount;
count = (size_t) p * recvcount;

if (0 < count) {
char *rbuf, *lbuf, *buf;
Expand Down Expand Up @@ -248,7 +248,7 @@ static int nbc_reduce_scatter_block_inter_init(const void *sendbuf, void *recvbu
return res;
}

count = rcount * lsize;
count = (size_t)rcount * lsize;

span = opal_datatype_span(&dtype->super, count, &gap);
span_align = OPAL_ALIGN(span, dtype->super.align, ptrdiff_t);
Expand Down
6 changes: 3 additions & 3 deletions ompi/mca/coll/libnbc/nbc_iscatter.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* reserved.
* Copyright (c) 2014-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2017-2022 IBM Corporation. All rights reserved.
* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -99,7 +99,7 @@ static int nbc_scatter_init (const void* sendbuf, int sendcount, MPI_Datatype se
}
} else {
for (int i = 0 ; i < p ; ++i) {
sbuf = (char *) sendbuf + i * sendcount * sndext;
sbuf = (char *) sendbuf + (MPI_Aint) sndext * i * sendcount;
if (i == root) {
if (!inplace) {
/* if I am the root - just copy the message */
Expand Down Expand Up @@ -222,7 +222,7 @@ static int nbc_scatter_inter_init (const void* sendbuf, int sendcount, MPI_Datat
}
} else if (MPI_ROOT == root) {
for (int i = 0 ; i < rsize ; ++i) {
sbuf = ((char *)sendbuf) + (i * sendcount * sndext);
sbuf = ((char *)sendbuf) + ((MPI_Aint) sndext * i * sendcount);
/* root sends the right buffer to the right receiver */
res = NBC_Sched_send(sbuf, false, sendcount, sendtype, i, schedule, false);
if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) {
Expand Down

0 comments on commit aa2514c

Please sign in to comment.