more robust version of atom exchange size

This commit is contained in:
Steve Plimpton
2019-07-09 16:17:54 -06:00
parent 691fc357a4
commit 2fd327d057
16 changed files with 93 additions and 54 deletions

View File

@ -32,8 +32,7 @@ using namespace LAMMPS_NS;
#define BUFFACTOR 1.5
#define BUFFACTOR 1.5
#define BUFMIN 1000
#define BUFEXTRA 1000
#define BUFMIN 1024
#define EPSILON 1.0e-6
#define DELTA_PROCS 16
@ -80,14 +79,6 @@ CommTiled::~CommTiled()
void CommTiled::init_buffers()
{
// bufextra = max size of one exchanged atom
// = allowed overflow of sendbuf in exchange()
// atomvec, fix reset these 2 maxexchange values if needed
// only necessary if their size > BUFEXTRA
maxexchange = maxexchange_atom + maxexchange_fix;
bufextra = maxexchange + BUFEXTRA;
maxsend = BUFMIN;
memory->create(buf_send,maxsend+bufextra,"comm:buf_send");
maxrecv = BUFMIN;
@ -108,6 +99,10 @@ void CommTiled::init()
{
Comm::init();
int bufextra_old = bufextra;
init_exchange();
if (bufextra > bufextra_old) grow_send(maxsend+bufextra,0);
// temporary restrictions
if (triclinic)
@ -644,15 +639,14 @@ void CommTiled::exchange()
atom->nghost = 0;
atom->avec->clear_bonus();
// insure send buf is large enough for single atom
// bufextra = max size of one atom = allowed overflow of sendbuf
// fixes can change per-atom size requirement on-the-fly
// insure send buf has extra space for a single atom
// only need to reset if a fix can dynamically add to size of single atom
int bufextra_old = bufextra;
maxexchange = maxexchange_atom + maxexchange_fix;
bufextra = maxexchange + BUFEXTRA;
if (bufextra > bufextra_old)
memory->grow(buf_send,maxsend+bufextra,"comm:buf_send");
if (maxexchange_fix_dynamic) {
int bufextra_old = bufextra;
init_exchange();
if (bufextra > bufextra_old) grow_send(maxsend+bufextra,1);
}
// domain properties used in exchange method and methods it calls
// subbox bounds for orthogonal or triclinic