Merge branch 'master' into comm_tiled_sendself_fix
This commit is contained in:
@ -11,19 +11,17 @@
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include <cstring>
|
||||
#include "comm_tiled.h"
|
||||
#include "comm_brick.h"
|
||||
#include <mpi.h>
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "force.h"
|
||||
#include "pair.h"
|
||||
#include "neighbor.h"
|
||||
#include "modify.h"
|
||||
#include "fix.h"
|
||||
#include "compute.h"
|
||||
#include "output.h"
|
||||
#include "dump.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
@ -32,8 +30,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,17 +77,9 @@ 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;
|
||||
buf_send = buf_recv = NULL;
|
||||
maxsend = maxrecv = BUFMIN;
|
||||
grow_send(maxsend,2);
|
||||
memory->create(buf_recv,maxrecv,"comm:buf_recv");
|
||||
|
||||
maxoverlap = 0;
|
||||
@ -108,6 +97,10 @@ void CommTiled::init()
|
||||
{
|
||||
Comm::init();
|
||||
|
||||
int bufextra_old = bufextra;
|
||||
init_exchange();
|
||||
if (bufextra > bufextra_old) grow_send(maxsend+bufextra,2);
|
||||
|
||||
// temporary restrictions
|
||||
|
||||
if (triclinic)
|
||||
@ -157,7 +150,11 @@ void CommTiled::setup()
|
||||
// set cutoff for comm forward and comm reverse
|
||||
// check that cutoff < any periodic box length
|
||||
|
||||
double cut = MAX(neighbor->cutneighmax,cutghostuser);
|
||||
double cut = get_comm_cutoff();
|
||||
if ((cut == 0.0) && (me == 0))
|
||||
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 ((periodicity[0] && cut > prd[0]) ||
|
||||
@ -621,7 +618,7 @@ void CommTiled::reverse_comm()
|
||||
atoms exchanged with procs that touch sub-box in each of 3 dims
|
||||
send out atoms that have left my box, receive ones entering my box
|
||||
atoms will be lost if not inside a touching proc's box
|
||||
can happen if atom moves outside of non-periodic bounary
|
||||
can happen if atom moves outside of non-periodic boundary
|
||||
or if atom moves more than one proc away
|
||||
this routine called before every reneighboring
|
||||
for triclinic, atoms must be in lamda coords (0-1) before exchange is called
|
||||
@ -644,15 +641,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,2);
|
||||
}
|
||||
|
||||
// domain properties used in exchange method and methods it calls
|
||||
// subbox bounds for orthogonal or triclinic
|
||||
@ -1811,18 +1807,23 @@ int CommTiled::coord2proc(double *x, int &igx, int &igy, int &igz)
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
realloc the size of the send buffer as needed with BUFFACTOR and bufextra
|
||||
if flag = 1, realloc
|
||||
if flag = 0, don't need to realloc with copy, just free/malloc
|
||||
flag = 0, don't need to realloc with copy, just free/malloc w/ BUFFACTOR
|
||||
flag = 1, realloc with BUFFACTOR
|
||||
flag = 2, free/malloc w/out BUFFACTOR
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void CommTiled::grow_send(int n, int flag)
|
||||
{
|
||||
maxsend = static_cast<int> (BUFFACTOR * n);
|
||||
if (flag)
|
||||
memory->grow(buf_send,maxsend+bufextra,"comm:buf_send");
|
||||
else {
|
||||
if (flag == 0) {
|
||||
maxsend = static_cast<int> (BUFFACTOR * n);
|
||||
memory->destroy(buf_send);
|
||||
memory->create(buf_send,maxsend+bufextra,"comm:buf_send");
|
||||
} else if (flag == 1) {
|
||||
maxsend = static_cast<int> (BUFFACTOR * n);
|
||||
memory->grow(buf_send,maxsend+bufextra,"comm:buf_send");
|
||||
} else {
|
||||
memory->destroy(buf_send);
|
||||
memory->grow(buf_send,maxsend+bufextra,"comm:buf_send");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user