Skip to content

Commit

Permalink
Merge pull request #10094 from markalle/iallreduce_overflow_v41x
Browse files Browse the repository at this point in the history
v4.1.x: libnbc fix for iallreduce count*extent overflowing int
  • Loading branch information
jsquyres authored Mar 14, 2022
2 parents 4960973 + 9fe3dee commit 21a2855
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ompi/mca/coll/libnbc/nbc_iallreduce.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 Down Expand Up @@ -768,9 +768,9 @@ allred_sched_ring(int r, int p,
/* first p-1 rounds are reductions */
for (int round = 0 ; round < p - 1 ; ++round) {
int selement = (r+1-round + 2*p /*2*p avoids negative mod*/)%p; /* the element I am sending */
int soffset = segoffsets[selement]*ext;
size_t soffset = segoffsets[selement]*(size_t)ext;
int relement = (r-round + 2*p /*2*p avoids negative mod*/)%p; /* the element that I receive from my neighbor */
int roffset = segoffsets[relement]*ext;
size_t roffset = segoffsets[relement]*(size_t)ext;

/* first message come out of sendbuf */
if (round == 0) {
Expand Down Expand Up @@ -807,9 +807,9 @@ allred_sched_ring(int r, int p,
}
for (int round = p - 1 ; round < 2 * p - 2 ; ++round) {
int selement = (r+1-round + 2*p /*2*p avoids negative mod*/)%p; /* the element I am sending */
int soffset = segoffsets[selement]*ext;
size_t soffset = segoffsets[selement]*(size_t)ext;
int relement = (r-round + 2*p /*2*p avoids negative mod*/)%p; /* the element that I receive from my neighbor */
int roffset = segoffsets[relement]*ext;
size_t roffset = segoffsets[relement]*(size_t)ext;

res = NBC_Sched_send ((char *) recvbuf + soffset, false, segsizes[selement], datatype, speer,
schedule, false);
Expand Down

0 comments on commit 21a2855

Please sign in to comment.