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

This commit is contained in:
sjplimp
2011-12-02 18:25:42 +00:00
parent 6bfa87dcb5
commit eca63a1b69
5 changed files with 129 additions and 42 deletions

View File

@ -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

92
src/accelerator_omp.h Normal file
View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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: