git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12458 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -47,8 +47,6 @@
|
|||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Cuda::Cuda(LAMMPS* lmp) : Pointers(lmp)
|
Cuda::Cuda(LAMMPS* lmp) : Pointers(lmp)
|
||||||
{
|
{
|
||||||
cuda_exists = true;
|
cuda_exists = true;
|
||||||
|
|||||||
@ -49,10 +49,9 @@ enum{NSQ,BIN,MULTI};
|
|||||||
|
|
||||||
FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
|
FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
|
||||||
{
|
{
|
||||||
if (narg < 4)
|
if (narg < 4) error->all(FLERR,"Illegal package intel command");
|
||||||
error->all(FLERR, "Illegal package intel command");
|
|
||||||
if (strcmp(arg[1],"all") != 0)
|
int ncops = force->inumeric(FLERR,arg[3]);
|
||||||
error->all(FLERR, "fix Intel has to operate on group 'all'");
|
|
||||||
|
|
||||||
_precision_mode = PREC_MODE_MIXED;
|
_precision_mode = PREC_MODE_MIXED;
|
||||||
_offload_balance = 1.0;
|
_offload_balance = 1.0;
|
||||||
@ -64,6 +63,7 @@ FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
|
|||||||
_offload_tpc = 4;
|
_offload_tpc = 4;
|
||||||
|
|
||||||
#ifdef _LMP_INTEL_OFFLOAD
|
#ifdef _LMP_INTEL_OFFLOAD
|
||||||
|
if (ncops < 1) error->all(FLERR,"Illegal package intel command");
|
||||||
_offload_affinity_set = 0;
|
_offload_affinity_set = 0;
|
||||||
_off_force_array_s = 0;
|
_off_force_array_s = 0;
|
||||||
_off_force_array_m = 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_cores = offload_cores;
|
||||||
_offload_threads = offload_cores;
|
_offload_threads = offload_cores;
|
||||||
#endif
|
#endif
|
||||||
int ncops = 1;
|
|
||||||
|
// optional keywords
|
||||||
|
|
||||||
_allow_separate_buffers = 1;
|
_allow_separate_buffers = 1;
|
||||||
_offload_ghost = -1;
|
_offload_ghost = -1;
|
||||||
|
|
||||||
int iarg = 4;
|
int iarg = 4;
|
||||||
while (iarg < narg) {
|
while (iarg < narg) {
|
||||||
if (strcmp(arg[iarg], "mixed") == 0)
|
if (strcmp(arg[iarg],"prec") == 0) {
|
||||||
_precision_mode = PREC_MODE_MIXED;
|
if (iarg+2 > narg) error->all(FLERR,"Illegal package intel command");
|
||||||
else if (strcmp(arg[iarg], "double") == 0)
|
if (strcmp(arg[iarg+1],"single") == 0)
|
||||||
_precision_mode = PREC_MODE_DOUBLE;
|
_precision_mode = PREC_MODE_SINGLE;
|
||||||
else if (strcmp(arg[iarg], "single") == 0)
|
else if (strcmp(arg[iarg+1],"mixed") == 0)
|
||||||
_precision_mode = PREC_MODE_SINGLE;
|
_precision_mode = PREC_MODE_MIXED;
|
||||||
else if (strcmp(arg[iarg], "offload_affinity_balanced") == 0)
|
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;
|
_offload_affinity_balanced = 1;
|
||||||
else if (strcmp(arg[iarg], "balance") == 0) {
|
iarg++;
|
||||||
if (iarg == narg - 1)
|
} else if (strcmp(arg[iarg],"buffers") == 0) {
|
||||||
error->all(FLERR, "Illegal package intel mode requested");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal package intel command");
|
||||||
++iarg;
|
_allow_separate_buffers = atoi(arg[iarg+1]);
|
||||||
_offload_balance = force->numeric(FLERR,arg[iarg]);
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg], "offload_threads") == 0) {
|
} else error->all(FLERR,"Illegal package intel command");
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// error check
|
||||||
|
|
||||||
if (_offload_balance > 1.0 || _offload_threads <= 0 ||
|
if (_offload_balance > 1.0 || _offload_threads <= 0 ||
|
||||||
_offload_tpc <= 0 || _offload_tpc > 4)
|
_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
|
#ifdef _LMP_INTEL_OFFLOAD
|
||||||
_ncops = ncops;
|
_ncops = ncops;
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#ifdef FIX_CLASS
|
#ifdef FIX_CLASS
|
||||||
|
|
||||||
FixStyle(Intel,FixIntel)
|
FixStyle(INTEL,FixIntel)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|||||||
@ -70,8 +70,7 @@ FixOMP::FixOMP(LAMMPS *lmp, int narg, char **arg)
|
|||||||
thr(NULL), last_omp_style(NULL), last_pair_hybrid(NULL),
|
thr(NULL), last_omp_style(NULL), last_pair_hybrid(NULL),
|
||||||
_nthr(-1), _neighbor(true), _mixed(false), _reduced(true)
|
_nthr(-1), _neighbor(true), _mixed(false), _reduced(true)
|
||||||
{
|
{
|
||||||
if ((narg < 4) || (narg > 7)) error->all(FLERR,"Illegal package omp command");
|
if (narg < 4) error->all(FLERR,"Illegal package omp command");
|
||||||
if (strcmp(arg[1],"all") != 0) error->all(FLERR,"fix OMP has to operate on group 'all'");
|
|
||||||
|
|
||||||
int nthreads = 1;
|
int nthreads = 1;
|
||||||
if (narg > 3) {
|
if (narg > 3) {
|
||||||
|
|||||||
@ -1401,10 +1401,13 @@ void Input::package()
|
|||||||
error->all(FLERR,"Package command after simulation box is defined");
|
error->all(FLERR,"Package command after simulation box is defined");
|
||||||
if (narg < 1) error->all(FLERR,"Illegal package command");
|
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 (strcmp(arg[0],"cuda") == 0) {
|
||||||
if (!lmp->cuda)
|
if (lmp->cuda == NULL || lmp->cuda->cuda_exists == 0)
|
||||||
error->all(FLERR,
|
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]);
|
lmp->cuda->accelerator(narg-1,&arg[1]);
|
||||||
|
|
||||||
} else if (strcmp(arg[0],"gpu") == 0) {
|
} else if (strcmp(arg[0],"gpu") == 0) {
|
||||||
@ -1420,9 +1423,9 @@ void Input::package()
|
|||||||
delete [] fixarg;
|
delete [] fixarg;
|
||||||
|
|
||||||
} else if (strcmp(arg[0],"kokkos") == 0) {
|
} else if (strcmp(arg[0],"kokkos") == 0) {
|
||||||
if (!lmp->kokkos)
|
if (lmp->kokkos == NULL || lmp->kokkos->kokkos_exists == 0)
|
||||||
error->all(FLERR,
|
error->all(FLERR,
|
||||||
"Package kokkos command without KOKKOS package installed");
|
"Package kokkos command without KOKKOS package enabled");
|
||||||
lmp->kokkos->accelerator(narg-1,&arg[1]);
|
lmp->kokkos->accelerator(narg-1,&arg[1]);
|
||||||
|
|
||||||
} else if (strcmp(arg[0],"omp") == 0) {
|
} else if (strcmp(arg[0],"omp") == 0) {
|
||||||
|
|||||||
@ -595,13 +595,12 @@ void LAMMPS::create()
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
check suffix consistency with installed packages
|
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
|
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
|
only invoke if suffix is set and enabled
|
||||||
also check if suffix2 is set
|
also check if suffix2 is set
|
||||||
called from LAMMPS constructor and after clear() command
|
called from LAMMPS constructor and after clear() command
|
||||||
|
so that package-specific core classes have been instantiated
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void LAMMPS::post_create()
|
void LAMMPS::post_create()
|
||||||
@ -609,16 +608,25 @@ void LAMMPS::post_create()
|
|||||||
if (!suffix_enable) return;
|
if (!suffix_enable) return;
|
||||||
|
|
||||||
// suffix will always be set if suffix_enable = 1
|
// 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"))
|
if (strcmp(suffix,"gpu") == 0 && !modify->check_package("GPU"))
|
||||||
error->all(FLERR,"Using suffix gpu without GPU package installed");
|
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");
|
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"))
|
if (strcmp(suffix,"omp") == 0 && !modify->check_package("OMP"))
|
||||||
error->all(FLERR,"Using suffix omp without USER-OMP package installed");
|
error->all(FLERR,"Using suffix omp without USER-OMP package installed");
|
||||||
|
|
||||||
// suffix2 only currently set by -sf intel
|
// 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")) {
|
if (suffix2 && strcmp(suffix2,"omp") == 0 && !modify->check_package("OMP")) {
|
||||||
delete [] suffix2;
|
delete [] suffix2;
|
||||||
@ -626,10 +634,9 @@ void LAMMPS::post_create()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (suffix) {
|
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,"omp") == 0) input->one("package omp 0");
|
||||||
if (strcmp(suffix,"intel") == 0)
|
|
||||||
input->one("package intel mixed balance -1");
|
|
||||||
}
|
}
|
||||||
if (suffix2) {
|
if (suffix2) {
|
||||||
if (strcmp(suffix,"omp") == 0) input->one("package omp 0");
|
if (strcmp(suffix,"omp") == 0) input->one("package omp 0");
|
||||||
|
|||||||
Reference in New Issue
Block a user