@@ -1114,10 +1114,15 @@ template<typename IT1, typename IT2>
1114
1114
int petCount = vmk->getNpets ();
1115
1115
int localPet = vmk->getMypet ();
1116
1116
1117
- // Memory to hold pointers into buffers
1117
+ // Allocate memory to hold pointers into buffers
1118
1118
int **bufferIntArray = new int *[petCount];
1119
+
1120
+ // Init to NULL
1121
+ for (int i=0 ; i<petCount; i++) {
1122
+ bufferIntArray[i] = NULL ;
1123
+ }
1119
1124
1120
- // Get beginning of buffers
1125
+ // Get beginning of buffers for range
1121
1126
for (int ii=sendIndexOffset-iiStart; ii>sendIndexOffset-iiEnd; ii--){
1122
1127
int dstPet = ii%petCount; // fold back into [0,..,petCount-1] range
1123
1128
bufferIntArray[dstPet] = (int *)(sendBuffer[dstPet]);
@@ -1145,7 +1150,8 @@ template<typename IT1, typename IT2>
1145
1150
int dstPet=(int )(seqIndPos-seqIndexInterval);
1146
1151
if (dstPet >= petCount) continue ;
1147
1152
if (dstPet == localPet) continue ;
1148
-
1153
+ if (bufferIntArray[dstPet] == NULL ) continue ;
1154
+
1149
1155
IT seqIndMin = seqIndexInterval[dstPet].min ;
1150
1156
IT seqIndMax = seqIndexInterval[dstPet].max ;
1151
1157
@@ -1192,7 +1198,13 @@ template<typename IT1, typename IT2>
1192
1198
arrayElement.next ();
1193
1199
continue ;
1194
1200
}
1195
-
1201
+
1202
+ // If buffer doesn't exist, then skip
1203
+ if (bufferIntArray[dstPet] == NULL ) {
1204
+ arrayElement.next ();
1205
+ continue ;
1206
+ }
1207
+
1196
1208
IT seqIndMin = seqIndexInterval[dstPet].min ;
1197
1209
IT seqIndMax = seqIndexInterval[dstPet].max ;
1198
1210
0 commit comments