git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8490 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2012-07-24 14:55:49 +00:00
parent 0d1ef8e3be
commit 8b62babddd
9 changed files with 14 additions and 1048 deletions

View File

@ -55,16 +55,15 @@ include ..\/..\/lib\/cuda\/Makefile.lammps
if (test -e ../pair_lj_sdk.cpp) then
cp pair_lj_sdk_cuda.cpp ..
# cp pair_lj_sdk_coul_cut_cuda.cpp ..
# cp pair_lj_sdk_coul_debye_cuda.cpp ..
#cp pair_lj_sdk_coul_cut_cuda.cpp ..
#cp pair_lj_sdk_coul_debye_cuda.cpp ..
cp pair_lj_sdk_cuda.h ..
# cp pair_lj_sdk_coul_cut_cuda.h ..
# cp pair_lj_sdk_coul_debye_cuda.h ..
fi
if (test -e ../pair_lj_sdk_coul_long.cpp) then
cp pair_lj_sdk_coul_long_cuda.cpp ..
cp pair_lj_sdk_coul_long_cuda.h ..
#cp pair_lj_sdk_coul_cut_cuda.h ..
#cp pair_lj_sdk_coul_debye_cuda.h ..
if (test -e ../pair_lj_sdk_coul_long.cpp) then
cp pair_lj_sdk_coul_long_cuda.cpp ..
cp pair_lj_sdk_coul_long_cuda.h ..
fi
fi
if (test -e ../pppm.cpp) then
@ -77,7 +76,6 @@ include ..\/..\/lib\/cuda\/Makefile.lammps
cp pair_lj_cut_coul_long_cuda.cpp ..
cp pair_lj_cut_coul_long_cuda.h ..
fi
if (test -e ../pair_eam.cpp) then
cp pair_eam_alloy_cuda.cpp ..
@ -256,10 +254,10 @@ elif (test $1 = 0) then
rm -f ../pair_buck_coul_cut_cuda.cpp
rm -f ../pair_buck_coul_long_cuda.cpp
rm -f ../pair_buck_cuda.cpp
rm -f ../pair_lj_sdk_coul_cut_cuda.cpp
rm -f ../pair_lj_sdk_coul_debye_cuda.cpp
rm -f ../pair_lj_sdk_coul_long_cuda.cpp
rm -f ../pair_lj_sdk_cuda.cpp
#rm -f ../pair_lj_sdk_coul_cut_cuda.cpp
#rm -f ../pair_lj_sdk_coul_debye_cuda.cpp
rm -f ../pair_lj_sdk_coul_long_cuda.cpp
rm -f ../pair_eam_alloy_cuda.cpp
rm -f ../pair_eam_cuda.cpp
rm -f ../pair_eam_fs_cuda.cpp
@ -320,8 +318,9 @@ elif (test $1 = 0) then
rm -f ../pair_buck_coul_cut_cuda.h
rm -f ../pair_buck_coul_long_cuda.h
rm -f ../pair_buck_cuda.h
rm -f ../pair_lj_sdk_coul_cut_cuda.h
rm -f ../pair_lj_sdk_coul_debye_cuda.h
rm -f ../pair_lj_sdk_cuda.h
#rm -f ../pair_lj_sdk_coul_cut_cuda.h
#rm -f ../pair_lj_sdk_coul_debye_cuda.h
rm -f ../pair_lj_sdk_coul_long_cuda.h
rm -f ../pair_lj_sdk_cuda.h
rm -f ../pair_eam_alloy_cuda.h

View File

@ -1,199 +0,0 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
Original Version:
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
See the README file in the top-level LAMMPS directory.
-----------------------------------------------------------------------
USER-CUDA Package and associated modifications:
https://sourceforge.net/projects/lammpscuda/
Christian Trott, christian.trott@tu-ilmenau.de
Lars Winterfeld, lars.winterfeld@tu-ilmenau.de
Theoretical Physics II, University of Technology Ilmenau, Germany
See the README file in the USER-CUDA directory.
This software is distributed under the GNU General Public License.
------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
Contributing author: Paul Crozier (SNL)
------------------------------------------------------------------------- */
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "pair_cg_cmm_coul_cut_cuda.h"
#include "pair_cg_cmm_coul_cut_cuda_cu.h"
#include "cuda_data.h"
#include "atom.h"
#include "comm.h"
#include "force.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "cuda_neigh_list.h"
#include "update.h"
#include "integrate.h"
#include "respa.h"
#include "memory.h"
#include "error.h"
#include "cuda.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
PairCGCMMCoulCutCuda::PairCGCMMCoulCutCuda(LAMMPS *lmp) : PairCGCMMCoulCut(lmp)
{
cuda = lmp->cuda;
if(cuda == NULL)
error->all(FLERR,"You cannot use a /cuda class, without activating 'cuda' acceleration. Provide '-c on' as command-line argument to LAMMPS..");
allocated2 = false;
cg_type_double = NULL;
cuda->shared_data.pair.cudable_force = 1;
cuda->setSystemParams();
}
/* ----------------------------------------------------------------------
remember pointer to arrays in cuda shared data
------------------------------------------------------------------------- */
void PairCGCMMCoulCutCuda::allocate()
{
if(! allocated) PairCGCMMCoulCut::allocate();
int n = atom->ntypes;
if(! allocated2)
{
allocated2 = true;
memory->create(cg_type_double,n+1,n+1,"paircg:cgtypedouble");
cuda->shared_data.pair.cut = cut_lj;
cuda->shared_data.pair.cut_coul= cut_coul;
cuda->shared_data.pair.coeff1 = lj1;
cuda->shared_data.pair.coeff2 = lj2;
cuda->shared_data.pair.coeff3 = lj3;
cuda->shared_data.pair.coeff4 = lj4;
cuda->shared_data.pair.coeff5 = cg_type_double;
cuda->shared_data.pair.offset = offset;
cuda->shared_data.pair.special_lj = force->special_lj;
cuda->shared_data.pair.special_coul = force->special_coul;
}
for (int i = 1; i <= n; i++) {
for (int j = i; j <= n; j++) {
cg_type_double[i][j] = cg_type[i][j];
cg_type_double[j][i] = cg_type[i][j];
}
}
}
/* ---------------------------------------------------------------------- */
void PairCGCMMCoulCutCuda::compute(int eflag, int vflag)
{
if (eflag || vflag) ev_setup(eflag,vflag);
if(eflag) cuda->cu_eng_vdwl->upload();
if(eflag) cuda->cu_eng_coul->upload();
if(vflag) cuda->cu_virial->upload();
Cuda_PairCGCMMCoulCutCuda(& cuda->shared_data, & cuda_neigh_list->sneighlist, eflag, vflag, eflag_atom, vflag_atom);
if(not cuda->shared_data.pair.collect_forces_later)
{
if(eflag) cuda->cu_eng_vdwl->download();
if(eflag) cuda->cu_eng_coul->download();
if(vflag) cuda->cu_virial->download();
}
}
/* ---------------------------------------------------------------------- */
void PairCGCMMCoulCutCuda::settings(int narg, char **arg)
{
PairCGCMMCoulCut::settings(narg, arg);
cuda->shared_data.pair.cut_global = (F_FLOAT) cut_lj_global;
cuda->shared_data.pair.cut_coul_global = (F_FLOAT) cut_coul_global;
cuda->shared_data.pair.kappa = (F_FLOAT) kappa;
}
/* ---------------------------------------------------------------------- */
void PairCGCMMCoulCutCuda::coeff(int narg, char **arg)
{
PairCGCMMCoulCut::coeff(narg, arg);
allocate();
}
void PairCGCMMCoulCutCuda::init_style()
{
MYDBG(printf("# CUDA PairCGCMMCoulCutCuda::init_style start\n"); )
// request regular or rRESPA neighbor lists
int irequest;
if (update->whichflag == 0 && strstr(update->integrate_style,"respa")) {
}
else
{
irequest = neighbor->request(this);
neighbor->requests[irequest]->full = 1;
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->cudable = 1;
//neighbor->style=0; //0=NSQ neighboring
}
cuda->shared_data.pppm.qqrd2e=force->qqrd2e;
cut_respa=NULL;
if (force->newton) error->warning(FLERR,"Pair style uses does not use \"newton\" setting. You might test if \"newton off\" makes the simulation run faster.");
MYDBG(printf("# CUDA PairCGCMMCoulCutCuda::init_style end\n"); )
}
void PairCGCMMCoulCutCuda::init_list(int id, NeighList *ptr)
{
MYDBG(printf("# CUDA PairCGCMMCoulCutCuda::init_list\n");)
PairCGCMMCoulCut::init_list(id, ptr);
#ifndef CUDA_USE_BINNING
// right now we can only handle verlet (id 0), not respa
if(id == 0) cuda_neigh_list = cuda->registerNeighborList(ptr);
// see Neighbor::init() for details on lammps lists' logic
#endif
MYDBG(printf("# CUDA PairCGCMMCoulCutCuda::init_list end\n");)
}
void PairCGCMMCoulCutCuda::ev_setup(int eflag, int vflag)
{
int maxeatomold=maxeatom;
PairCGCMMCoulCut::ev_setup(eflag,vflag);
if (eflag_atom && atom->nmax > maxeatomold)
{delete cuda->cu_eatom; cuda->cu_eatom = new cCudaData<double, ENERGY_FLOAT, x > ((double*)eatom, & cuda->shared_data.atom.eatom , atom->nmax );}
if (vflag_atom && atom->nmax > maxeatomold)
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
}

