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

This commit is contained in:
sjplimp
2015-10-05 15:20:06 +00:00
parent bee7ed920a
commit fa6ad89b99
3 changed files with 40 additions and 33 deletions

View File

@ -21,11 +21,12 @@ This package is based on the USER-OMP package and provides LAMMPS styles that:
-----------------------------------------------------------------------------
When using the suffix command with "intel", intel styles will be used if they
exist; if they do not, and the USER-OMP package is installed and an omp version
exists, that style will be used. For example, in the case the USER-OMP package
is installed,
exist. If the suffix command is used with "hybrid intel omp" and the USER-OMP
USER-OMP styles will be used whenever USER-INTEL styles are not available. This
allow for running most styles in LAMMPS with threading. For example, in the
latter case with the USER-OMP package installed,
kspace_style pppm/intel 1e-4
kspace_style pppm 1e-4
is equivalent to:

View File

@ -1699,7 +1699,7 @@ void Input::special_bonds()
void Input::suffix()
{
if (narg != 1) error->all(FLERR,"Illegal suffix command");
if (narg < 1) error->all(FLERR,"Illegal suffix command");
if (strcmp(arg[0],"off") == 0) lmp->suffix_enable = 0;
else if (strcmp(arg[0],"on") == 0) lmp->suffix_enable = 1;
@ -1707,17 +1707,21 @@ void Input::suffix()
lmp->suffix_enable = 1;
delete [] lmp->suffix;
delete [] lmp->suffix2;
if (strcmp(arg[0],"hybrid") == 0) {
if (narg != 3) error->all(FLERR,"Illegal suffix command");
int n = strlen(arg[1]) + 1;
lmp->suffix = new char[n];
strcpy(lmp->suffix,arg[1]);
n = strlen(arg[2]) + 1;
lmp->suffix2 = new char[n];
strcpy(lmp->suffix2,arg[2]);
} else {
if (narg != 1) error->all(FLERR,"Illegal suffix command");
int n = strlen(arg[0]) + 1;
lmp->suffix = new char[n];
strcpy(lmp->suffix,arg[0]);
// set 2nd suffix = "omp" when suffix = "intel"
// but only if USER-OMP package is installed
if (strcmp(lmp->suffix,"intel") == 0 && modify->check_package("OMP")) {
delete [] lmp->suffix2;
lmp->suffix2 = new char[4];
strcpy(lmp->suffix2,"omp");
}
}
}

View File

@ -192,16 +192,25 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
if (iarg+2 > narg)
error->universe_all(FLERR,"Invalid command-line argument");
delete [] suffix;
delete [] suffix2;
suffix_enable = 1;
// hybrid option to set fall-back for suffix2
if (strcmp(arg[iarg+1],"hybrid") == 0) {
if (iarg+4 > narg)
error->universe_all(FLERR,"Invalid command-line argument");
int n = strlen(arg[iarg+2]) + 1;
suffix = new char[n];
strcpy(suffix,arg[iarg+2]);
n = strlen(arg[iarg+3]) + 1;
suffix2 = new char[n];
strcpy(suffix2,arg[iarg+3]);
iarg += 4;
} else {
int n = strlen(arg[iarg+1]) + 1;
suffix = new char[n];
strcpy(suffix,arg[iarg+1]);
// set 2nd suffix = "omp" when suffix = "intel"
if (strcmp(suffix,"intel") == 0) {
suffix2 = new char[4];
strcpy(suffix2,"omp");
}
suffix_enable = 1;
iarg += 2;
}
} else if (strcmp(arg[iarg],"-reorder") == 0 ||
strcmp(arg[iarg],"-ro") == 0) {
if (iarg+3 > narg)
@ -634,7 +643,6 @@ void LAMMPS::create()
/* ----------------------------------------------------------------------
check suffix consistency with installed packages
turn off suffix2 = omp if USER-OMP is not installed
invoke package-specific deafult package commands
only invoke if suffix is set and enabled
also check if suffix2 is set
@ -667,19 +675,13 @@ void LAMMPS::post_create(int npack, int *pfirst, int *plast, char **arg)
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
// unset if LAMMPS was not built with USER-OMP package
if (suffix2 && strcmp(suffix2,"omp") == 0 && !modify->check_package("OMP")) {
delete [] suffix2;
suffix2 = NULL;
}
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 (suffix2) {
if (strcmp(suffix2,"gpu") == 0) input->one("package gpu 1");
if (strcmp(suffix2,"intel") == 0) input->one("package intel 1");
if (strcmp(suffix2,"omp") == 0) input->one("package omp 0");
}