From 2faeae220cfc972a149045d40662dc93347a4976 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 8 Jun 2011 20:24:44 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@6341 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/GPU/Install.sh | 35 +++++++++++++++++++++++++++++++++++ src/GPU/fix_gpu.cpp | 16 +++++++++++++--- src/GPU/pair_gayberne_gpu.cpp | 18 +++++++++++------- src/GPU/pair_gayberne_gpu.h | 6 ++---- 4 files changed, 61 insertions(+), 14 deletions(-) diff --git a/src/GPU/Install.sh b/src/GPU/Install.sh index 4403b3d1c8..8f8decf7c3 100644 --- a/src/GPU/Install.sh +++ b/src/GPU/Install.sh @@ -17,6 +17,8 @@ if (test $1 = 1) then if (test -e ../pair_gayberne.cpp) then cp pair_gayberne_gpu.cpp .. cp pair_gayberne_gpu.h .. + cp pair_resquared_gpu.cpp .. + cp pair_resquared_gpu.h .. fi if (test -e ../pair_lj_cut_coul_long.cpp) then @@ -24,6 +26,16 @@ if (test $1 = 1) then cp pair_lj_cut_coul_long_gpu.h .. fi + if (test -e ../pair_lj_class2.cpp) then + cp pair_lj_class2_gpu.cpp .. + cp pair_lj_class2_gpu.h .. + fi + + if (test -e ../pair_lj_class2_coul_long.cpp) then + cp pair_lj_class2_coul_long_gpu.cpp .. + cp pair_lj_class2_coul_long_gpu.h .. + fi + if (test -e ../pair_lj_charmm_coul_long.cpp) then cp pair_lj_charmm_coul_long_gpu.cpp .. cp pair_lj_charmm_coul_long_gpu.h .. @@ -37,6 +49,10 @@ if (test $1 = 1) then if (test -e ../pair_cg_cmm_coul_long.cpp) then cp pair_cg_cmm_coul_long_gpu.cpp .. cp pair_cg_cmm_coul_long_gpu.h .. + cp pair_cg_cmm_coul_msm.cpp .. + cp pair_cg_cmm_coul_msm.h .. + cp pair_cg_cmm_coul_msm_gpu.cpp .. + cp pair_cg_cmm_coul_msm_gpu.h .. fi if (test -e ../pppm.cpp) then @@ -53,6 +69,7 @@ if (test $1 = 1) then cp pair_lj96_cut_gpu.cpp .. cp pair_lj_expand_gpu.cpp .. cp pair_lj_cut_coul_cut_gpu.cpp .. + cp pair_lj_cut_tgpu.cpp .. cp fix_gpu.cpp .. @@ -61,10 +78,14 @@ if (test $1 = 1) then cp pair_lj96_cut_gpu.h .. cp pair_lj_expand_gpu.h .. cp pair_lj_cut_coul_cut_gpu.h .. + cp pair_lj_cut_tgpu.h .. cp fix_gpu.h .. cp gpu_extra.h .. + cp pair_omp_gpu.cpp .. + cp pair_omp_gpu.h .. + elif (test $1 = 0) then if (test -e ../Makefile.package) then @@ -76,34 +97,48 @@ elif (test $1 = 0) then rm -f ../pppm_gpu_single.cpp rm -f ../pppm_gpu_double.cpp rm -f ../pair_gayberne_gpu.cpp + rm -f ../pair_resquared_gpu.cpp rm -f ../pair_lj_cut_gpu.cpp rm -f ../pair_morse_gpu.cpp rm -f ../pair_lj96_cut_gpu.cpp rm -f ../pair_lj_expand_gpu.cpp rm -f ../pair_lj_cut_coul_cut_gpu.cpp rm -f ../pair_lj_cut_coul_long_gpu.cpp + rm -f ../pair_lj_class2_gpu.cpp + rm -f ../pair_lj_class2_coul_long_gpu.cpp rm -f ../pair_lj_charmm_coul_long_gpu.cpp + rm -f ../pair_lj_cut_tgpu.cpp rm -f ../pair_cg_cmm_gpu.cpp rm -f ../pair_cg_cmm_coul_long_gpu.cpp + rm -f ../pair_cg_cmm_coul_msm.cpp + rm -f ../pair_cg_cmm_coul_msm_gpu.cpp rm -f ../fix_gpu.cpp + rm -f ../pair_omp_gpu.cpp rm -f ../pppm_gpu.h rm -f ../pppm_gpu_single.h rm -f ../pppm_gpu_double.h rm -f ../pair_gayberne_gpu.h + rm -f ../pair_resquared_gpu.h rm -f ../pair_lj_cut_gpu.h rm -f ../pair_morse_gpu.h rm -f ../pair_lj96_cut_gpu.h rm -f ../pair_lj_expand_gpu.h rm -f ../pair_lj_cut_coul_cut_gpu.h rm -f ../pair_lj_cut_coul_long_gpu.h + rm -f ../pair_lj_class2_gpu.h + rm -f ../pair_lj_class2_coul_long_gpu.h rm -f ../pair_lj_charmm_coul_long_gpu.h + rm -f ../pair_lj_cut_tgpu.cpp rm -f ../pair_cg_cmm_gpu.h rm -f ../pair_cg_cmm_coul_long_gpu.h + rm -f ../pair_cg_cmm_coul_msm.h + rm -f ../pair_cg_cmm_coul_msm_gpu.h rm -f ../fix_gpu.h rm -f ../gpu_extra.h + rm -f ../pair_omp_gpu.h fi diff --git a/src/GPU/fix_gpu.cpp b/src/GPU/fix_gpu.cpp index 26200d977f..7c08e13be7 100644 --- a/src/GPU/fix_gpu.cpp +++ b/src/GPU/fix_gpu.cpp @@ -43,10 +43,10 @@ extern double lmp_gpu_forces(double **f, double **tor, double *eatom, FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { - if (lmp->cuda) error->all("Cannot use fix gpu with USER-CUDA mode enabled"); - 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; @@ -71,11 +71,21 @@ FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) : if (narg == 9) { if (strcmp(arg[7],"threads_per_atom") == 0) threads_per_atom = atoi(arg[8]); + else if (strcmp(arg[7],"nthreads") == 0) + nthreads = atoi(arg[8]); else error->all("Illegal fix gpu command."); } else if (narg != 7) error->all("Illegal fix gpu command."); + if (nthreads < 1) + error->all("Illegal fix gpu command."); + + #ifndef _OPENMP + if (nthreads > 1) + error->all("No OpenMP support compiled in."); + #endif + int gpu_flag = lmp_init_device(universe->uworld, world, first_gpu, last_gpu, _gpu_mode, _particle_split, nthreads, threads_per_atom); diff --git a/src/GPU/pair_gayberne_gpu.cpp b/src/GPU/pair_gayberne_gpu.cpp index d9e040d40d..f418329b48 100644 --- a/src/GPU/pair_gayberne_gpu.cpp +++ b/src/GPU/pair_gayberne_gpu.cpp @@ -49,12 +49,13 @@ int gb_gpu_init(const int ntypes, const double gamma, const double upsilon, int **form, double **host_lj1, double **host_lj2, double **host_lj3, double **host_lj4, double **offset, double *special_lj, const int nlocal, const int nall, - const int max_nbors, const double cell_size, - int &gpu_mode, FILE *screen); + const int max_nbors, const int maxspecial, + const double cell_size, int &gpu_mode, FILE *screen); void gb_gpu_clear(); int ** gb_gpu_compute_n(const int ago, const int inum, const int nall, double **host_x, int *host_type, double *sublo, - double *subhi, const bool eflag, const bool vflag, + double *subhi, int *tag, int **nspecial, int **special, + const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, int **ilist, int **jnum, const double cpu_time, bool &success, double **host_quat); @@ -125,16 +126,16 @@ void PairGayBerneGPU::compute(int eflag, int vflag) inum = atom->nlocal; firstneigh = gb_gpu_compute_n(neighbor->ago, inum, nall, atom->x, atom->type, domain->sublo, domain->subhi, + atom->tag, atom->nspecial, atom->special, eflag, vflag, eflag_atom, vflag_atom, host_start, &ilist, &numneigh, cpu_time, success, quat); } else { inum = list->inum; - ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; - olist = gb_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type, - ilist, numneigh, firstneigh, eflag, vflag, + ilist = gb_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type, + list->ilist, numneigh, firstneigh, eflag, vflag, eflag_atom, vflag_atom, host_start, cpu_time, success, quat); } @@ -193,11 +194,14 @@ void PairGayBerneGPU::init_style() double cell_size = sqrt(maxcut) + neighbor->skin; + int maxspecial=0; + if (atom->molecular) + maxspecial=atom->maxspecial; int success = gb_gpu_init(atom->ntypes+1, gamma, upsilon, mu, shape2, well, cutsq, sigma, epsilon, lshape, form, lj1, lj2, lj3, lj4, offset, force->special_lj, atom->nlocal, atom->nlocal+atom->nghost, 300, - cell_size, gpu_mode, screen); + maxspecial, cell_size, gpu_mode, screen); GPU_EXTRA::check_flag(success,error,world); if (gpu_mode != GPU_NEIGH) { diff --git a/src/GPU/pair_gayberne_gpu.h b/src/GPU/pair_gayberne_gpu.h index 76d3b516a9..9d59f0d7ff 100644 --- a/src/GPU/pair_gayberne_gpu.h +++ b/src/GPU/pair_gayberne_gpu.h @@ -17,11 +17,10 @@ PairStyle(gayberne/gpu,PairGayBerneGPU) #else -#ifndef LMP_PAIR_GPU_H -#define LMP_PAIR_GPU_H +#ifndef LMP_PAIR_GAYBERNE_GPU_H +#define LMP_PAIR_GAYBERNE_GPU_H #include "pair_gayberne.h" -#define MAX_GPU_THREADS 1 namespace LAMMPS_NS { @@ -37,7 +36,6 @@ class PairGayBerneGPU : public PairGayBerne { enum { GPU_PAIR, GPU_NEIGH }; private: - int *olist; int gpu_mode; double cpu_time; int *gpulist;