View File

@ -1,58 +0,0 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
Original Version:
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
See the README file in the top-level LAMMPS directory.
-----------------------------------------------------------------------
USER-CUDA Package and associated modifications:
https://sourceforge.net/projects/lammpscuda/
Christian Trott, christian.trott@tu-ilmenau.de
Lars Winterfeld, lars.winterfeld@tu-ilmenau.de
Theoretical Physics II, University of Technology Ilmenau, Germany
See the README file in the USER-CUDA directory.
This software is distributed under the GNU General Public License.
------------------------------------------------------------------------- */
#ifdef PAIR_CLASS
PairStyle(cg/cmm/coul/cut/cuda,PairCGCMMCoulCutCuda)
#else
#ifndef PAIR_CG_CMM_COUL_CUT_CUDA_H
#define PAIR_CG_CMM_COUL_CUT_CUDA_H
#include "pair_cg_cmm_coul_cut.h"
namespace LAMMPS_NS {
class PairCGCMMCoulCutCuda : public PairCGCMMCoulCut
{
public:
PairCGCMMCoulCutCuda(class LAMMPS *);
void compute(int, int);
void settings(int, char **);
void coeff(int, char **);
void init_list(int, class NeighList *);
void init_style();
void ev_setup(int eflag, int vflag);
protected:
class Cuda *cuda;
void allocate();
bool allocated2;
class CudaNeighList* cuda_neigh_list;
double** cg_type_double;
};
}
#endif
#endif

View File

