diff --git a/src/USER-OMP/Install.sh b/src/USER-OMP/Install.sh index ec6fac4b92..503fc66c3e 100644 --- a/src/USER-OMP/Install.sh +++ b/src/USER-OMP/Install.sh @@ -22,11 +22,27 @@ done if (test $1 = 1) then + if (test -e ../Makefile.package) then + sed -i -e 's|^PKG_INC =[ \t]*|&-DLMP_USER_OMP |' ../Makefile.package + fi + + # force rebuild of files with LMP_USER_OMP switch + + touch ../accelerator_omp.h + cp thr_data.h .. cp thr_data.cpp .. elif (test $1 = 0) then + if (test -e ../Makefile.package) then + sed -i -e 's/[^ \t]*OMP[^ \t]* //g' ../Makefile.package + fi + + # force rebuild of files with LMP_USER_OMP switch + + touch ../accelerator_omp.h + rm -f ../thr_data.h rm -f ../thr_data.cpp diff --git a/src/accelerator_omp.h b/src/accelerator_omp.h new file mode 100644 index 0000000000..5ad4277b93 --- /dev/null +++ b/src/accelerator_omp.h @@ -0,0 +1,92 @@ +/* ---------------------------------------------------------------------- + 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. +------------------------------------------------------------------------- */ + +#ifndef LMP_ACCELERATOR_OMP_H +#define LMP_ACCELERATOR_OMP_H + +// true interface to USER-OMP, used in Neighbor class header file +// used when USER-OMP is installed + +#ifdef LMP_USER_OMP + + void half_nsq_no_newton_omp(class NeighList *); + void half_nsq_newton_omp(class NeighList *); + + void half_bin_no_newton_omp(class NeighList *); + void half_bin_newton_omp(class NeighList *); + void half_bin_newton_tri_omp(class NeighList *); + + void half_multi_no_newton_omp(class NeighList *); + void half_multi_newton_omp(class NeighList *); + void half_multi_newton_tri_omp(class NeighList *); + + void full_nsq_omp(class NeighList *); + void full_nsq_ghost_omp(class NeighList *); + void full_bin_omp(class NeighList *); + void full_bin_ghost_omp(class NeighList *); + void full_multi_omp(class NeighList *); + + void half_from_full_no_newton_omp(class NeighList *); + void half_from_full_newton_omp(class NeighList *); + + void granular_nsq_no_newton_omp(class NeighList *); + void granular_nsq_newton_omp(class NeighList *); + void granular_bin_no_newton_omp(class NeighList *); + void granular_bin_newton_omp(class NeighList *); + void granular_bin_newton_tri_omp(class NeighList *); + + void respa_nsq_no_newton_omp(class NeighList *); + void respa_nsq_newton_omp(class NeighList *); + void respa_bin_no_newton_omp(class NeighList *); + void respa_bin_newton_omp(class NeighList *); + void respa_bin_newton_tri_omp(class NeighList *); + +#else + +// dummy interface to USER-OMP +// needed for compiling Neighbor class when USER-OMP is not installed + + void half_nsq_no_newton_omp(class NeighList *) {} + void half_nsq_newton_omp(class NeighList *) {} + + void half_bin_no_newton_omp(class NeighList *) {} + void half_bin_newton_omp(class NeighList *) {} + void half_bin_newton_tri_omp(class NeighList *) {} + + void half_multi_no_newton_omp(class NeighList *) {} + void half_multi_newton_omp(class NeighList *) {} + void half_multi_newton_tri_omp(class NeighList *) {} + + void full_nsq_omp(class NeighList *) {} + void full_nsq_ghost_omp(class NeighList *) {} + void full_bin_omp(class NeighList *) {} + void full_bin_ghost_omp(class NeighList *) {} + void full_multi_omp(class NeighList *) {} + + void half_from_full_no_newton_omp(class NeighList *) {} + void half_from_full_newton_omp(class NeighList *) {} + + void granular_nsq_no_newton_omp(class NeighList *) {} + void granular_nsq_newton_omp(class NeighList *) {} + void granular_bin_no_newton_omp(class NeighList *) {} + void granular_bin_newton_omp(class NeighList *) {} + void granular_bin_newton_tri_omp(class NeighList *) {} + + void respa_nsq_no_newton_omp(class NeighList *) {} + void respa_nsq_newton_omp(class NeighList *) {} + void respa_bin_no_newton_omp(class NeighList *) {} + void respa_bin_newton_omp(class NeighList *) {} + void respa_bin_newton_tri_omp(class NeighList *) {} + +#endif +#endif diff --git a/src/neighbor.cpp b/src/neighbor.cpp index feadb5a533..a918249f96 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -856,16 +856,19 @@ void Neighbor::choose_build(int index, NeighRequest *rq) if (style == NSQ) { if (rq->ghost == 0) pb = &Neighbor::full_nsq; else if (includegroup) - error->all(FLERR,"Neighbor include group not allowed with ghost neighbors"); + error->all(FLERR, + "Neighbor include group not allowed with ghost neighbors"); else if (rq->ghost == 1) pb = &Neighbor::full_nsq_ghost; } else if (style == BIN) { if (rq->ghost == 0) pb = &Neighbor::full_bin; else if (includegroup) - error->all(FLERR,"Neighbor include group not allowed with ghost neighbors"); + error->all(FLERR, + "Neighbor include group not allowed with ghost neighbors"); else if (rq->ghost == 1) pb = &Neighbor::full_bin_ghost; } else if (style == MULTI) { if (rq->ghost == 0) pb = &Neighbor::full_multi; - else error->all(FLERR,"Neighbor multi not yet enabled for ghost neighbors"); + else error->all(FLERR, + "Neighbor multi not yet enabled for ghost neighbors"); } } else if (rq->gran) { @@ -938,16 +941,19 @@ void Neighbor::choose_build(int index, NeighRequest *rq) if (style == NSQ) { if (rq->ghost == 0) pb = &Neighbor::full_nsq_omp; else if (includegroup) - error->all(FLERR,"Neighbor include group not allowed with ghost neighbors"); + error->all(FLERR, + "Neighbor include group not allowed with ghost neighbors"); else if (rq->ghost == 1) pb = &Neighbor::full_nsq_ghost_omp; } else if (style == BIN) { if (rq->ghost == 0) pb = &Neighbor::full_bin_omp; else if (includegroup) - error->all(FLERR,"Neighbor include group not allowed with ghost neighbors"); + error->all(FLERR, + "Neighbor include group not allowed with ghost neighbors"); else if (rq->ghost == 1) pb = &Neighbor::full_bin_ghost_omp; } else if (style == MULTI) { if (rq->ghost == 0) pb = &Neighbor::full_multi_omp; - else error->all(FLERR,"Neighbor multi not yet enabled for ghost neighbors"); + else error->all(FLERR, + "Neighbor multi not yet enabled for ghost neighbors"); } } else if (rq->gran) { @@ -977,7 +983,8 @@ void Neighbor::choose_build(int index, NeighRequest *rq) // general error check if (rq->ghost && !rq->full) - error->all(FLERR,"Neighbors of ghost atoms only allowed for full neighbor lists"); + error->all(FLERR, + "Neighbors of ghost atoms only allowed for full neighbor lists"); pair_build[index] = pb; } diff --git a/src/neighbor.h b/src/neighbor.h index a2f8e6b8b3..898298682a 100644 --- a/src/neighbor.h +++ b/src/neighbor.h @@ -165,7 +165,9 @@ class Neighbor : protected Pointers { int coord2bin(double *); // mapping atom coord to a bin int coord2bin(double *, int &, int &, int&); // ditto - int exclusion(int, int, int, int, int *, int *) const; // test for pair exclusion + int exclusion(int, int, int, + int, int *, int *) const; // test for pair exclusion + virtual void choose_build(int, class NeighRequest *); void choose_stencil(int, class NeighRequest *); @@ -212,37 +214,7 @@ class Neighbor : protected Pointers { // OpenMP multi-threaded neighbor list build versions - void half_nsq_no_newton_omp(class NeighList *); - void half_nsq_newton_omp(class NeighList *); - - void half_bin_no_newton_omp(class NeighList *); - void half_bin_newton_omp(class NeighList *); - void half_bin_newton_tri_omp(class NeighList *); - - void half_multi_no_newton_omp(class NeighList *); - void half_multi_newton_omp(class NeighList *); - void half_multi_newton_tri_omp(class NeighList *); - - void full_nsq_omp(class NeighList *); - void full_nsq_ghost_omp(class NeighList *); - void full_bin_omp(class NeighList *); - void full_bin_ghost_omp(class NeighList *); - void full_multi_omp(class NeighList *); - - void half_from_full_no_newton_omp(class NeighList *); - void half_from_full_newton_omp(class NeighList *); - - void granular_nsq_no_newton_omp(class NeighList *); - void granular_nsq_newton_omp(class NeighList *); - void granular_bin_no_newton_omp(class NeighList *); - void granular_bin_newton_omp(class NeighList *); - void granular_bin_newton_tri_omp(class NeighList *); - - void respa_nsq_no_newton_omp(class NeighList *); - void respa_nsq_newton_omp(class NeighList *); - void respa_bin_no_newton_omp(class NeighList *); - void respa_bin_newton_omp(class NeighList *); - void respa_bin_newton_tri_omp(class NeighList *); +#include "accelerator_omp.h" // pairwise stencil creation functions diff --git a/src/verlet.h b/src/verlet.h index 327f72b833..c11d05ed18 100644 --- a/src/verlet.h +++ b/src/verlet.h @@ -29,9 +29,9 @@ class Verlet : public Integrate { Verlet(class LAMMPS *, int, char **); virtual ~Verlet() {} void init(); - void setup(); - void setup_minimal(int); - void run(int); + virtual void setup(); + virtual void setup_minimal(int); + virtual void run(int); void cleanup(); protected: