Merge branch 'master' into multi-comm-tiled
This commit is contained in:
@ -71,7 +71,7 @@ CommTiled::~CommTiled()
|
||||
memory->destroy(buf_send);
|
||||
memory->destroy(buf_recv);
|
||||
memory->destroy(overlap);
|
||||
deallocate_swap(nswap);
|
||||
deallocate_swap(maxswap);
|
||||
memory->sfree(rcbinfo);
|
||||
|
||||
if (mode == Comm::MULTI) memory->destroy(cutghostmulti);
|
||||
@ -91,8 +91,8 @@ void CommTiled::init_buffers()
|
||||
maxoverlap = 0;
|
||||
overlap = NULL;
|
||||
|
||||
nswap = 2 * domain->dimension;
|
||||
allocate_swap(nswap);
|
||||
maxswap = 6;
|
||||
allocate_swap(maxswap);
|
||||
|
||||
rcbinfo = NULL;
|
||||
|
||||
@ -180,11 +180,21 @@ void CommTiled::setup()
|
||||
error->warning(FLERR,"Communication cutoff is 0.0. No ghost atoms "
|
||||
"will be generated. Atoms may get lost.");
|
||||
|
||||
cutghost[0] = cutghost[1] = cutghost[2] = cut;
|
||||
if (triclinic == 0) cutghost[0] = cutghost[1] = cutghost[2] = cut;
|
||||
else {
|
||||
double *h_inv = domain->h_inv;
|
||||
double length0,length1,length2;
|
||||
length0 = sqrt(h_inv[0]*h_inv[0] + h_inv[5]*h_inv[5] + h_inv[4]*h_inv[4]);
|
||||
cutghost[0] = cut * length0;
|
||||
length1 = sqrt(h_inv[1]*h_inv[1] + h_inv[3]*h_inv[3]);
|
||||
cutghost[1] = cut * length1;
|
||||
length2 = h_inv[2];
|
||||
cutghost[2] = cut * length2;
|
||||
}
|
||||
|
||||
if ((periodicity[0] && cut > prd[0]) ||
|
||||
(periodicity[1] && cut > prd[1]) ||
|
||||
(dimension == 3 && periodicity[2] && cut > prd[2]))
|
||||
if ((periodicity[0] && cutghost[0] > prd[0]) ||
|
||||
(periodicity[1] && cutghost[1] > prd[1]) ||
|
||||
(dimension == 3 && periodicity[2] && cutghost[2] > prd[2]))
|
||||
error->all(FLERR,"Communication cutoff for comm_style tiled "
|
||||
"cannot exceed periodic box length");
|
||||
|
||||
@ -199,6 +209,7 @@ void CommTiled::setup()
|
||||
cut = MIN(prd[0],prd[1]);
|
||||
if (dimension == 3) cut = MIN(cut,prd[2]);
|
||||
cut *= EPSILON*EPSILON;
|
||||
cutghost[0] = cutghost[1] = cutghost[2] = cut;
|
||||
}
|
||||
|
||||
// setup forward/reverse communication
|
||||
@ -225,11 +236,11 @@ void CommTiled::setup()
|
||||
lo1[0] = sublo[0]; lo1[1] = sublo[1]; lo1[2] = sublo[2];
|
||||
hi1[0] = subhi[0]; hi1[1] = subhi[1]; hi1[2] = subhi[2];
|
||||
if (idir == 0) {
|
||||
lo1[idim] = sublo[idim] - cut;
|
||||
lo1[idim] = sublo[idim] - cutghost[idim];
|
||||
hi1[idim] = sublo[idim];
|
||||
} else {
|
||||
lo1[idim] = subhi[idim];
|
||||
hi1[idim] = subhi[idim] + cut;
|
||||
hi1[idim] = subhi[idim] + cutghost[idim];
|
||||
}
|
||||
|
||||
two = 0;
|
||||
@ -444,6 +455,7 @@ void CommTiled::setup()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// setup exchange communication = subset of forward/reverse comm procs
|
||||
// loop over dimensions
|
||||
// determine which procs I will exchange with in each dimension
|
||||
@ -753,14 +765,16 @@ void CommTiled::exchange()
|
||||
// domain properties used in exchange method and methods it calls
|
||||
// subbox bounds for orthogonal or triclinic
|
||||
|
||||
prd = domain->prd;
|
||||
boxlo = domain->boxlo;
|
||||
boxhi = domain->boxhi;
|
||||
|
||||
if (triclinic == 0) {
|
||||
prd = domain->prd;
|
||||
boxlo = domain->boxlo;
|
||||
boxhi = domain->boxhi;
|
||||
sublo = domain->sublo;
|
||||
subhi = domain->subhi;
|
||||
} else {
|
||||
prd = domain->prd_lamda;
|
||||
boxlo = domain->boxlo_lamda;
|
||||
boxhi = domain->boxhi_lamda;
|
||||
sublo = domain->sublo_lamda;
|
||||
subhi = domain->subhi_lamda;
|
||||
}
|
||||
@ -787,7 +801,11 @@ void CommTiled::exchange()
|
||||
if (proc != me) {
|
||||
buf_send[nsend++] = proc;
|
||||
nsend += avec->pack_exchange(i,&buf_send[nsend]);
|
||||
}
|
||||
} else {
|
||||
// DEBUG statment
|
||||
// error->warning(FLERR,"Losing atom in CommTiled::exchange() send, "
|
||||
// "likely bad dynamics");
|
||||
}
|
||||
avec->copy(nlocal-1,i,1);
|
||||
nlocal--;
|
||||
} else i++;
|
||||
@ -836,7 +854,10 @@ void CommTiled::exchange()
|
||||
if (value >= lo && value < hi) {
|
||||
m += avec->unpack_exchange(&buf_recv[m]);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
// DEBUG statment
|
||||
// error->warning(FLERR,"Losing atom in CommTiled::exchange() recv");
|
||||
}
|
||||
}
|
||||
m += static_cast<int> (buf_recv[m]);
|
||||
}
|
||||
@ -885,6 +906,7 @@ void CommTiled::borders()
|
||||
if (iswap % 2 == 0) nlast = atom->nlocal + atom->nghost;
|
||||
|
||||
ncountall = 0;
|
||||
|
||||
for (m = 0; m < nsendproc[iswap]; m++) {
|
||||
|
||||
if (mode == Comm::SINGLE) {
|
||||
@ -1034,6 +1056,7 @@ void CommTiled::borders()
|
||||
// swap atoms with other procs using pack_border(), unpack_border()
|
||||
// use Waitall() instead of Waitany() because calls to unpack_border()
|
||||
// must increment per-atom arrays in ascending order
|
||||
// For the same reason, sendself unpacks must occur after recvother unpacks
|
||||
|
||||
if (ghost_velocity) {
|
||||
if (recvother[iswap]) {
|
||||
@ -1049,13 +1072,6 @@ void CommTiled::borders()
|
||||
MPI_Send(buf_send,n,MPI_DOUBLE,sendproc[iswap][m],0,world);
|
||||
}
|
||||
}
|
||||
if (sendself[iswap]) {
|
||||
avec->pack_border_vel(sendnum[iswap][nsend],sendlist[iswap][nsend],
|
||||
buf_send,pbc_flag[iswap][nsend],
|
||||
pbc[iswap][nsend]);
|
||||
avec->unpack_border_vel(recvnum[iswap][nrecv],firstrecv[iswap][nrecv],
|
||||
buf_send);
|
||||
}
|
||||
if (recvother[iswap]) {
|
||||
MPI_Waitall(nrecv,requests,MPI_STATUS_IGNORE);
|
||||
for (m = 0; m < nrecv; m++)
|
||||
@ -1063,6 +1079,13 @@ void CommTiled::borders()
|
||||
&buf_recv[size_border*
|
||||
forward_recv_offset[iswap][m]]);
|
||||
}
|
||||
if (sendself[iswap]) {
|
||||
avec->pack_border_vel(sendnum[iswap][nsend],sendlist[iswap][nsend],
|
||||
buf_send,pbc_flag[iswap][nsend],
|
||||
pbc[iswap][nsend]);
|
||||
avec->unpack_border_vel(recvnum[iswap][nrecv],firstrecv[iswap][nrecv],
|
||||
buf_send);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (recvother[iswap]) {
|
||||
@ -1078,12 +1101,6 @@ void CommTiled::borders()
|
||||
MPI_Send(buf_send,n,MPI_DOUBLE,sendproc[iswap][m],0,world);
|
||||
}
|
||||
}
|
||||
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++)
|
||||
@ -1091,6 +1108,12 @@ void CommTiled::borders()
|
||||
&buf_recv[size_border*
|
||||
forward_recv_offset[iswap][m]]);
|
||||
}
|
||||
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][nrecv],firstrecv[iswap][nrecv],
|
||||
buf_send);
|
||||
}
|
||||
}
|
||||
|
||||
// increment ghost atoms
|
||||
|
||||
Reference in New Issue
Block a user