@ -1,199 +0,0 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
Original Version:
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
See the README file in the top-level LAMMPS directory.
-----------------------------------------------------------------------
USER-CUDA Package and associated modifications:
https://sourceforge.net/projects/lammpscuda/
Christian Trott, christian.trott@tu-ilmenau.de
Lars Winterfeld, lars.winterfeld@tu-ilmenau.de
Theoretical Physics II, University of Technology Ilmenau, Germany
See the README file in the USER-CUDA directory.
This software is distributed under the GNU General Public License.
------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
Contributing author: Paul Crozier (SNL)
------------------------------------------------------------------------- */
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "pair_cg_cmm_coul_debye_cuda.h"
#include "pair_cg_cmm_coul_debye_cuda_cu.h"
#include "cuda_data.h"
#include "atom.h"
#include "comm.h"
#include "force.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "cuda_neigh_list.h"
#include "update.h"
#include "integrate.h"
#include "respa.h"
#include "memory.h"
#include "error.h"
#include "cuda.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
PairCGCMMCoulDebyeCuda::PairCGCMMCoulDebyeCuda(LAMMPS *lmp) : PairCGCMMCoulCut(lmp)
{
cuda = lmp->cuda;
if(cuda == NULL)
error->all(FLERR,"You cannot use a /cuda class, without activating 'cuda' acceleration. Provide '-c on' as command-line argument to LAMMPS..");
allocated2 = false;
cg_type_double = NULL;
cuda->shared_data.pair.cudable_force = 1;
cuda->setSystemParams();
}
/* ----------------------------------------------------------------------
remember pointer to arrays in cuda shared data
------------------------------------------------------------------------- */
void PairCGCMMCoulDebyeCuda::allocate()
{
if(! allocated) PairCGCMMCoulCut::allocate();
int n = atom->ntypes;
if(! allocated2)
{
allocated2 = true;
memory->create(cg_type_double,n+1,n+1,"paircg:cgtypedouble");
cuda->shared_data.pair.cut = cut_lj;
cuda->shared_data.pair.cut_coul= cut_coul;
cuda->shared_data.pair.coeff1 = lj1;
cuda->shared_data.pair.coeff2 = lj2;
cuda->shared_data.pair.coeff3 = lj3;
cuda->shared_data.pair.coeff4 = lj4;
cuda->shared_data.pair.coeff5 = cg_type_double;
cuda->shared_data.pair.offset = offset;
cuda->shared_data.pair.special_lj = force->special_lj;
cuda->shared_data.pair.special_coul = force->special_coul;
}
for (int i = 1; i <= n; i++) {
for (int j = i; j <= n; j++) {
cg_type_double[i][j] = cg_type[i][j];
cg_type_double[j][i] = cg_type[i][j];
}
}
}
/* ---------------------------------------------------------------------- */
void PairCGCMMCoulDebyeCuda::compute(int eflag, int vflag)
{
if (eflag || vflag) ev_setup(eflag,vflag);
if(eflag) cuda->cu_eng_vdwl->upload();
if(eflag) cuda->cu_eng_coul->upload();
if(vflag) cuda->cu_virial->upload();
Cuda_PairCGCMMCoulDebyeCuda(& cuda->shared_data, & cuda_neigh_list->sneighlist, eflag, vflag, eflag_atom, vflag_atom);
if(not cuda->shared_data.pair.collect_forces_later)
{
if(eflag) cuda->cu_eng_vdwl->download();
if(eflag) cuda->cu_eng_coul->download();
if(vflag) cuda->cu_virial->download();
}
}
/* ---------------------------------------------------------------------- */
void PairCGCMMCoulDebyeCuda::settings(int narg, char **arg)
{
PairCGCMMCoulCut::settings(narg, arg);
cuda->shared_data.pair.cut_global = (F_FLOAT) cut_lj_global;
cuda->shared_data.pair.cut_coul_global = (F_FLOAT) cut_coul_global;
cuda->shared_data.pair.kappa = (F_FLOAT) kappa;
}
/* ---------------------------------------------------------------------- */
void PairCGCMMCoulDebyeCuda::coeff(int narg, char **arg)
{
PairCGCMMCoulCut::coeff(narg, arg);
allocate();
}
void PairCGCMMCoulDebyeCuda::init_style()
{
MYDBG(printf("# CUDA PairCGCMMCoulDebyeCuda::init_style start\n"); )
// request regular or rRESPA neighbor lists
int irequest;
if (update->whichflag == 0 && strstr(update->integrate_style,"respa")) {
}
else
{
irequest = neighbor->request(this);
neighbor->requests[irequest]->full = 1;
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->cudable = 1;
//neighbor->style=0; //0=NSQ neighboring
}
cuda->shared_data.pppm.qqrd2e=force->qqrd2e;
cut_respa=NULL;
if (force->newton) error->warning(FLERR,"Pair style uses does not use \"newton\" setting. You might test if \"newton off\" makes the simulation run faster.");
MYDBG(printf("# CUDA PairCGCMMCoulDebyeCuda::init_style end\n"); )
}
void PairCGCMMCoulDebyeCuda::init_list(int id, NeighList *ptr)
{
MYDBG(printf("# CUDA PairCGCMMCoulDebyeCuda::init_list\n");)
PairCGCMMCoulCut::init_list(id, ptr);
#ifndef CUDA_USE_BINNING
// right now we can only handle verlet (id 0), not respa
if(id == 0) cuda_neigh_list = cuda->registerNeighborList(ptr);
// see Neighbor::init() for details on lammps lists' logic
#endif
MYDBG(printf("# CUDA PairCGCMMCoulDebyeCuda::init_list end\n");)
}
void PairCGCMMCoulDebyeCuda::ev_setup(int eflag, int vflag)
{
int maxeatomold=maxeatom;
PairCGCMMCoulCut::ev_setup(eflag,vflag);
if (eflag_atom && atom->nmax > maxeatomold)
{delete cuda->cu_eatom; cuda->cu_eatom = new cCudaData<double, ENERGY_FLOAT, x > ((double*)eatom, & cuda->shared_data.atom.eatom , atom->nmax );}
if (vflag_atom && atom->nmax > maxeatomold)
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
}

View File

