Skip to content

Commit 90bb7ff

Browse files
committed
Skip empty buffers when adding data to send.
1 parent 7b2d36d commit 90bb7ff

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/Infrastructure/Array/src/sparseMatMulStoreLinSeqVect.h

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,10 +1114,15 @@ template<typename IT1, typename IT2>
11141114
int petCount = vmk->getNpets();
11151115
int localPet = vmk->getMypet();
11161116

1117-
// Memory to hold pointers into buffers
1117+
// Allocate memory to hold pointers into buffers
11181118
int **bufferIntArray = new int*[petCount];
1119+
1120+
// Init to NULL
1121+
for (int i=0; i<petCount; i++) {
1122+
bufferIntArray[i] = NULL;
1123+
}
11191124

1120-
// Get beginning of buffers
1125+
// Get beginning of buffers for range
11211126
for (int ii=sendIndexOffset-iiStart; ii>sendIndexOffset-iiEnd; ii--){
11221127
int dstPet = ii%petCount; // fold back into [0,..,petCount-1] range
11231128
bufferIntArray[dstPet] = (int *)(sendBuffer[dstPet]);
@@ -1145,7 +1150,8 @@ template<typename IT1, typename IT2>
11451150
int dstPet=(int)(seqIndPos-seqIndexInterval);
11461151
if (dstPet >= petCount) continue;
11471152
if (dstPet == localPet) continue;
1148-
1153+
if (bufferIntArray[dstPet] == NULL) continue;
1154+
11491155
IT seqIndMin = seqIndexInterval[dstPet].min;
11501156
IT seqIndMax = seqIndexInterval[dstPet].max;
11511157

@@ -1192,7 +1198,13 @@ template<typename IT1, typename IT2>
11921198
arrayElement.next();
11931199
continue;
11941200
}
1195-
1201+
1202+
// If buffer doesn't exist, then skip
1203+
if (bufferIntArray[dstPet] == NULL) {
1204+
arrayElement.next();
1205+
continue;
1206+
}
1207+
11961208
IT seqIndMin = seqIndexInterval[dstPet].min;
11971209
IT seqIndMax = seqIndexInterval[dstPet].max;
11981210

0 commit comments

Comments
 (0)