fix corner-case issue with hyper communication, also timer

This commit is contained in:
Steve Plimpton
2019-03-18 09:52:16 -06:00
parent a3c936d283
commit ac20d1ab41
3 changed files with 26 additions and 15 deletions

View File

@ -1261,16 +1261,24 @@ void FixHyperLocal::unpack_reverse_comm(int n, int *list, double *buf)
{
int i,j,k,m;
m = 0;
// return if n = 0
// b/c if there are no atoms (n = 0), the message will not have
// been sent by Comm::reverse_comm_fix() or reverse_comm_fix_variable()
// so must not read nonzero from first buf location (would be zero anyway)
if (n == 0) return;
// STRAIN
// unpack maxstrain vector
// nonzero # of entries, each has offset to which atom in receiver's list
// use MAX, b/c want maximum abs value strain for each atom's bonds
m = 0;
if (commflag == STRAIN) {
int offset;
int nonzero = (int) ubuf(buf[m++]).i; // # of atoms with values
for (int iatom = 0; iatom < nonzero; iatom++) {
offset = (int) ubuf(buf[m++]).i; // offset into list for which atom
j = list[offset];

View File

@ -181,9 +181,6 @@ void Hyper::command(int narg, char **arg)
if (hyperenable) fix_hyper->init_hyper();
timer->barrier_start();
time_start = timer->get_wall(Timer::TOTAL);
// perform initial minimization and bond list creation
int nevent = 0;
@ -198,6 +195,14 @@ void Hyper::command(int narg, char **arg)
if (hyperenable) fix_hyper->build_bond_list(0);
fix_event->restore_state_quench();
// reset stats and timers to skip HD setup
nbuild = ndanger = 0;
time_dynamics = time_quench = 0.0;
timer->barrier_start();
time_start = timer->get_wall(Timer::TOTAL);
// main loop: dynamics, store state, quench, check event, restore state
int ecount;

View File

@ -1046,10 +1046,6 @@ 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)
@ -1074,12 +1070,14 @@ void CommBrick::reverse_comm_fix_variable(Fix *fix)
&nrecv,1,MPI_INT,sendproc[iswap],0,world,
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);
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);
buf = buf_recv;
} else buf = buf_send;