forked from lijiext/lammps
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12147 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
67ae64329e
commit
8a9e1676eb
|
@ -43,6 +43,10 @@ action pair_buck_gpu.cpp pair_buck.cpp
|
|||
action pair_buck_gpu.h pair_buck.cpp
|
||||
action pair_colloid_gpu.cpp pair_colloid.cpp
|
||||
action pair_colloid_gpu.h pair_colloid.cpp
|
||||
action pair_coul_cut_gpu.cpp
|
||||
action pair_coul_cut_gpu.h
|
||||
action pair_coul_debye_gpu.cpp
|
||||
action pair_coul_debye_gpu.h
|
||||
action pair_coul_dsf_gpu.cpp
|
||||
action pair_coul_dsf_gpu.h
|
||||
action pair_coul_long_gpu.cpp pair_coul_long.cpp
|
||||
|
|
|
@ -47,6 +47,10 @@ int born_gpu_init(const int ntypes, double **cutsq, double **host_rhoinv,
|
|||
const int inum, const int nall, const int max_nbors,
|
||||
const int maxspecial, const double cell_size,
|
||||
int &gpu_mode, FILE *screen);
|
||||
void born_gpu_reinit(const int ntypes, double **host_rhoinv,
|
||||
double **host_born1, double **host_born2, double **host_born3,
|
||||
double **host_a, double **host_c, double **host_d,
|
||||
double **offset);
|
||||
void born_gpu_clear();
|
||||
int ** born_gpu_compute_n(const int ago, const int inum_full,
|
||||
const int nall, double **host_x, int *host_type,
|
||||
|
@ -67,7 +71,6 @@ double born_gpu_bytes();
|
|||
PairBornGPU::PairBornGPU(LAMMPS *lmp) : PairBorn(lmp), gpu_mode(GPU_FORCE)
|
||||
{
|
||||
respa_enable = 0;
|
||||
reinitflag = 0;
|
||||
cpu_time = 0.0;
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
}
|
||||
|
@ -165,6 +168,16 @@ void PairBornGPU::init_style()
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairBornGPU::reinit()
|
||||
{
|
||||
Pair::reinit();
|
||||
|
||||
born_gpu_reinit(atom->ntypes+1, rhoinv, born1, born2, born3,
|
||||
a, c, d, offset);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairBornGPU::memory_usage()
|
||||
{
|
||||
double bytes = Pair::memory_usage();
|
||||
|
|
|
@ -31,6 +31,7 @@ class PairBornGPU : public PairBorn {
|
|||
void cpu_compute(int, int, int, int, int *, int *, int **);
|
||||
void compute(int, int);
|
||||
void init_style();
|
||||
void reinit();
|
||||
double memory_usage();
|
||||
|
||||
enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH };
|
||||
|
|
|
@ -45,6 +45,9 @@ int buck_gpu_init(const int ntypes, double **cutsq, double **host_rhoinv,
|
|||
double **offset, double *special_lj, const int inum,
|
||||
const int nall, const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen);
|
||||
void buck_gpu_reinit(const int ntypes, double **cutsq, double **host_rhoinv,
|
||||
double **host_buck1, double **host_buck2,
|
||||
double **host_a, double **host_c, double **offset);
|
||||
void buck_gpu_clear();
|
||||
int ** buck_gpu_compute_n(const int ago, const int inum_full, const int nall,
|
||||
double **host_x, int *host_type, double *sublo,
|
||||
|
@ -65,7 +68,6 @@ double buck_gpu_bytes();
|
|||
PairBuckGPU::PairBuckGPU(LAMMPS *lmp) : PairBuck(lmp), gpu_mode(GPU_FORCE)
|
||||
{
|
||||
respa_enable = 0;
|
||||
reinitflag = 0;
|
||||
cpu_time = 0.0;
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
}
|
||||
|
@ -162,6 +164,16 @@ void PairBuckGPU::init_style()
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairBuckGPU::reinit()
|
||||
{
|
||||
Pair::reinit();
|
||||
|
||||
buck_gpu_reinit(atom->ntypes+1, cutsq, rhoinv, buck1, buck2,
|
||||
a, c, offset);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairBuckGPU::memory_usage()
|
||||
{
|
||||
double bytes = Pair::memory_usage();
|
||||
|
|
|
@ -31,6 +31,7 @@ class PairBuckGPU : public PairBuck {
|
|||
void cpu_compute(int, int, int, int, int *, int *, int **);
|
||||
void compute(int, int);
|
||||
void init_style();
|
||||
void reinit();
|
||||
double memory_usage();
|
||||
|
||||
enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH };
|
||||
|
|
|
@ -48,10 +48,12 @@ using namespace LAMMPS_NS;
|
|||
|
||||
// External functions from cuda library for atom decomposition
|
||||
|
||||
int cl_gpu_init(const int nlocal, const int nall, const int max_nbors,
|
||||
int cl_gpu_init(const int ntypes, double **scale,
|
||||
const int nlocal, const int nall, const int max_nbors,
|
||||
const int maxspecial, const double cell_size, int &gpu_mode,
|
||||
FILE *screen, double host_cut_coulsq, double *host_special_coul,
|
||||
const double qqrd2e, const double g_ewald);
|
||||
void cl_gpu_reinit(const int ntypes, double **scale);
|
||||
void cl_gpu_clear();
|
||||
int ** cl_gpu_compute_n(const int ago, const int inum,
|
||||
const int nall, double **host_x, int *host_type,
|
||||
|
@ -75,7 +77,6 @@ PairCoulLongGPU::PairCoulLongGPU(LAMMPS *lmp) :
|
|||
PairCoulLong(lmp), gpu_mode(GPU_FORCE)
|
||||
{
|
||||
respa_enable = 0;
|
||||
reinitflag = 0;
|
||||
cpu_time = 0.0;
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
}
|
||||
|
@ -144,7 +145,7 @@ void PairCoulLongGPU::init_style()
|
|||
error->all(FLERR,"Cannot use newton pair with coul/long/gpu pair style");
|
||||
|
||||
// Repeat cutsq calculation because done after call to init_style
|
||||
double cell_size = sqrt(cut_coul) + neighbor->skin;
|
||||
double cell_size = cut_coul + neighbor->skin;
|
||||
|
||||
cut_coulsq = cut_coul * cut_coul;
|
||||
|
||||
|
@ -161,7 +162,8 @@ void PairCoulLongGPU::init_style()
|
|||
int maxspecial=0;
|
||||
if (atom->molecular)
|
||||
maxspecial=atom->maxspecial;
|
||||
int success = cl_gpu_init(atom->nlocal, atom->nlocal+atom->nghost, 300,
|
||||
int success = cl_gpu_init(atom->ntypes+1, scale,
|
||||
atom->nlocal, atom->nlocal+atom->nghost, 300,
|
||||
maxspecial, cell_size, gpu_mode, screen, cut_coulsq,
|
||||
force->special_coul, force->qqrd2e, g_ewald);
|
||||
|
||||
|
@ -176,6 +178,15 @@ void PairCoulLongGPU::init_style()
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairCoulLongGPU::reinit()
|
||||
{
|
||||
Pair::reinit();
|
||||
|
||||
cl_gpu_reinit(atom->ntypes+1, scale);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairCoulLongGPU::memory_usage()
|
||||
{
|
||||
double bytes = Pair::memory_usage();
|
||||
|
|
|
@ -31,6 +31,7 @@ class PairCoulLongGPU : public PairCoulLong {
|
|||
void cpu_compute(int, int, int, int, int *, int *, int **);
|
||||
void compute(int, int);
|
||||
void init_style();
|
||||
void reinit();
|
||||
double memory_usage();
|
||||
|
||||
enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH };
|
||||
|
|
|
@ -44,6 +44,8 @@ int gauss_gpu_init(const int ntypes, double **cutsq, double **host_a,
|
|||
double **b, double **offset, double *special_lj, const int nlocal,
|
||||
const int nall, const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen);
|
||||
int gauss_gpu_reinit(const int ntypes, double **cutsq, double **host_a,
|
||||
double **b, double **offset);
|
||||
void gauss_gpu_clear();
|
||||
int ** gauss_gpu_compute_n(const int ago, const int inum,
|
||||
const int nall, double **host_x, int *host_type,
|
||||
|
@ -64,7 +66,6 @@ double gauss_gpu_bytes();
|
|||
PairGaussGPU::PairGaussGPU(LAMMPS *lmp) : PairGauss(lmp), gpu_mode(GPU_FORCE)
|
||||
{
|
||||
respa_enable = 0;
|
||||
reinitflag = 0;
|
||||
cpu_time = 0.0;
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
}
|
||||
|
@ -161,6 +162,15 @@ void PairGaussGPU::init_style()
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairGaussGPU::reinit()
|
||||
{
|
||||
Pair::reinit();
|
||||
|
||||
gauss_gpu_reinit(atom->ntypes+1, cutsq, a, b, offset);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairGaussGPU::memory_usage()
|
||||
{
|
||||
double bytes = Pair::memory_usage();
|
||||
|
|
|
@ -31,6 +31,7 @@ class PairGaussGPU : public PairGauss {
|
|||
void cpu_compute(int, int, int, int, int *, int *, int **);
|
||||
void compute(int, int);
|
||||
void init_style();
|
||||
void reinit();
|
||||
double memory_usage();
|
||||
|
||||
enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH };
|
||||
|
|
|
@ -44,6 +44,11 @@ int ljl_gpu_init(const int ntypes, double **cutsq, double **host_lj1,
|
|||
double **offset, double *special_lj, const int nlocal,
|
||||
const int nall, const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen);
|
||||
|
||||
int ljl_gpu_reinit(const int ntypes, double **cutsq, double **host_lj1,
|
||||
double **host_lj2, double **host_lj3, double **host_lj4,
|
||||
double **offset);
|
||||
|
||||
void ljl_gpu_clear();
|
||||
int ** ljl_gpu_compute_n(const int ago, const int inum,
|
||||
const int nall, double **host_x, int *host_type,
|
||||
|
@ -64,7 +69,6 @@ double ljl_gpu_bytes();
|
|||
PairLJCutGPU::PairLJCutGPU(LAMMPS *lmp) : PairLJCut(lmp), gpu_mode(GPU_FORCE)
|
||||
{
|
||||
respa_enable = 0;
|
||||
reinitflag = 0;
|
||||
cpu_time = 0.0;
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
}
|
||||
|
@ -87,7 +91,7 @@ void PairLJCutGPU::compute(int eflag, int vflag)
|
|||
|
||||
int nall = atom->nlocal + atom->nghost;
|
||||
int inum, host_start;
|
||||
|
||||
|
||||
bool success = true;
|
||||
int *ilist, *numneigh, **firstneigh;
|
||||
if (gpu_mode != GPU_FORCE) {
|
||||
|
@ -163,6 +167,15 @@ void PairLJCutGPU::init_style()
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJCutGPU::reinit()
|
||||
{
|
||||
Pair::reinit();
|
||||
|
||||
ljl_gpu_reinit(atom->ntypes+1, cutsq, lj1, lj2, lj3, lj4, offset);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairLJCutGPU::memory_usage()
|
||||
{
|
||||
double bytes = Pair::memory_usage();
|
||||
|
|
|
@ -31,6 +31,7 @@ class PairLJCutGPU : public PairLJCut {
|
|||
void cpu_compute(int, int, int, int, int *, int *, int **);
|
||||
void compute(int, int);
|
||||
void init_style();
|
||||
void reinit();
|
||||
double memory_usage();
|
||||
|
||||
enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH };
|
||||
|
|
|
@ -45,6 +45,9 @@ int lje_gpu_init(const int ntypes, double **cutsq, double **host_lj1,
|
|||
const int nlocal, const int nall, const int max_nbors,
|
||||
const int maxspecial, const double cell_size, int &gpu_mode,
|
||||
FILE *screen);
|
||||
int lje_gpu_reinit(const int ntypes, double **cutsq, double **host_lj1,
|
||||
double **host_lj2, double **host_lj3, double **host_lj4,
|
||||
double **offset, double **shift);
|
||||
void lje_gpu_clear();
|
||||
int ** lje_gpu_compute_n(const int ago, const int inum, const int nall,
|
||||
double **host_x, int *host_type, double *sublo,
|
||||
|
@ -65,7 +68,6 @@ double lje_gpu_bytes();
|
|||
PairLJExpandGPU::PairLJExpandGPU(LAMMPS *lmp) : PairLJExpand(lmp), gpu_mode(GPU_FORCE)
|
||||
{
|
||||
respa_enable = 0;
|
||||
reinitflag = 0;
|
||||
cpu_time = 0.0;
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
}
|
||||
|
@ -162,6 +164,15 @@ void PairLJExpandGPU::init_style()
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJExpandGPU::reinit()
|
||||
{
|
||||
Pair::reinit();
|
||||
|
||||
lje_gpu_reinit(atom->ntypes+1, cutsq, lj1, lj2, lj3, lj4, offset, shift);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairLJExpandGPU::memory_usage()
|
||||
{
|
||||
double bytes = Pair::memory_usage();
|
||||
|
|
|
@ -31,6 +31,7 @@ class PairLJExpandGPU : public PairLJExpand {
|
|||
void cpu_compute(int, int, int, int, int *, int *, int **);
|
||||
void compute(int, int);
|
||||
void init_style();
|
||||
void reinit();
|
||||
double memory_usage();
|
||||
|
||||
enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH };
|
||||
|
|
|
@ -45,6 +45,8 @@ int soft_gpu_init(const int ntypes, double **cutsq, double **prefactor,
|
|||
double **cut, double *special_lj, const int nlocal,
|
||||
const int nall, const int max_nbors, const int maxspecial,
|
||||
const double cell_size, int &gpu_mode, FILE *screen);
|
||||
void soft_gpu_reinit(const int ntypes, double **cutsq, double **host_prefactor,
|
||||
double **host_cut);
|
||||
void soft_gpu_clear();
|
||||
int ** soft_gpu_compute_n(const int ago, const int inum,
|
||||
const int nall, double **host_x, int *host_type,
|
||||
|
@ -68,7 +70,6 @@ using namespace MathConst;
|
|||
PairSoftGPU::PairSoftGPU(LAMMPS *lmp) : PairSoft(lmp), gpu_mode(GPU_FORCE)
|
||||
{
|
||||
respa_enable = 0;
|
||||
reinitflag = 0;
|
||||
cpu_time = 0.0;
|
||||
GPU_EXTRA::gpu_ready(lmp->modify, lmp->error);
|
||||
}
|
||||
|
@ -165,6 +166,15 @@ void PairSoftGPU::init_style()
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairSoftGPU::reinit()
|
||||
{
|
||||
Pair::reinit();
|
||||
|
||||
soft_gpu_reinit(atom->ntypes+1, cutsq, prefactor, cut);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double PairSoftGPU::memory_usage()
|
||||
{
|
||||
double bytes = Pair::memory_usage();
|
||||
|
|
|
@ -31,6 +31,7 @@ class PairSoftGPU : public PairSoft {
|
|||
void cpu_compute(int, int, int, int, int *, int *, int **);
|
||||
void compute(int, int);
|
||||
void init_style();
|
||||
void reinit();
|
||||
double memory_usage();
|
||||
|
||||
enum { GPU_FORCE, GPU_NEIGH, GPU_HYB_NEIGH };
|
||||
|
|
|
@ -84,12 +84,39 @@ void CommTiled::init()
|
|||
void CommTiled::setup()
|
||||
{
|
||||
// error on triclinic or multi?
|
||||
// set nswap
|
||||
// set nswap = 2*dim
|
||||
// setup neighbor proc info for exchange()
|
||||
// setup nsendproc and nrecvproc bounts
|
||||
// setup sendproc and recvproc lists
|
||||
// setup sendbox
|
||||
// setup sendboxes
|
||||
// reallocate requests and statuses
|
||||
|
||||
// check that cutoff is <= 1/2 of periodic box len?
|
||||
|
||||
// loop over dims
|
||||
// left:
|
||||
// construct ghost boxes
|
||||
// differnet in x,y,z
|
||||
// account for ghost borders in y,z
|
||||
// account for PBC by shifting
|
||||
// split into multiple boxes if straddles PBC
|
||||
// drop boxes down RCB tree
|
||||
// count unique procs they cover
|
||||
// what about self if crosses PBC
|
||||
// for each proc they cover:
|
||||
// compute box I send it to left
|
||||
// is a message I will recv from right (don't care about box)
|
||||
// for ghost-extended boxes
|
||||
// do not count procs that do not overlap my owned box at all
|
||||
// only touching edge of my owned box does not count
|
||||
// in this case list I send to and recv from may be different?
|
||||
// same thing to right
|
||||
|
||||
// what need from decomp (RCB):
|
||||
// dropbox: return list of procs with overlap and overlapping boxes
|
||||
// return n, proclist, boxlist
|
||||
// otherbox: bbox of another proc
|
||||
// dropatom: return what proc owns the atom coord
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -249,6 +276,14 @@ void CommTiled::reverse_comm()
|
|||
|
||||
void CommTiled::exchange()
|
||||
{
|
||||
// loop over atoms
|
||||
// if not outside my box, continue
|
||||
// find which proc it is in
|
||||
// find which one of my touching procs it is, else lost
|
||||
// make sure all atoms are "lost" that should be (e.g. outside non-PBC)
|
||||
// add to list to send to that proc
|
||||
// loop over touching procs
|
||||
// send buffer to them
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
|
|
@ -85,7 +85,8 @@ void PairCoulDebye::compute(int eflag, int vflag)
|
|||
r = sqrt(rsq);
|
||||
rinv = 1.0/r;
|
||||
screening = exp(-kappa*r);
|
||||
forcecoul = qqrd2e * qtmp*q[j] * screening * (kappa + rinv);
|
||||
forcecoul = qqrd2e * scale[itype][jtype] *
|
||||
qtmp*q[j] * screening * (kappa + rinv);
|
||||
fpair = factor_coul*forcecoul * r2inv;
|
||||
|
||||
f[i][0] += delx*fpair;
|
||||
|
@ -97,7 +98,8 @@ void PairCoulDebye::compute(int eflag, int vflag)
|
|||
f[j][2] -= delz*fpair;
|
||||
}
|
||||
|
||||
if (eflag) ecoul = factor_coul * qqrd2e * qtmp*q[j] * rinv * screening;
|
||||
if (eflag) ecoul = factor_coul * qqrd2e *
|
||||
scale[itype][jtype] * qtmp*q[j] * rinv * screening;
|
||||
|
||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||
0.0,ecoul,fpair,delx,dely,delz);
|
||||
|
|
Loading…
Reference in New Issue