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

This commit is contained in:
sjplimp
2014-09-09 22:30:16 +00:00
parent b57945c40e
commit 4374200a77
6 changed files with 73 additions and 63 deletions

View File

@ -47,8 +47,6 @@
using namespace LAMMPS_NS;
Cuda::Cuda(LAMMPS* lmp) : Pointers(lmp)
{
cuda_exists = true;

View File

@ -49,10 +49,9 @@ enum{NSQ,BIN,MULTI};
FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
{
if (narg < 4)
error->all(FLERR, "Illegal package intel command");
if (strcmp(arg[1],"all") != 0)
error->all(FLERR, "fix Intel has to operate on group 'all'");
if (narg < 4) error->all(FLERR,"Illegal package intel command");
int ncops = force->inumeric(FLERR,arg[3]);
_precision_mode = PREC_MODE_MIXED;
_offload_balance = 1.0;
@ -64,6 +63,7 @@ FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
_offload_tpc = 4;
#ifdef _LMP_INTEL_OFFLOAD
if (ncops < 1) error->all(FLERR,"Illegal package intel command");
_offload_affinity_set = 0;
_off_force_array_s = 0;
_off_force_array_m = 0;
@ -86,58 +86,61 @@ FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
_offload_cores = offload_cores;
_offload_threads = offload_cores;
#endif
int ncops = 1;
// optional keywords
_allow_separate_buffers = 1;
_offload_ghost = -1;
int iarg = 4;
while (iarg < narg) {
if (strcmp(arg[iarg], "mixed") == 0)
_precision_mode = PREC_MODE_MIXED;
else if (strcmp(arg[iarg], "double") == 0)
_precision_mode = PREC_MODE_DOUBLE;
else if (strcmp(arg[iarg], "single") == 0)
if (strcmp(arg[iarg],"prec") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal package intel command");
if (strcmp(arg[iarg+1],"single") == 0)
_precision_mode = PREC_MODE_SINGLE;
else if (strcmp(arg[iarg], "offload_affinity_balanced") == 0)
_offload_affinity_balanced = 1;
else if (strcmp(arg[iarg], "balance") == 0) {
if (iarg == narg - 1)
error->all(FLERR, "Illegal package intel mode requested");
++iarg;
_offload_balance = force->numeric(FLERR,arg[iarg]);
} else if (strcmp(arg[iarg], "offload_threads") == 0) {
if (iarg == narg - 1)
error->all(FLERR, "Illegal package intel mode requested");
++iarg;
_offload_threads = atoi(arg[iarg]);
} else if (strcmp(arg[iarg], "offload_tpc") == 0) {
if (iarg == narg - 1)
error->all(FLERR, "Illegal package intel mode requested");
++iarg;
_offload_tpc = atoi(arg[iarg]);
} else if (strcmp(arg[iarg], "offload_cards") == 0) {
if (iarg == narg - 1)
error->all(FLERR, "Illegal package intel mode requested");
++iarg;
ncops = atoi(arg[iarg]);
} else if (strcmp(arg[iarg], "buffers") == 0) {
if (iarg == narg - 1)
error->all(FLERR, "Illegal package intel mode requested");
++iarg;
_allow_separate_buffers = atoi(arg[iarg]);
} else if (strcmp(arg[iarg], "offload_ghost") == 0) {
if (iarg == narg - 1)
error->all(FLERR, "Illegal package intel mode requested");
++iarg;
_offload_ghost = atoi(arg[iarg]);
} else
error->all(FLERR, "Illegal package intel mode requested");
++iarg;
else if (strcmp(arg[iarg+1],"mixed") == 0)
_precision_mode = PREC_MODE_MIXED;
else if (strcmp(arg[iarg+1],"double") == 0)
_precision_mode = PREC_MODE_DOUBLE;
else error->all(FLERR,"Illegal package intel command");
iarg += 2;
} else if (strcmp(arg[iarg],"balance") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal package intel command");
_offload_balance = force->numeric(FLERR,arg[iarg+1]);
iarg += 2;
} else if (strcmp(arg[iarg], "ghost") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal package intel command");
if (strcmp(arg[iarg+1],"yes") == 0) _offload_ghost = 1;
else if (strcmp(arg[iarg+1],"no") == 0) _offload_ghost = 0;
else error->all(FLERR,"Illegal package intel command");
iarg += 2;
} else if (strcmp(arg[iarg], "tpc") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal package intel command");
_offload_tpc = atoi(arg[iarg+1]);
iarg += 2;
} else if (strcmp(arg[iarg],"tptask") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal package intel command");
_offload_threads = atoi(arg[iarg+1]);
iarg += 2;
}
// undocumented options
else if (strcmp(arg[iarg],"offload_affinity_balanced") == 0) {
_offload_affinity_balanced = 1;
iarg++;
} else if (strcmp(arg[iarg],"buffers") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal package intel command");
_allow_separate_buffers = atoi(arg[iarg+1]);
iarg += 2;
} else error->all(FLERR,"Illegal package intel command");
}
// error check
if (_offload_balance > 1.0 || _offload_threads <= 0 ||
_offload_tpc <= 0 || _offload_tpc > 4)
error->all(FLERR, "Illegal package intel mode requested");
error->all(FLERR,"Illegal package intel command");
#ifdef _LMP_INTEL_OFFLOAD
_ncops = ncops;

View File

@ -13,7 +13,7 @@
#ifdef FIX_CLASS
FixStyle(Intel,FixIntel)
FixStyle(INTEL,FixIntel)
#else

View File

@ -70,8 +70,7 @@ FixOMP::FixOMP(LAMMPS *lmp, int narg, char **arg)
thr(NULL), last_omp_style(NULL), last_pair_hybrid(NULL),
_nthr(-1), _neighbor(true), _mixed(false), _reduced(true)
{
if ((narg < 4) || (narg > 7)) error->all(FLERR,"Illegal package omp command");
if (strcmp(arg[1],"all") != 0) error->all(FLERR,"fix OMP has to operate on group 'all'");
if (narg < 4) error->all(FLERR,"Illegal package omp command");
int nthreads = 1;
if (narg > 3) {

View File

@ -1401,10 +1401,13 @@ void Input::package()
error->all(FLERR,"Package command after simulation box is defined");
if (narg < 1) error->all(FLERR,"Illegal package command");
// same checks for packages existing as in LAMMPS::post_create()
// since can be invoked here by package command in input script
if (strcmp(arg[0],"cuda") == 0) {
if (!lmp->cuda)
if (lmp->cuda == NULL || lmp->cuda->cuda_exists == 0)
error->all(FLERR,
"Package cuda command without USER-CUDA package installed");
"Package cuda command without USER-CUDA package enabled");
lmp->cuda->accelerator(narg-1,&arg[1]);
} else if (strcmp(arg[0],"gpu") == 0) {
@ -1420,9 +1423,9 @@ void Input::package()
delete [] fixarg;
} else if (strcmp(arg[0],"kokkos") == 0) {
if (!lmp->kokkos)
if (lmp->kokkos == NULL || lmp->kokkos->kokkos_exists == 0)
error->all(FLERR,
"Package kokkos command without KOKKOS package installed");
"Package kokkos command without KOKKOS package enabled");
lmp->kokkos->accelerator(narg-1,&arg[1]);
} else if (strcmp(arg[0],"omp") == 0) {

View File

@ -595,13 +595,12 @@ void LAMMPS::create()
/* ----------------------------------------------------------------------
check suffix consistency with installed packages
do this for GPU, USER-INTEL, USER-OMP
already done in constructor for USER-CUDA, KOKKOS
turn off suffix2 = omp if USER-OMP is not installed
invoke package-specific setup commands
invoke package-specific deafult package commands
only invoke if suffix is set and enabled
also check if suffix2 is set
called from LAMMPS constructor and after clear() command
so that package-specific core classes have been instantiated
------------------------------------------------------------------------- */
void LAMMPS::post_create()
@ -609,16 +608,25 @@ void LAMMPS::post_create()
if (!suffix_enable) return;
// suffix will always be set if suffix_enable = 1
// USER-CUDA and KOKKOS have package classes instantiated if enabled
// via "-c on" and "-k on"
// GPU, INTEL, USER-OMP provide their own fixes which will have
// been compiled with LAMMPS if those packages were installed
if (strcmp(suffix,"cuda") == 0 && (cuda == NULL || cuda->cuda_exists == 0))
error->all(FLERR,"Using suffix cuda without USER-CUDA package enabled");
if (strcmp(suffix,"gpu") == 0 && !modify->check_package("GPU"))
error->all(FLERR,"Using suffix gpu without GPU package installed");
if (strcmp(suffix,"intel") == 0 && !modify->check_package("Intel"))
if (strcmp(suffix,"intel") == 0 && !modify->check_package("INTEL"))
error->all(FLERR,"Using suffix intel without USER-INTEL package installed");
if (strcmp(suffix,"kk") == 0 &&
(kokkos == NULL || kokkos->kokkos_exists == 0))
error->all(FLERR,"Using suffix kk without KOKKOS package enabled");
if (strcmp(suffix,"omp") == 0 && !modify->check_package("OMP"))
error->all(FLERR,"Using suffix omp without USER-OMP package installed");
// suffix2 only currently set by -sf intel
// need to unset if LAMMPS was not built with USER-OMP package
// unset if LAMMPS was not built with USER-OMP package
if (suffix2 && strcmp(suffix2,"omp") == 0 && !modify->check_package("OMP")) {
delete [] suffix2;
@ -626,10 +634,9 @@ void LAMMPS::post_create()
}
if (suffix) {
if (strcmp(suffix,"gpu") == 0) input->one("package gpu force/neigh 0 0 1");
if (strcmp(suffix,"gpu") == 0) input->one("package gpu 1");
if (strcmp(suffix,"intel") == 0) input->one("package intel 1");
if (strcmp(suffix,"omp") == 0) input->one("package omp 0");
if (strcmp(suffix,"intel") == 0)
input->one("package intel mixed balance -1");
}
if (suffix2) {
if (strcmp(suffix,"omp") == 0) input->one("package omp 0");