Skip to content

Commit

Permalink
Fix a bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrood-nrel committed May 31, 2024
1 parent 03f7515 commit 3cd1b4f
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/parallelComm.C
Original file line number Diff line number Diff line change
Expand Up @@ -111,32 +111,37 @@ void parallelComm::sendRecvPacketsAll(PACKET *sndPack, PACKET *rcvPack)
if (rcvPack[i].nints > 0) {
rcvPack[i].intData=(int *) malloc(sizeof(int)*rcvPack[i].nints);
}
if (rcvPack[i].nreals > 0) {
rcvPack[i].realData=(REAL *) malloc(sizeof(REAL)*rcvPack[i].nreals);
}
}

MPI_Wait(&real_request, MPI_STATUS_IGNORE);
for (int i=0; i < numprocs; i++) {
int displ = rcv_int_displs[i];
for(int j=0; j < rint[i]; j++){
rcvPack[i].intData[j] = all_rcv_intData[displ+j];
}
}
for (int i=0; i < numprocs; i++) {

TIOGA_FREE(all_snd_intData);
TIOGA_FREE(all_rcv_intData);
TIOGA_FREE(sint);
TIOGA_FREE(rint);

MPI_Wait(&real_request, MPI_STATUS_IGNORE);
for(i=0;i<numprocs;i++){
if (rcvPack[i].nreals > 0) {
rcvPack[i].realData=(REAL *) malloc(sizeof(REAL)*rcvPack[i].nreals);
}
}

for (int i=0; i < numprocs; i++) {

Check notice

Code scanning / CodeQL

Declaration hides variable Note

Variable i hides another variable of the same name (on
line 29
).
int displ = rcv_real_displs[i];
for(int j=0; j < rreal[i]; j++){
rcvPack[i].realData[j] = all_rcv_realData[displ+j];
}
}

TIOGA_FREE(all_snd_intData);
TIOGA_FREE(all_rcv_intData);
TIOGA_FREE(all_snd_realData);
TIOGA_FREE(all_rcv_realData);
TIOGA_FREE(sint);
TIOGA_FREE(sreal);
TIOGA_FREE(rint);
TIOGA_FREE(rreal);
}

Expand Down

0 comments on commit 3cd1b4f

Please sign in to comment.