bug fixes for new local hyperdynamics reduced comm

This commit is contained in:
Steve Plimpton
2019-03-14 15:13:02 -06:00
parent aca8ce1f53
commit a3c936d283
2 changed files with 12 additions and 9 deletions

View File

@ -1197,7 +1197,7 @@ int FixHyperLocal::pack_reverse_comm(int n, int first, double *buf)
int nonzero = 0;
m++; // placeholder for count of atoms
for (i = first; i < last; i++) {
if (maxstrain[i] == 0.0) continue;
if (maxstrain_domain[i] == 0.0) continue;
nonzero++;
buf[m++] = ubuf(i-first).d; // which atom is next
buf[m++] = maxstrain_domain[i]; // value

View File

@ -1046,6 +1046,10 @@ void CommBrick::reverse_comm_fix(Fix *fix, int size)
reverse communication invoked by a Fix with variable size data
query fix for pack size to insure buf_send is big enough
handshake sizes before each Irecv/Send to insure buf_recv is big enough
this removes the if tests on sendnum and recvnum to make MPI calls,
as in reverse_comm_fix(), b/c the caller may still want to
exchange a message even if the send/recv swap has no atoms,
e.g. a reduced count = 0 of atoms to send/recv, as in fix hyper/local
------------------------------------------------------------------------- */
void CommBrick::reverse_comm_fix_variable(Fix *fix)
@ -1069,14 +1073,13 @@ void CommBrick::reverse_comm_fix_variable(Fix *fix)
MPI_Sendrecv(&nsend,1,MPI_INT,recvproc[iswap],0,
&nrecv,1,MPI_INT,sendproc[iswap],0,world,
MPI_STATUS_IGNORE);
if (sendnum[iswap]) {
if (nrecv > maxrecv) grow_recv(nrecv);
MPI_Irecv(buf_recv,maxrecv,MPI_DOUBLE,sendproc[iswap],0,
world,&request);
}
if (recvnum[iswap])
MPI_Send(buf_send,nsend,MPI_DOUBLE,recvproc[iswap],0,world);
if (sendnum[iswap]) MPI_Wait(&request,MPI_STATUS_IGNORE);
if (nrecv > maxrecv) grow_recv(nrecv);
MPI_Irecv(buf_recv,maxrecv,MPI_DOUBLE,sendproc[iswap],0,
world,&request);
MPI_Send(buf_send,nsend,MPI_DOUBLE,recvproc[iswap],0,world);
MPI_Wait(&request,MPI_STATUS_IGNORE);
buf = buf_recv;
} else buf = buf_send;