move enum{SINGLE,MULTI} and enum{MULTIPLE} to Comm in comm.h
This commit is contained in:
@ -36,8 +36,6 @@ using namespace LAMMPS_NS;
|
|||||||
#define BUFMIN 10000
|
#define BUFMIN 10000
|
||||||
#define BUFEXTRA 1000
|
#define BUFEXTRA 1000
|
||||||
|
|
||||||
enum{SINGLE,MULTI};
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
setup MPI and allocate buffer space
|
setup MPI and allocate buffer space
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
@ -709,7 +707,7 @@ void CommKokkos::borders()
|
|||||||
if (!exchange_comm_classic) {
|
if (!exchange_comm_classic) {
|
||||||
static int print = 1;
|
static int print = 1;
|
||||||
|
|
||||||
if (style != SINGLE || bordergroup || ghost_velocity) {
|
if (style != Comm::SINGLE || bordergroup || ghost_velocity) {
|
||||||
if (print && comm->me==0) {
|
if (print && comm->me==0) {
|
||||||
error->warning(FLERR,"Required border comm not yet implemented in Kokkos communication, "
|
error->warning(FLERR,"Required border comm not yet implemented in Kokkos communication, "
|
||||||
"switching to classic communication");
|
"switching to classic communication");
|
||||||
@ -817,7 +815,7 @@ void CommKokkos::borders_device() {
|
|||||||
// store sent atom indices in list for use in future timesteps
|
// store sent atom indices in list for use in future timesteps
|
||||||
|
|
||||||
x = atom->x;
|
x = atom->x;
|
||||||
if (style == SINGLE) {
|
if (style == Comm::SINGLE) {
|
||||||
lo = slablo[iswap];
|
lo = slablo[iswap];
|
||||||
hi = slabhi[iswap];
|
hi = slabhi[iswap];
|
||||||
} else {
|
} else {
|
||||||
@ -846,7 +844,7 @@ void CommKokkos::borders_device() {
|
|||||||
|
|
||||||
if (sendflag) {
|
if (sendflag) {
|
||||||
if (!bordergroup || ineed >= 2) {
|
if (!bordergroup || ineed >= 2) {
|
||||||
if (style == SINGLE) {
|
if (style == Comm::SINGLE) {
|
||||||
k_total_send.h_view() = 0;
|
k_total_send.h_view() = 0;
|
||||||
k_total_send.template modify<LMPHostType>();
|
k_total_send.template modify<LMPHostType>();
|
||||||
k_total_send.template sync<LMPDeviceType>();
|
k_total_send.template sync<LMPDeviceType>();
|
||||||
@ -894,7 +892,7 @@ void CommKokkos::borders_device() {
|
|||||||
} else {
|
} else {
|
||||||
error->all(FLERR,"Required border comm not yet "
|
error->all(FLERR,"Required border comm not yet "
|
||||||
"implemented with Kokkos");
|
"implemented with Kokkos");
|
||||||
if (style == SINGLE) {
|
if (style == Comm::SINGLE) {
|
||||||
ngroup = atom->nfirst;
|
ngroup = atom->nfirst;
|
||||||
for (i = 0; i < ngroup; i++)
|
for (i = 0; i < ngroup; i++)
|
||||||
if (x[i][dim] >= lo && x[i][dim] <= hi) {
|
if (x[i][dim] >= lo && x[i][dim] <= hi) {
|
||||||
@ -1099,7 +1097,7 @@ void CommKokkos::grow_swap(int n)
|
|||||||
{
|
{
|
||||||
free_swap();
|
free_swap();
|
||||||
allocate_swap(n);
|
allocate_swap(n);
|
||||||
if (style == MULTI) {
|
if (style == Comm::MULTI) {
|
||||||
free_multi();
|
free_multi();
|
||||||
allocate_multi(n);
|
allocate_multi(n);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,6 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
#define DELTA_PROCS 16
|
#define DELTA_PROCS 16
|
||||||
|
|
||||||
enum{SINGLE,MULTI}; // same as in Comm
|
|
||||||
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
|
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|||||||
16
src/comm.cpp
16
src/comm.cpp
@ -40,8 +40,6 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
#define BUFMIN 1000 // also in comm styles
|
#define BUFMIN 1000 // also in comm styles
|
||||||
|
|
||||||
enum{SINGLE,MULTI}; // same as in Comm sub-styles
|
|
||||||
enum{MULTIPLE}; // same as in ProcMap
|
|
||||||
enum{ONELEVEL,TWOLEVEL,NUMA,CUSTOM};
|
enum{ONELEVEL,TWOLEVEL,NUMA,CUSTOM};
|
||||||
enum{CART,CARTREORDER,XYZ};
|
enum{CART,CARTREORDER,XYZ};
|
||||||
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
|
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
|
||||||
@ -244,14 +242,14 @@ void Comm::modify_params(int narg, char **arg)
|
|||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal comm_modify command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal comm_modify command");
|
||||||
if (strcmp(arg[iarg+1],"single") == 0) {
|
if (strcmp(arg[iarg+1],"single") == 0) {
|
||||||
// need to reset cutghostuser when switching comm mode
|
// need to reset cutghostuser when switching comm mode
|
||||||
if (mode == MULTI) cutghostuser = 0.0;
|
if (mode == Comm::MULTI) cutghostuser = 0.0;
|
||||||
memory->destroy(cutusermulti);
|
memory->destroy(cutusermulti);
|
||||||
cutusermulti = NULL;
|
cutusermulti = NULL;
|
||||||
mode = SINGLE;
|
mode = Comm::SINGLE;
|
||||||
} else if (strcmp(arg[iarg+1],"multi") == 0) {
|
} else if (strcmp(arg[iarg+1],"multi") == 0) {
|
||||||
// need to reset cutghostuser when switching comm mode
|
// need to reset cutghostuser when switching comm mode
|
||||||
if (mode == SINGLE) cutghostuser = 0.0;
|
if (mode == Comm::SINGLE) cutghostuser = 0.0;
|
||||||
mode = MULTI;
|
mode = Comm::MULTI;
|
||||||
} else error->all(FLERR,"Illegal comm_modify command");
|
} else error->all(FLERR,"Illegal comm_modify command");
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"group") == 0) {
|
} else if (strcmp(arg[iarg],"group") == 0) {
|
||||||
@ -265,7 +263,7 @@ void Comm::modify_params(int narg, char **arg)
|
|||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"cutoff") == 0) {
|
} else if (strcmp(arg[iarg],"cutoff") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal comm_modify command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal comm_modify command");
|
||||||
if (mode == MULTI)
|
if (mode == Comm::MULTI)
|
||||||
error->all(FLERR,
|
error->all(FLERR,
|
||||||
"Use cutoff/multi keyword to set cutoff in multi mode");
|
"Use cutoff/multi keyword to set cutoff in multi mode");
|
||||||
cutghostuser = force->numeric(FLERR,arg[iarg+1]);
|
cutghostuser = force->numeric(FLERR,arg[iarg+1]);
|
||||||
@ -275,7 +273,7 @@ void Comm::modify_params(int narg, char **arg)
|
|||||||
} else if (strcmp(arg[iarg],"cutoff/multi") == 0) {
|
} else if (strcmp(arg[iarg],"cutoff/multi") == 0) {
|
||||||
int i,nlo,nhi;
|
int i,nlo,nhi;
|
||||||
double cut;
|
double cut;
|
||||||
if (mode == SINGLE)
|
if (mode == Comm::SINGLE)
|
||||||
error->all(FLERR,"Use cutoff keyword to set cutoff in single mode");
|
error->all(FLERR,"Use cutoff keyword to set cutoff in single mode");
|
||||||
if (domain->box_exist == 0)
|
if (domain->box_exist == 0)
|
||||||
error->all(FLERR,
|
error->all(FLERR,
|
||||||
@ -415,7 +413,7 @@ void Comm::set_processors(int narg, char **arg)
|
|||||||
if (strcmp(arg[iarg+3],"multiple") == 0) {
|
if (strcmp(arg[iarg+3],"multiple") == 0) {
|
||||||
if (universe->iworld == irecv-1) {
|
if (universe->iworld == irecv-1) {
|
||||||
otherflag = 1;
|
otherflag = 1;
|
||||||
other_style = MULTIPLE;
|
other_style = Comm::MULTIPLE;
|
||||||
}
|
}
|
||||||
} else error->all(FLERR,"Illegal processors command");
|
} else error->all(FLERR,"Illegal processors command");
|
||||||
iarg += 4;
|
iarg += 4;
|
||||||
|
|||||||
@ -25,6 +25,7 @@ class Comm : protected Pointers {
|
|||||||
// LAYOUT_NONUNIFORM = logical bricks, but diff sizes via LB
|
// LAYOUT_NONUNIFORM = logical bricks, but diff sizes via LB
|
||||||
// LAYOUT_TILED = general tiling, due to RCB LB
|
// LAYOUT_TILED = general tiling, due to RCB LB
|
||||||
int mode; // 0 = single cutoff, 1 = multi-type cutoff
|
int mode; // 0 = single cutoff, 1 = multi-type cutoff
|
||||||
|
enum{SINGLE,MULTI};
|
||||||
|
|
||||||
int me,nprocs; // proc info
|
int me,nprocs; // proc info
|
||||||
int ghost_velocity; // 1 if ghost atoms have velocity, 0 if not
|
int ghost_velocity; // 1 if ghost atoms have velocity, 0 if not
|
||||||
@ -132,6 +133,7 @@ class Comm : protected Pointers {
|
|||||||
|
|
||||||
int otherflag; // 1 if this partition dependent on another
|
int otherflag; // 1 if this partition dependent on another
|
||||||
int other_style; // style of dependency
|
int other_style; // style of dependency
|
||||||
|
enum{MULTIPLE};
|
||||||
int other_procgrid[3]; // proc layout of another partition
|
int other_procgrid[3]; // proc layout of another partition
|
||||||
int other_coregrid[3]; // core layout of another partition
|
int other_coregrid[3]; // core layout of another partition
|
||||||
int ncores; // # of cores per node
|
int ncores; // # of cores per node
|
||||||
|
|||||||
@ -46,7 +46,6 @@ using namespace LAMMPS_NS;
|
|||||||
#define BUFEXTRA 1000
|
#define BUFEXTRA 1000
|
||||||
#define BIG 1.0e20
|
#define BIG 1.0e20
|
||||||
|
|
||||||
enum{SINGLE,MULTI}; // same as in Comm
|
|
||||||
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
|
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -71,7 +70,7 @@ CommBrick::CommBrick(LAMMPS *lmp) :
|
|||||||
CommBrick::~CommBrick()
|
CommBrick::~CommBrick()
|
||||||
{
|
{
|
||||||
free_swap();
|
free_swap();
|
||||||
if (mode == MULTI) {
|
if (mode == Comm::MULTI) {
|
||||||
free_multi();
|
free_multi();
|
||||||
memory->destroy(cutghostmulti);
|
memory->destroy(cutghostmulti);
|
||||||
}
|
}
|
||||||
@ -144,11 +143,11 @@ void CommBrick::init()
|
|||||||
|
|
||||||
// memory for multi-style communication
|
// memory for multi-style communication
|
||||||
|
|
||||||
if (mode == MULTI && multilo == NULL) {
|
if (mode == Comm::MULTI && multilo == NULL) {
|
||||||
allocate_multi(maxswap);
|
allocate_multi(maxswap);
|
||||||
memory->create(cutghostmulti,atom->ntypes+1,3,"comm:cutghostmulti");
|
memory->create(cutghostmulti,atom->ntypes+1,3,"comm:cutghostmulti");
|
||||||
}
|
}
|
||||||
if (mode == SINGLE && multilo) {
|
if (mode == Comm::SINGLE && multilo) {
|
||||||
free_multi();
|
free_multi();
|
||||||
memory->destroy(cutghostmulti);
|
memory->destroy(cutghostmulti);
|
||||||
}
|
}
|
||||||
@ -184,7 +183,7 @@ void CommBrick::setup()
|
|||||||
subhi = domain->subhi;
|
subhi = domain->subhi;
|
||||||
cutghost[0] = cutghost[1] = cutghost[2] = cut;
|
cutghost[0] = cutghost[1] = cutghost[2] = cut;
|
||||||
|
|
||||||
if (mode == MULTI) {
|
if (mode == Comm::MULTI) {
|
||||||
double *cuttype = neighbor->cuttype;
|
double *cuttype = neighbor->cuttype;
|
||||||
for (i = 1; i <= ntypes; i++) {
|
for (i = 1; i <= ntypes; i++) {
|
||||||
cut = 0.0;
|
cut = 0.0;
|
||||||
@ -208,7 +207,7 @@ void CommBrick::setup()
|
|||||||
length2 = h_inv[2];
|
length2 = h_inv[2];
|
||||||
cutghost[2] = cut * length2;
|
cutghost[2] = cut * length2;
|
||||||
|
|
||||||
if (mode == MULTI) {
|
if (mode == Comm::MULTI) {
|
||||||
double *cuttype = neighbor->cuttype;
|
double *cuttype = neighbor->cuttype;
|
||||||
for (i = 1; i <= ntypes; i++) {
|
for (i = 1; i <= ntypes; i++) {
|
||||||
cut = 0.0;
|
cut = 0.0;
|
||||||
@ -357,7 +356,7 @@ void CommBrick::setup()
|
|||||||
if (ineed % 2 == 0) {
|
if (ineed % 2 == 0) {
|
||||||
sendproc[iswap] = procneigh[dim][0];
|
sendproc[iswap] = procneigh[dim][0];
|
||||||
recvproc[iswap] = procneigh[dim][1];
|
recvproc[iswap] = procneigh[dim][1];
|
||||||
if (mode == SINGLE) {
|
if (mode == Comm::SINGLE) {
|
||||||
if (ineed < 2) slablo[iswap] = -BIG;
|
if (ineed < 2) slablo[iswap] = -BIG;
|
||||||
else slablo[iswap] = 0.5 * (sublo[dim] + subhi[dim]);
|
else slablo[iswap] = 0.5 * (sublo[dim] + subhi[dim]);
|
||||||
slabhi[iswap] = sublo[dim] + cutghost[dim];
|
slabhi[iswap] = sublo[dim] + cutghost[dim];
|
||||||
@ -380,7 +379,7 @@ void CommBrick::setup()
|
|||||||
} else {
|
} else {
|
||||||
sendproc[iswap] = procneigh[dim][1];
|
sendproc[iswap] = procneigh[dim][1];
|
||||||
recvproc[iswap] = procneigh[dim][0];
|
recvproc[iswap] = procneigh[dim][0];
|
||||||
if (mode == SINGLE) {
|
if (mode == Comm::SINGLE) {
|
||||||
slablo[iswap] = subhi[dim] - cutghost[dim];
|
slablo[iswap] = subhi[dim] - cutghost[dim];
|
||||||
if (ineed < 2) slabhi[iswap] = BIG;
|
if (ineed < 2) slabhi[iswap] = BIG;
|
||||||
else slabhi[iswap] = 0.5 * (sublo[dim] + subhi[dim]);
|
else slabhi[iswap] = 0.5 * (sublo[dim] + subhi[dim]);
|
||||||
@ -737,7 +736,7 @@ void CommBrick::borders()
|
|||||||
// store sent atom indices in sendlist for use in future timesteps
|
// store sent atom indices in sendlist for use in future timesteps
|
||||||
|
|
||||||
x = atom->x;
|
x = atom->x;
|
||||||
if (mode == SINGLE) {
|
if (mode == Comm::SINGLE) {
|
||||||
lo = slablo[iswap];
|
lo = slablo[iswap];
|
||||||
hi = slabhi[iswap];
|
hi = slabhi[iswap];
|
||||||
} else {
|
} else {
|
||||||
@ -766,7 +765,7 @@ void CommBrick::borders()
|
|||||||
|
|
||||||
if (sendflag) {
|
if (sendflag) {
|
||||||
if (!bordergroup || ineed >= 2) {
|
if (!bordergroup || ineed >= 2) {
|
||||||
if (mode == SINGLE) {
|
if (mode == Comm::SINGLE) {
|
||||||
for (i = nfirst; i < nlast; i++)
|
for (i = nfirst; i < nlast; i++)
|
||||||
if (x[i][dim] >= lo && x[i][dim] <= hi) {
|
if (x[i][dim] >= lo && x[i][dim] <= hi) {
|
||||||
if (nsend == maxsendlist[iswap]) grow_list(iswap,nsend);
|
if (nsend == maxsendlist[iswap]) grow_list(iswap,nsend);
|
||||||
@ -783,7 +782,7 @@ void CommBrick::borders()
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (mode == SINGLE) {
|
if (mode == Comm::SINGLE) {
|
||||||
ngroup = atom->nfirst;
|
ngroup = atom->nfirst;
|
||||||
for (i = 0; i < ngroup; i++)
|
for (i = 0; i < ngroup; i++)
|
||||||
if (x[i][dim] >= lo && x[i][dim] <= hi) {
|
if (x[i][dim] >= lo && x[i][dim] <= hi) {
|
||||||
@ -1396,7 +1395,7 @@ void CommBrick::grow_swap(int n)
|
|||||||
{
|
{
|
||||||
free_swap();
|
free_swap();
|
||||||
allocate_swap(n);
|
allocate_swap(n);
|
||||||
if (mode == MULTI) {
|
if (mode == Comm::MULTI) {
|
||||||
free_multi();
|
free_multi();
|
||||||
allocate_multi(n);
|
allocate_multi(n);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,7 +38,6 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
#define DELTA_PROCS 16
|
#define DELTA_PROCS 16
|
||||||
|
|
||||||
enum{SINGLE,MULTI}; // same as in Comm
|
|
||||||
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
|
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -115,7 +114,7 @@ void CommTiled::init()
|
|||||||
|
|
||||||
if (triclinic)
|
if (triclinic)
|
||||||
error->all(FLERR,"Cannot yet use comm_style tiled with triclinic box");
|
error->all(FLERR,"Cannot yet use comm_style tiled with triclinic box");
|
||||||
if (mode == MULTI)
|
if (mode == Comm::MULTI)
|
||||||
error->all(FLERR,"Cannot yet use comm_style tiled with multi-mode comm");
|
error->all(FLERR,"Cannot yet use comm_style tiled with multi-mode comm");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,8 +29,6 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
#define MAXLINE 128
|
#define MAXLINE 128
|
||||||
|
|
||||||
enum{MULTIPLE}; // same as in Comm
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
ProcMap::ProcMap(LAMMPS *lmp) : Pointers(lmp) {}
|
ProcMap::ProcMap(LAMMPS *lmp) : Pointers(lmp) {}
|
||||||
@ -811,7 +809,7 @@ int ProcMap::cull_other(int n, int **factors, int m,
|
|||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < n) {
|
while (i < n) {
|
||||||
if (other_style == MULTIPLE) {
|
if (other_style == Comm::MULTIPLE) {
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
if ((other_procgrid[0]/other_coregrid[0]) % factors[i][0]) flag = 1;
|
if ((other_procgrid[0]/other_coregrid[0]) % factors[i][0]) flag = 1;
|
||||||
if ((other_procgrid[1]/other_coregrid[1]) % factors[i][1]) flag = 1;
|
if ((other_procgrid[1]/other_coregrid[1]) % factors[i][1]) flag = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user