@ -1,58 +0,0 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
Original Version:
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
See the README file in the top-level LAMMPS directory.
-----------------------------------------------------------------------
USER-CUDA Package and associated modifications:
https://sourceforge.net/projects/lammpscuda/
Christian Trott, christian.trott@tu-ilmenau.de
Lars Winterfeld, lars.winterfeld@tu-ilmenau.de
Theoretical Physics II, University of Technology Ilmenau, Germany
See the README file in the USER-CUDA directory.
This software is distributed under the GNU General Public License.
------------------------------------------------------------------------- */
#ifdef PAIR_CLASS
PairStyle(cg/cmm/coul/debye/cuda,PairCGCMMCoulDebyeCuda)
#else
#ifndef PAIR_CG_CMM_COUL_DEBYE_CUDA_H
#define PAIR_CG_CMM_COUL_DEBYE_CUDA_H
#include "pair_cg_cmm_coul_cut.h"
namespace LAMMPS_NS {
class PairCGCMMCoulDebyeCuda : public PairCGCMMCoulCut
{
public:
PairCGCMMCoulDebyeCuda(class LAMMPS *);
void compute(int, int);
void settings(int, char **);
void coeff(int, char **);
void init_list(int, class NeighList *);
void init_style();
void ev_setup(int eflag, int vflag);
protected:
class Cuda *cuda;
void allocate();
bool allocated2;
class CudaNeighList* cuda_neigh_list;
double** cg_type_double;
};
}
#endif
#endif

View File

