forked from lijiext/lammps
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@13971 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
1a435a401c
commit
4bd3fe89c8
|
@ -31,17 +31,17 @@ done
|
|||
if (test $1 = 1) then
|
||||
|
||||
if (test -e ../Makefile.package) then
|
||||
sed -i -e 's/[^ \t]*ch5md[^ \t]* //g' ../Makefile.package
|
||||
sed -i -e 's/[^ \t]*h5md[^ \t]* //g' ../Makefile.package
|
||||
sed -i -e 's|^PKG_INC =[ \t]*|&-I..\/..\/lib\/h5md\/include |' ../Makefile.package
|
||||
sed -i -e 's|^PKG_PATH =[ \t]*|&-L..\/..\/lib\/h5md |' ../Makefile.package
|
||||
sed -i -e 's|^PKG_LIB =[ \t]*|&-lch5md |' ../Makefile.package
|
||||
sed -i -e 's|^PKG_SYSINC =[ \t]*|&$(ch5md_SYSINC) |' ../Makefile.package
|
||||
sed -i -e 's|^PKG_SYSLIB =[ \t]*|&$(ch5md_SYSLIB) |' ../Makefile.package
|
||||
sed -i -e 's|^PKG_SYSPATH =[ \t]*|&$(ch5md_SYSPATH) |' ../Makefile.package
|
||||
sed -i -e 's|^PKG_SYSINC =[ \t]*|&$(h5md_SYSINC) |' ../Makefile.package
|
||||
sed -i -e 's|^PKG_SYSLIB =[ \t]*|&$(h5md_SYSLIB) |' ../Makefile.package
|
||||
sed -i -e 's|^PKG_SYSPATH =[ \t]*|&$(h5md_SYSPATH) |' ../Makefile.package
|
||||
fi
|
||||
|
||||
if (test -e ../Makefile.package.settings) then
|
||||
sed -i -e '/^include.*ch5md.*$/d' ../Makefile.package.settings
|
||||
sed -i -e '/^include.*h5md.*$/d' ../Makefile.package.settings
|
||||
# multiline form needed for BSD sed on Macs
|
||||
sed -i -e '4 i \
|
||||
include ..\/..\/lib\/h5md\/Makefile.lammps
|
||||
|
@ -52,11 +52,11 @@ include ..\/..\/lib\/h5md\/Makefile.lammps
|
|||
elif (test $1 = 0) then
|
||||
|
||||
if (test -e ../Makefile.package) then
|
||||
sed -i -e 's/[^ \t]*ch5md[^ \t]* //g' ../Makefile.package
|
||||
sed -i -e 's/[^ \t]*h5md[^ \t]* //g' ../Makefile.package
|
||||
fi
|
||||
|
||||
if (test -e ../Makefile.package.settings) then
|
||||
sed -i -e '/^include.*ch5md.*$/d' ../Makefile.package.settings
|
||||
sed -i -e '/^include.*h5md.*$/d' ../Makefile.package.settings
|
||||
fi
|
||||
|
||||
fi
|
||||
|
|
|
@ -106,16 +106,6 @@ FixOMP::FixOMP(LAMMPS *lmp, int narg, char **arg)
|
|||
else if (strcmp(arg[iarg]+1,"no") == 0) _neighbor = false;
|
||||
else error->all(FLERR,"Illegal package omp command");
|
||||
iarg += 2;
|
||||
}
|
||||
|
||||
// undocumented options
|
||||
|
||||
else if (strcmp(arg[iarg],"mixed") == 0) {
|
||||
_mixed = true;
|
||||
iarg++;
|
||||
} else if (strcmp(arg[iarg],"double") == 0) {
|
||||
_mixed = false;
|
||||
iarg++;
|
||||
} else error->all(FLERR,"Illegal package omp command");
|
||||
}
|
||||
|
||||
|
@ -123,20 +113,17 @@ FixOMP::FixOMP(LAMMPS *lmp, int narg, char **arg)
|
|||
|
||||
if (comm->me == 0) {
|
||||
const char * const nmode = _neighbor ? "multi-threaded" : "serial";
|
||||
const char * const kmode = _mixed ? "mixed" : "double";
|
||||
|
||||
if (screen) {
|
||||
if (reset_thr)
|
||||
fprintf(screen,"set %d OpenMP thread(s) per MPI task\n", nthreads);
|
||||
fprintf(screen,"using %s neighbor list subroutines\n", nmode);
|
||||
fprintf(screen,"prefer %s precision OpenMP force kernels\n", kmode);
|
||||
}
|
||||
|
||||
if (logfile) {
|
||||
if (reset_thr)
|
||||
fprintf(logfile,"set %d OpenMP thread(s) per MPI task\n", nthreads);
|
||||
fprintf(logfile,"using %s neighbor list subroutines\n", nmode);
|
||||
fprintf(logfile,"prefer %s precision OpenMP force kernels\n", kmode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -84,27 +84,27 @@ void ThrData::init_force(int nall, double **f, double **torque,
|
|||
eatom_pair=eatom_bond=eatom_angle=eatom_dihed=eatom_imprp=eatom_kspce=NULL;
|
||||
vatom_pair=vatom_bond=vatom_angle=vatom_dihed=vatom_imprp=vatom_kspce=NULL;
|
||||
|
||||
if (nall > 0 && f) {
|
||||
if (nall >= 0 && f) {
|
||||
_f = f + _tid*nall;
|
||||
memset(&(_f[0][0]),0,nall*3*sizeof(double));
|
||||
} else _f = NULL;
|
||||
|
||||
if (nall > 0 && torque) {
|
||||
if (nall >= 0 && torque) {
|
||||
_torque = torque + _tid*nall;
|
||||
memset(&(_torque[0][0]),0,nall*3*sizeof(double));
|
||||
} else _torque = NULL;
|
||||
|
||||
if (nall > 0 && erforce) {
|
||||
if (nall >= 0 && erforce) {
|
||||
_erforce = erforce + _tid*nall;
|
||||
memset(&(_erforce[0]),0,nall*sizeof(double));
|
||||
} else _erforce = NULL;
|
||||
|
||||
if (nall > 0 && de) {
|
||||
if (nall >= 0 && de) {
|
||||
_de = de + _tid*nall;
|
||||
memset(&(_de[0]),0,nall*sizeof(double));
|
||||
} else _de = NULL;
|
||||
|
||||
if (nall > 0 && drho) {
|
||||
if (nall >= 0 && drho) {
|
||||
_drho = drho + _tid*nall;
|
||||
memset(&(_drho[0]),0,nall*sizeof(double));
|
||||
} else _drho = NULL;
|
||||
|
|
47
src/comm.cpp
47
src/comm.cpp
|
@ -56,6 +56,7 @@ Comm::Comm(LAMMPS *lmp) : Pointers(lmp)
|
|||
mode = 0;
|
||||
bordergroup = 0;
|
||||
cutghostuser = 0.0;
|
||||
cutusermulti = NULL;
|
||||
ghost_velocity = 0;
|
||||
|
||||
user_procgrid[0] = user_procgrid[1] = user_procgrid[2] = 0;
|
||||
|
@ -114,6 +115,7 @@ Comm::~Comm()
|
|||
memory->destroy(xsplit);
|
||||
memory->destroy(ysplit);
|
||||
memory->destroy(zsplit);
|
||||
memory->destroy(cutusermulti);
|
||||
delete [] customfile;
|
||||
delete [] outfile;
|
||||
}
|
||||
|
@ -141,6 +143,11 @@ void Comm::copy_arrays(Comm *oldcomm)
|
|||
memcpy(zsplit,oldcomm->zsplit,(procgrid[2]+1)*sizeof(double));
|
||||
}
|
||||
|
||||
if (oldcomm->cutusermulti) {
|
||||
memory->create(cutusermulti,atom->ntypes+1,"comm:cutusermulti");
|
||||
memcpy(cutusermulti,oldcomm->cutusermulti,atom->ntypes+1);
|
||||
}
|
||||
|
||||
if (customfile) {
|
||||
int n = strlen(oldcomm->customfile) + 1;
|
||||
customfile = new char[n];
|
||||
|
@ -234,9 +241,17 @@ void Comm::modify_params(int narg, char **arg)
|
|||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"mode") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal comm_modify command");
|
||||
if (strcmp(arg[iarg+1],"single") == 0) mode = SINGLE;
|
||||
else if (strcmp(arg[iarg+1],"multi") == 0) mode = MULTI;
|
||||
else error->all(FLERR,"Illegal comm_modify command");
|
||||
if (strcmp(arg[iarg+1],"single") == 0) {
|
||||
// need to reset cutghostuser when switching comm mode
|
||||
if (mode == MULTI) cutghostuser = 0.0;
|
||||
memory->destroy(cutusermulti);
|
||||
cutusermulti = NULL;
|
||||
mode = SINGLE;
|
||||
} else if (strcmp(arg[iarg+1],"multi") == 0) {
|
||||
// need to reset cutghostuser when switching comm mode
|
||||
if (mode == SINGLE) cutghostuser = 0.0;
|
||||
mode = MULTI;
|
||||
} else error->all(FLERR,"Illegal comm_modify command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"group") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal comm_modify command");
|
||||
|
@ -249,10 +264,36 @@ void Comm::modify_params(int narg, char **arg)
|
|||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"cutoff") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal comm_modify command");
|
||||
if (mode == MULTI)
|
||||
error->all(FLERR,"Use cutoff/multi flag to set cutoff in multi mode");
|
||||
cutghostuser = force->numeric(FLERR,arg[iarg+1]);
|
||||
if (cutghostuser < 0.0)
|
||||
error->all(FLERR,"Invalid cutoff in comm_modify command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"cutoff/multi") == 0) {
|
||||
int i,nlo,nhi;
|
||||
double cut;
|
||||
if (mode == SINGLE)
|
||||
error->all(FLERR,"Use cutoff flag to set cutoff in single mode");
|
||||
if (domain->box_exist == 0)
|
||||
error->all(FLERR,
|
||||
"Cannot set cutoff/multi before simulation box is defined");
|
||||
const int ntypes = atom->ntypes;
|
||||
if (iarg+3 > narg)
|
||||
error->all(FLERR,"Illegal comm_modify command");
|
||||
if (cutusermulti == NULL) {
|
||||
memory->create(cutusermulti,ntypes+1,"comm:cutusermulti");
|
||||
for (i=0; i < ntypes+1; ++i)
|
||||
cutusermulti[i] = -1.0;
|
||||
}
|
||||
force->bounds(arg[iarg+1],ntypes,nlo,nhi,1);
|
||||
cut = force->numeric(FLERR,arg[iarg+2]);
|
||||
cutghostuser = MAX(cutghostuser,cut);
|
||||
if (cut < 0.0)
|
||||
error->all(FLERR,"Invalid cutoff in comm_modify command");
|
||||
for (i=nlo; i<=nhi; ++i)
|
||||
cutusermulti[i] = cut;
|
||||
iarg += 3;
|
||||
} else if (strcmp(arg[iarg],"vel") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal comm_modify command");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) ghost_velocity = 1;
|
||||
|
|
|
@ -29,7 +29,8 @@ class Comm : protected Pointers {
|
|||
int me,nprocs; // proc info
|
||||
int ghost_velocity; // 1 if ghost atoms have velocity, 0 if not
|
||||
double cutghost[3]; // cutoffs used for acquiring ghost atoms
|
||||
double cutghostuser; // user-specified ghost cutoff
|
||||
double cutghostuser; // user-specified ghost cutoff (mode == 0)
|
||||
double *cutusermulti; // per type user ghost cutoff (mode == 1)
|
||||
int recv_from_partition; // recv proc layout from this partition
|
||||
int send_to_partition; // send my proc layout to this partition
|
||||
// -1 if no recv or send
|
||||
|
@ -59,6 +60,7 @@ class Comm : protected Pointers {
|
|||
|
||||
Comm(class LAMMPS *);
|
||||
virtual ~Comm();
|
||||
// NOTE: copy_arrays is called from a constructor and must not be made virtual
|
||||
void copy_arrays(class Comm *);
|
||||
virtual void init();
|
||||
void modify_params(int, char **);
|
||||
|
|
|
@ -55,6 +55,7 @@ CommBrick::CommBrick(LAMMPS *lmp) : Comm(lmp)
|
|||
{
|
||||
style = 0;
|
||||
layout = LAYOUT_UNIFORM;
|
||||
pbc_flag = NULL;
|
||||
init_buffers();
|
||||
}
|
||||
|
||||
|
@ -77,6 +78,11 @@ CommBrick::~CommBrick()
|
|||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
//IMPORTANT: we *MUST* pass "*oldcomm" to the Comm initializer here, as
|
||||
// the code below *requires* that the (implicit) copy constructor
|
||||
// for Comm is run and thus creating a shallow copy of "oldcomm".
|
||||
// The call to Comm::copy_arrays() then converts the shallow copy
|
||||
// into a deep copy of the class with the new layout.
|
||||
|
||||
CommBrick::CommBrick(LAMMPS *lmp, Comm *oldcomm) : Comm(*oldcomm)
|
||||
{
|
||||
|
@ -85,7 +91,7 @@ CommBrick::CommBrick(LAMMPS *lmp, Comm *oldcomm) : Comm(*oldcomm)
|
|||
|
||||
style = 0;
|
||||
layout = oldcomm->layout;
|
||||
copy_arrays(oldcomm);
|
||||
Comm::copy_arrays(oldcomm);
|
||||
init_buffers();
|
||||
}
|
||||
|
||||
|
@ -172,9 +178,13 @@ void CommBrick::setup()
|
|||
|
||||
if (mode == MULTI) {
|
||||
double *cuttype = neighbor->cuttype;
|
||||
for (i = 1; i <= ntypes; i++)
|
||||
cutghostmulti[i][0] = cutghostmulti[i][1] = cutghostmulti[i][2] =
|
||||
cuttype[i];
|
||||
for (i = 1; i <= ntypes; i++) {
|
||||
cut = 0.0;
|
||||
if (cutusermulti) cut = cutusermulti[i];
|
||||
cutghostmulti[i][0] = MAX(cut,cuttype[i]);
|
||||
cutghostmulti[i][1] = MAX(cut,cuttype[i]);
|
||||
cutghostmulti[i][2] = MAX(cut,cuttype[i]);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -193,9 +203,11 @@ void CommBrick::setup()
|
|||
if (mode == MULTI) {
|
||||
double *cuttype = neighbor->cuttype;
|
||||
for (i = 1; i <= ntypes; i++) {
|
||||
cutghostmulti[i][0] = cuttype[i] * length0;
|
||||
cutghostmulti[i][1] = cuttype[i] * length1;
|
||||
cutghostmulti[i][2] = cuttype[i] * length2;
|
||||
cut = 0.0;
|
||||
if (cutusermulti) cut = cutusermulti[i];
|
||||
cutghostmulti[i][0] = length0 * MAX(cut,cuttype[i]);
|
||||
cutghostmulti[i][1] = length1 * MAX(cut,cuttype[i]);
|
||||
cutghostmulti[i][2] = length2 * MAX(cut,cuttype[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1403,6 +1415,7 @@ void CommBrick::free_multi()
|
|||
{
|
||||
memory->destroy(multilo);
|
||||
memory->destroy(multihi);
|
||||
multilo = multihi = NULL;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
|
|
@ -73,7 +73,9 @@ class CommBrick : public Comm {
|
|||
int bufextra; // extra space beyond maxsend in send buffer
|
||||
int smax,rmax; // max size in atoms of single borders send/recv
|
||||
|
||||
// NOTE: init_buffers is called from a constructor and must not be made virtual
|
||||
void init_buffers();
|
||||
|
||||
int updown(int, int, int, double, int, double *);
|
||||
// compare cutoff to procs
|
||||
virtual void grow_send(int, int); // reallocate send buffer
|
||||
|
|
|
@ -52,11 +52,17 @@ CommTiled::CommTiled(LAMMPS *lmp) : Comm(lmp)
|
|||
|
||||
style = 1;
|
||||
layout = LAYOUT_UNIFORM;
|
||||
pbc_flag = NULL;
|
||||
init_buffers();
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
//IMPORTANT: we *MUST* pass "*oldcomm" to the Comm initializer here, as
|
||||
// the code below *requires* that the (implicit) copy constructor
|
||||
// for Comm is run and thus creating a shallow copy of "oldcomm".
|
||||
// The call to Comm::copy_arrays() then converts the shallow copy
|
||||
// into a deep copy of the class with the new layout.
|
||||
//
|
||||
CommTiled::CommTiled(LAMMPS *lmp, Comm *oldcomm) : Comm(*oldcomm)
|
||||
{
|
||||
if (lmp->cuda)
|
||||
|
@ -66,7 +72,7 @@ CommTiled::CommTiled(LAMMPS *lmp, Comm *oldcomm) : Comm(*oldcomm)
|
|||
|
||||
style = 1;
|
||||
layout = oldcomm->layout;
|
||||
copy_arrays(oldcomm);
|
||||
Comm::copy_arrays(oldcomm);
|
||||
init_buffers();
|
||||
}
|
||||
|
||||
|
|
|
@ -110,6 +110,7 @@ class CommTiled : public Comm {
|
|||
double *sublo,*subhi;
|
||||
int dimension;
|
||||
|
||||
// NOTE: init_buffers is called from a constructor and must not be made virtual
|
||||
void init_buffers();
|
||||
|
||||
// box drop and other functions
|
||||
|
|
|
@ -252,8 +252,7 @@ void Info::command(int narg, char **arg)
|
|||
double cut;
|
||||
for (int i=1; i <= atom->ntypes && neighbor->cuttype; ++i) {
|
||||
cut = neighbor->cuttype[i];
|
||||
// AXEL: this variable does not exist?
|
||||
//if (comm->cutusermulti) cut = MAX(cut,comm->cutusermulti[i]);
|
||||
if (comm->cutusermulti) cut = MAX(cut,comm->cutusermulti[i]);
|
||||
fprintf(out,"Communication cutoff for type %d = %g\n", i, cut);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue