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

This commit is contained in:
sjplimp 2013-07-26 14:59:50 +00:00
parent 149d43f84c
commit 6fc75ee1da
2 changed files with 42 additions and 3 deletions

View File

@ -22,6 +22,7 @@
#include "error.h"
#include "timer.h"
#include "modify.h"
#include "update.h"
#include "domain.h"
#include "universe.h"
#include "gpu_extra.h"
@ -123,6 +124,7 @@ int FixGPU::setmask()
int mask = 0;
mask |= POST_FORCE;
mask |= MIN_POST_FORCE;
mask |= POST_FORCE_RESPA;
return mask;
}
@ -135,11 +137,27 @@ void FixGPU::init()
if (_gpu_mode == GPU_NEIGH || _gpu_mode == GPU_HYB_NEIGH)
if (force->pair_match("hybrid",1) != NULL ||
force->pair_match("hybrid/overlay",1) != NULL)
error->all(FLERR,"Cannot use pair hybrid with GPU neighbor builds");
error->all(FLERR,"Cannot use pair hybrid with GPU neighbor list builds");
if (_particle_split < 0)
if (force->pair_match("hybrid",1) != NULL ||
force->pair_match("hybrid/overlay",1) != NULL)
error->all(FLERR,"Fix GPU split must be positive for hybrid pair styles");
error->all(FLERR,"GPU 'split' must be positive for hybrid pair styles");
// r-RESPA support
if (strstr(update->integrate_style,"respa")) {
_nlevels_respa = ((Respa *) update->integrate)->nlevels;
// need to check that gpu accelerated styles are at the outmost levels
if ((force->pair_match("/gpu",0) != NULL) &&
(((Respa *) update->integrate)->level_pair != _nlevels_respa-1))
error->all(FLERR,"GPU pair style must be at outermost respa level");
if ((force->kspace_match("/gpu",0) != NULL) &&
(((Respa *) update->integrate)->level_kspace != _nlevels_respa-1))
error->all(FLERR,"GPU Kspace style must be at outermost respa level");
}
}
/* ---------------------------------------------------------------------- */
@ -150,7 +168,14 @@ void FixGPU::setup(int vflag)
if (neighbor->exclude_setting()!=0)
error->all(FLERR,
"Cannot use neigh_modify exclude with GPU neighbor builds");
post_force(vflag);
if (strstr(update->integrate_style,"verlet"))
post_force(vflag);
else {
((Respa *) update->integrate)->copy_flevel_f(_nlevels_respa-1);
post_force_respa(vflag,_nlevels_respa-1,0);
((Respa *) update->integrate)->copy_f_flevel(_nlevels_respa-1);
}
}
/* ---------------------------------------------------------------------- */
@ -192,6 +217,13 @@ void FixGPU::min_post_force(int vflag)
/* ---------------------------------------------------------------------- */
void FixGPU::post_force_respa(int vflag, int ilevel, int iloop)
{
if (ilevel == _nlevels_respa-1) post_force(vflag);
}
/* ---------------------------------------------------------------------- */
double FixGPU::memory_usage()
{
double bytes = 0.0;

View File

@ -34,10 +34,12 @@ class FixGPU : public Fix {
void min_setup(int);
void post_force(int);
void min_post_force(int);
void post_force_respa(int, int, int);
double memory_usage();
private:
int _gpu_mode;
int _nlevels_respa;
double _particle_split;
};
@ -86,4 +88,9 @@ E: Cannot use neigh_modify exclude with GPU neighbor builds
This is a current limitation of the GPU implementation
in LAMMPS.
E: GPU styles must be on the outmost r-RESPA level
Self-explanatory.
*/