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

This commit is contained in:
sjplimp
2011-08-17 14:30:14 +00:00
parent ba299cf0eb
commit ccfaead990

View File

@ -43,10 +43,10 @@ extern double lmp_gpu_forces(double **f, double **tor, double *eatom,
FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) : FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg) Fix(lmp, narg, arg)
{ {
if (lmp->cuda) error->all("Cannot use fix gpu with USER-CUDA mode enabled"); if (lmp->cuda) error->all("Cannot use fix GPU with USER-CUDA mode enabled");
if (narg < 7) error->all("Illegal fix gpu command"); if (narg < 7) error->all("Illegal fix GPU command");
if (strcmp(arg[1],"all") != 0) error->all("Illegal fix gpu command"); if (strcmp(arg[1],"all") != 0) error->all("Illegal fix GPU command");
int first_gpu, last_gpu; int first_gpu, last_gpu;
@ -55,16 +55,16 @@ FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) :
else if (strcmp(arg[3],"force/neigh") == 0) { else if (strcmp(arg[3],"force/neigh") == 0) {
_gpu_mode = GPU_NEIGH; _gpu_mode = GPU_NEIGH;
if (domain->triclinic) if (domain->triclinic)
error->all("Cannot use force/neigh with triclinic box."); error->all("Cannot use force/neigh with triclinic box");
} else } else
error->all("Illegal fix gpu command."); error->all("Illegal fix GPU command");
first_gpu = atoi(arg[4]); first_gpu = atoi(arg[4]);
last_gpu = atoi(arg[5]); last_gpu = atoi(arg[5]);
_particle_split = force->numeric(arg[6]); _particle_split = force->numeric(arg[6]);
if (_particle_split==0 || _particle_split>1) if (_particle_split==0 || _particle_split>1)
error->all("Illegal fix gpu command."); error->all("Illegal fix GPU command");
int nthreads = 1; int nthreads = 1;
int threads_per_atom = -1; int threads_per_atom = -1;
@ -74,16 +74,16 @@ FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) :
else if (strcmp(arg[7],"nthreads") == 0) else if (strcmp(arg[7],"nthreads") == 0)
nthreads = atoi(arg[8]); nthreads = atoi(arg[8]);
else else
error->all("Illegal fix gpu command."); error->all("Illegal fix GPU command");
} else if (narg != 7) } else if (narg != 7)
error->all("Illegal fix gpu command."); error->all("Illegal fix GPU command");
if (nthreads < 1) if (nthreads < 1)
error->all("Illegal fix gpu command."); error->all("Illegal fix GPU command");
#ifndef _OPENMP #ifndef _OPENMP
if (nthreads > 1) if (nthreads > 1)
error->all("No OpenMP support compiled in."); error->all("No OpenMP support compiled in");
#endif #endif
int gpu_flag = lmp_init_device(universe->uworld, world, first_gpu, last_gpu, int gpu_flag = lmp_init_device(universe->uworld, world, first_gpu, last_gpu,
@ -115,16 +115,16 @@ void FixGPU::init()
{ {
// Can only have 1 gpu fix that must be the first fix for a run // Can only have 1 gpu fix that must be the first fix for a run
if ((void*)modify->fix[0] != (void*)this) if ((void*)modify->fix[0] != (void*)this)
error->all("GPU is not the first fix for this run."); error->all("GPU is not the first fix for this run");
// Hybrid cannot be used with force/neigh option // Hybrid cannot be used with force/neigh option
if (_gpu_mode == GPU_NEIGH) if (_gpu_mode == GPU_NEIGH)
if (force->pair_match("hybrid",1) != NULL || if (force->pair_match("hybrid",1) != NULL ||
force->pair_match("hybrid/overlay",1) != NULL) force->pair_match("hybrid/overlay",1) != NULL)
error->all("Cannot use pair hybrid with GPU neighbor builds."); error->all("Cannot use pair hybrid with GPU neighbor builds");
if (_particle_split < 0) if (_particle_split < 0)
if (force->pair_match("hybrid",1) != NULL || if (force->pair_match("hybrid",1) != NULL ||
force->pair_match("hybrid/overlay",1) != NULL) force->pair_match("hybrid/overlay",1) != NULL)
error->all("Fix gpu split must be positive for hybrid pair styles."); error->all("Fix GPU split must be positive for hybrid pair styles");
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -179,4 +179,3 @@ double FixGPU::memory_usage()
// Memory usage currently returned by pair routine // Memory usage currently returned by pair routine
return bytes; return bytes;
} }