@ -1,201 +0,0 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
Original Version:
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
See the README file in the top-level LAMMPS directory.
-----------------------------------------------------------------------
USER-CUDA Package and associated modifications:
https://sourceforge.net/projects/lammpscuda/
Christian Trott, christian.trott@tu-ilmenau.de
Lars Winterfeld, lars.winterfeld@tu-ilmenau.de
Theoretical Physics II, University of Technology Ilmenau, Germany
See the README file in the USER-CUDA directory.
This software is distributed under the GNU General Public License.
------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
Contributing author: Paul Crozier (SNL)
------------------------------------------------------------------------- */
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "pair_cg_cmm_coul_long_cuda.h"
#include "pair_cg_cmm_coul_long_cuda_cu.h"
#include "cuda_data.h"
#include "atom.h"
#include "comm.h"
#include "force.h"
#include "kspace.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "cuda_neigh_list.h"
#include "update.h"
#include "integrate.h"
#include "respa.h"
#include "memory.h"
#include "error.h"
#include "cuda.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
PairCGCMMCoulLongCuda::PairCGCMMCoulLongCuda(LAMMPS *lmp) : PairCGCMMCoulLong(lmp)
{
cuda = lmp->cuda;
if(cuda == NULL)
error->all(FLERR,"You cannot use a /cuda class, without activating 'cuda' acceleration. Provide '-c on' as command-line argument to LAMMPS..");
allocated2 = false;
cg_type_double = NULL;
cuda->shared_data.pair.cudable_force = 1;
cuda->setSystemParams();
}
/* ----------------------------------------------------------------------
remember pointer to arrays in cuda shared data
------------------------------------------------------------------------- */
void PairCGCMMCoulLongCuda::allocate()
{
if(! allocated) PairCGCMMCoulLong::allocate();
int n = atom->ntypes;
if(! allocated2)
{
allocated2 = true;
memory->create(cg_type_double,n+1,n+1,"paircg:cgtypedouble");
cuda->shared_data.pair.cut = cut_lj;
cuda->shared_data.pair.cut_coul= cut_coul;
cuda->shared_data.pair.coeff1 = lj1;
cuda->shared_data.pair.coeff2 = lj2;
cuda->shared_data.pair.coeff3 = lj3;
cuda->shared_data.pair.coeff4 = lj4;
cuda->shared_data.pair.coeff5 = cg_type_double;
cuda->shared_data.pair.offset = offset;
cuda->shared_data.pair.special_lj = force->special_lj;
cuda->shared_data.pair.special_coul = force->special_coul;
}
for (int i = 1; i <= n; i++) {
for (int j = i; j <= n; j++) {
cg_type_double[i][j] = cg_type[i][j];
cg_type_double[j][i] = cg_type[i][j];
}
}
}
/* ---------------------------------------------------------------------- */
void PairCGCMMCoulLongCuda::compute(int eflag, int vflag)
{
if (eflag || vflag) ev_setup(eflag,vflag);
if(eflag) cuda->cu_eng_vdwl->upload();
if(eflag) cuda->cu_eng_coul->upload();
if(vflag) cuda->cu_virial->upload();
Cuda_PairCGCMMCoulLongCuda(& cuda->shared_data, & cuda_neigh_list->sneighlist, eflag, vflag, eflag_atom, vflag_atom);
if(not cuda->shared_data.pair.collect_forces_later)
{
if(eflag) cuda->cu_eng_vdwl->download();
if(eflag) cuda->cu_eng_coul->download();
if(vflag) cuda->cu_virial->download();
}
}
/* ---------------------------------------------------------------------- */
void PairCGCMMCoulLongCuda::settings(int narg, char **arg)
{
PairCGCMMCoulLong::settings(narg, arg);
cuda->shared_data.pair.cut_global = (F_FLOAT) cut_lj_global;
cuda->shared_data.pair.cut_coul_global = (F_FLOAT) cut_coul_global;
cuda->shared_data.pair.kappa = (F_FLOAT) kappa;
}
/* ---------------------------------------------------------------------- */
void PairCGCMMCoulLongCuda::coeff(int narg, char **arg)
{
PairCGCMMCoulLong::coeff(narg, arg);
allocate();
}
void PairCGCMMCoulLongCuda::init_style()
{
MYDBG(printf("# CUDA PairCGCMMCoulLongCuda::init_style start\n"); )
// request regular or rRESPA neighbor lists
int irequest;
if (update->whichflag == 0 && strstr(update->integrate_style,"respa")) {
}
else
{
irequest = neighbor->request(this);
neighbor->requests[irequest]->full = 1;
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->cudable = 1;
//neighbor->style=0; //0=NSQ neighboring
}
g_ewald = force->kspace->g_ewald;
cuda->shared_data.pair.g_ewald=g_ewald;
cuda->shared_data.pppm.qqrd2e=force->qqrd2e;
cut_respa=NULL;
if (force->newton) error->warning(FLERR,"Pair style uses does not use \"newton\" setting. You might test if \"newton off\" makes the simulation run faster.");
MYDBG(printf("# CUDA PairCGCMMCoulLongCuda::init_style end\n"); )
}
void PairCGCMMCoulLongCuda::init_list(int id, NeighList *ptr)
{
MYDBG(printf("# CUDA PairCGCMMCoulLongCuda::init_list\n");)
PairCGCMMCoulLong::init_list(id, ptr);
#ifndef CUDA_USE_BINNING
// right now we can only handle verlet (id 0), not respa
if(id == 0) cuda_neigh_list = cuda->registerNeighborList(ptr);
// see Neighbor::init() for details on lammps lists' logic
#endif
MYDBG(printf("# CUDA PairCGCMMCoulLongCuda::init_list end\n");)
}
void PairCGCMMCoulLongCuda::ev_setup(int eflag, int vflag)
{
int maxeatomold=maxeatom;
PairCGCMMCoulLong::ev_setup(eflag,vflag);
if (eflag_atom && atom->nmax > maxeatomold)
{delete cuda->cu_eatom; cuda->cu_eatom = new cCudaData<double, ENERGY_FLOAT, x > ((double*)eatom, & cuda->shared_data.atom.eatom , atom->nmax );}
if (vflag_atom && atom->nmax > maxeatomold)
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
}

View File

@ -1,58 +0,0 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
Original Version:
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
See the README file in the top-level LAMMPS directory.
-----------------------------------------------------------------------
USER-CUDA Package and associated modifications:
https://sourceforge.net/projects/lammpscuda/
Christian Trott, christian.trott@tu-ilmenau.de
Lars Winterfeld, lars.winterfeld@tu-ilmenau.de
Theoretical Physics II, University of Technology Ilmenau, Germany
See the README file in the USER-CUDA directory.
This software is distributed under the GNU General Public License.
------------------------------------------------------------------------- */
#ifdef PAIR_CLASS
PairStyle(cg/cmm/coul/long/cuda,PairCGCMMCoulLongCuda)
#else
#ifndef PAIR_CG_CMM_COUL_LONG_CUDA_H
#define PAIR_CG_CMM_COUL_LONG_CUDA_H
#include "pair_cg_cmm_coul_long.h"
namespace LAMMPS_NS {
class PairCGCMMCoulLongCuda : public PairCGCMMCoulLong
{
public:
PairCGCMMCoulLongCuda(class LAMMPS *);
void compute(int, int);
void settings(int, char **);
void coeff(int, char **);
void init_list(int, class NeighList *);
void init_style();
void ev_setup(int eflag, int vflag);
protected:
class Cuda *cuda;
void allocate();
bool allocated2;
class CudaNeighList* cuda_neigh_list;
double** cg_type_double;
};
}
#endif
#endif

