comm-style-tiled query

Greetings,

Is it just me or does the following chunk of code look backwards?

if (sendself[iswap]) {
avec->pack_border(sendnum[iswap][nsend],sendlist[iswap][nsend],
buf_send,pbc_flag[iswap][nsend],pbc[iswap][nsend]);
avec->unpack_border(recvnum[iswap][nsend],firstrecv[iswap][nsend],
buf_send);
}
if (recvother[iswap]) {
MPI_Waitall(nrecv,requests,MPI_STATUS_IGNORE);
for (m = 0; m < nrecv; m++)
avec->unpack_border(recvnum[iswap][m],firstrecv[iswap][m],
&buf_recv[size_border*
forward_recv_offset[iswap][m]]);
}

By that I mean that recvother unpacks should take place before the sendself pack and unpack. The reason I find this odd is that the code responsible for assigning the values of firstrecv for each rank reads:

if (m == 0) {
firstrecv[iswap][0] = atom->nlocal + atom->nghost;
forward_recv_offset[iswap][0] = 0;
} else {
firstrecv[iswap][m] = firstrecv[iswap][m-1] + recvnum[iswap][m-1];
forward_recv_offset[iswap][m] =
forward_recv_offset[iswap][m-1] + recvnum[iswap][m-1];
}

, granting the the sendself communication the largest value of firstrecv; since the design of the counters seems to designate it as the last send operation. This seems to me like a recipe for segfault in unpack_border since the recvother comms were assigned the incremental values of firstrecv with which the atom_vec’s grow routine could be incrementally called correctly.