View File

@ -1,196 +0,0 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
Original Version:
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
See the README file in the top-level LAMMPS directory.
-----------------------------------------------------------------------
USER-CUDA Package and associated modifications:
https://sourceforge.net/projects/lammpscuda/
Christian Trott, christian.trott@tu-ilmenau.de
Lars Winterfeld, lars.winterfeld@tu-ilmenau.de
Theoretical Physics II, University of Technology Ilmenau, Germany
See the README file in the USER-CUDA directory.
This software is distributed under the GNU General Public License.
------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
Contributing author: Paul Crozier (SNL)
------------------------------------------------------------------------- */
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "pair_cg_cmm_cuda.h"
#include "pair_cg_cmm_cuda_cu.h"
#include "cuda_data.h"
#include "atom.h"
#include "comm.h"
#include "force.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "cuda_neigh_list.h"
#include "update.h"
#include "integrate.h"
#include "respa.h"
#include "memory.h"
#include "error.h"
#include "cuda.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
PairCGCMMCuda::PairCGCMMCuda(LAMMPS *lmp) : PairCGCMM(lmp)
{
cuda = lmp->cuda;
if(cuda == NULL)
error->all(FLERR,"You cannot use a /cuda class, without activating 'cuda' acceleration. Provide '-c on' as command-line argument to LAMMPS..");
allocated2 = false;
cg_type_double = NULL;
cuda->shared_data.pair.cudable_force = 1;
cuda->setSystemParams();
}
/* ----------------------------------------------------------------------
remember pointer to arrays in cuda shared data
------------------------------------------------------------------------- */
void PairCGCMMCuda::allocate()
{
if(! allocated) PairCGCMM::allocate();
int n = atom->ntypes;
if(! allocated2)
{
allocated2 = true;
memory->create(cg_type_double,n+1,n+1,"paircg:cgtypedouble");
cuda->shared_data.pair.cut = cut;
cuda->shared_data.pair.coeff1 = lj1;
cuda->shared_data.pair.coeff2 = lj2;
cuda->shared_data.pair.coeff3 = lj3;
cuda->shared_data.pair.coeff4 = lj4;
cuda->shared_data.pair.coeff5 = cg_type_double;
/*cu_lj1_gm = new cCudaData<double, F_FLOAT, x> ((double*)lj1, &cuda->shared_data.pair.coeff1_gm, (atom->ntypes+1)*(atom->ntypes+1));
cu_lj2_gm = new cCudaData<double, F_FLOAT, x> ((double*)lj2, &cuda->shared_data.pair.coeff2_gm, (atom->ntypes+1)*(atom->ntypes+1));
cu_lj3_gm = new cCudaData<double, F_FLOAT, x> ((double*)lj3, &cuda->shared_data.pair.coeff3_gm, (atom->ntypes+1)*(atom->ntypes+1));
cu_lj4_gm = new cCudaData<double, F_FLOAT, x> ((double*)lj4, &cuda->shared_data.pair.coeff4_gm, (atom->ntypes+1)*(atom->ntypes+1));
cu_cg_type_double_gm = new cCudaData<double, F_FLOAT, x> ((double*)cg_type_double, &cuda->shared_data.pair.coeff5_gm, (atom->ntypes+1)*(atom->ntypes+1));*/
cuda->shared_data.pair.offset = offset;
cuda->shared_data.pair.special_lj = force->special_lj;
}
for (int i = 1; i <= n; i++) {
for (int j = i; j <= n; j++) {
cg_type_double[i][j] = cg_type[i][j];
cg_type_double[j][i] = cg_type[i][j];
}
}
}
/* ---------------------------------------------------------------------- */
void PairCGCMMCuda::compute(int eflag, int vflag)
{
if (eflag || vflag) ev_setup(eflag,vflag);
if(eflag) cuda->cu_eng_vdwl->upload();
if(vflag) cuda->cu_virial->upload();
Cuda_PairCGCMMCuda(& cuda->shared_data, & cuda_neigh_list->sneighlist, eflag, vflag, eflag_atom, vflag_atom);
if(not cuda->shared_data.pair.collect_forces_later)
{
if(eflag) cuda->cu_eng_vdwl->download();
if(vflag) cuda->cu_virial->download();
}
}
/* ---------------------------------------------------------------------- */
void PairCGCMMCuda::settings(int narg, char **arg)
{
PairCGCMM::settings(narg, arg);
cuda->shared_data.pair.cut_global = (F_FLOAT) cut_lj_global;
}
/* ---------------------------------------------------------------------- */
void PairCGCMMCuda::coeff(int narg, char **arg)
{
PairCGCMM::coeff(narg, arg);
allocate();
}
void PairCGCMMCuda::init_style()
{
MYDBG(printf("# CUDA PairCGCMMCuda::init_style start\n"); )
// request regular or rRESPA neighbor lists
int irequest;
if (update->whichflag == 0 && strstr(update->integrate_style,"respa")) {
}
else
{
irequest = neighbor->request(this);
neighbor->requests[irequest]->full = 1;
neighbor->requests[irequest]->half = 0;
neighbor->requests[irequest]->cudable = 1;
//neighbor->style=0; //0=NSQ neighboring
}
cut_respa=NULL;
MYDBG(printf("# CUDA PairCGCMMCuda::init_style end\n"); )
}
void PairCGCMMCuda::init_list(int id, NeighList *ptr)
{
MYDBG(printf("# CUDA PairCGCMMCuda::init_list\n");)
PairCGCMM::init_list(id, ptr);
#ifndef CUDA_USE_BINNING
// right now we can only handle verlet (id 0), not respa
if(id == 0) cuda_neigh_list = cuda->registerNeighborList(ptr);
// see Neighbor::init() for details on lammps lists' logic
#endif
MYDBG(printf("# CUDA PairCGCMMCuda::init_list end\n");)
}
void PairCGCMMCuda::ev_setup(int eflag, int vflag)
{
int maxeatomold=maxeatom;
PairCGCMM::ev_setup(eflag,vflag);
if (eflag_atom && atom->nmax > maxeatomold)
{delete cuda->cu_eatom; cuda->cu_eatom = new cCudaData<double, ENERGY_FLOAT, x > ((double*)eatom, & cuda->shared_data.atom.eatom , atom->nmax );}
if (vflag_atom && atom->nmax > maxeatomold)
{delete cuda->cu_vatom; cuda->cu_vatom = new cCudaData<double, ENERGY_FLOAT, yx > ((double*)vatom, & cuda->shared_data.atom.vatom , atom->nmax, 6 );}
}

View File

@ -1,64 +0,0 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
Original Version:
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
See the README file in the top-level LAMMPS directory.
-----------------------------------------------------------------------
USER-CUDA Package and associated modifications:
https://sourceforge.net/projects/lammpscuda/
Christian Trott, christian.trott@tu-ilmenau.de
Lars Winterfeld, lars.winterfeld@tu-ilmenau.de
Theoretical Physics II, University of Technology Ilmenau, Germany
See the README file in the USER-CUDA directory.
This software is distributed under the GNU General Public License.
------------------------------------------------------------------------- */
#ifdef PAIR_CLASS
PairStyle(cg/cmm/cuda,PairCGCMMCuda)
#else
#ifndef PAIR_CG_CMM_CUDA_H
#define PAIR_CG_CMM_CUDA_H
#include "pair_cg_cmm.h"
#include "cuda_data.h"
namespace LAMMPS_NS {
class PairCGCMMCuda : public PairCGCMM
{
public:
PairCGCMMCuda(class LAMMPS *);
void compute(int, int);
void settings(int, char **);
void coeff(int, char **);
void init_list(int, class NeighList *);
void init_style();
void ev_setup(int eflag, int vflag);
protected:
class Cuda *cuda;
void allocate();
bool allocated2;
class CudaNeighList* cuda_neigh_list;
double** cg_type_double;
cCudaData<double , F_FLOAT , x >* cu_lj1_gm;
cCudaData<double , F_FLOAT , x >* cu_lj2_gm;
cCudaData<double , F_FLOAT , x >* cu_lj3_gm;
cCudaData<double , F_FLOAT , x >* cu_lj4_gm;
cCudaData<double , F_FLOAT , x >* cu_cg_type_double_gm;
};
}
#endif
#endif