Merge pull request #1159 from wmbrownIntel/user-intel-sf-hybrid

Fix to allow suffix and pair hybrid to work together with USER-INTEL.
This commit is contained in:
Axel Kohlmeyer 2018-10-16 06:09:58 -04:00 committed by GitHub
commit 6e99b3d8ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 27 deletions

View File

@ -65,6 +65,7 @@ FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
_nbor_pack_width = 1; _nbor_pack_width = 1;
_three_body_neighbor = 0; _three_body_neighbor = 0;
_pair_intel_count = 0;
_hybrid_nonpair = 0; _hybrid_nonpair = 0;
_precision_mode = PREC_MODE_MIXED; _precision_mode = PREC_MODE_MIXED;
@ -312,22 +313,14 @@ void FixIntel::init()
} }
#endif #endif
int nstyles = 0; const int nstyles = _pair_intel_count;
if (force->pair_match("hybrid", 1) != NULL) { if (force->pair_match("hybrid", 1) != NULL) {
_pair_hybrid_flag = 1; _pair_hybrid_flag = 1;
PairHybrid *hybrid = (PairHybrid *) force->pair;
for (int i = 0; i < hybrid->nstyles; i++)
if (strstr(hybrid->keywords[i], "/intel") != NULL)
nstyles++;
if (force->newton_pair != 0 && force->pair->no_virial_fdotr_compute) if (force->newton_pair != 0 && force->pair->no_virial_fdotr_compute)
error->all(FLERR, error->all(FLERR,
"Intel package requires fdotr virial with newton on."); "Intel package requires fdotr virial with newton on.");
} else if (force->pair_match("hybrid/overlay", 1) != NULL) { } else if (force->pair_match("hybrid/overlay", 1) != NULL) {
_pair_hybrid_flag = 1; _pair_hybrid_flag = 1;
PairHybridOverlay *hybrid = (PairHybridOverlay *) force->pair;
for (int i = 0; i < hybrid->nstyles; i++)
if (strstr(hybrid->keywords[i], "/intel") != NULL)
nstyles++;
if (force->newton_pair != 0 && force->pair->no_virial_fdotr_compute) if (force->newton_pair != 0 && force->pair->no_virial_fdotr_compute)
error->all(FLERR, error->all(FLERR,
"Intel package requires fdotr virial with newton on."); "Intel package requires fdotr virial with newton on.");
@ -345,6 +338,8 @@ void FixIntel::init()
_pair_hybrid_zero = 1; _pair_hybrid_zero = 1;
_hybrid_nonpair = 0; _hybrid_nonpair = 0;
_pair_intel_count = 0;
#ifdef _LMP_INTEL_OFFLOAD #ifdef _LMP_INTEL_OFFLOAD
if (offload_balance() != 0.0) { if (offload_balance() != 0.0) {
_pair_hybrid_zero = 0; _pair_hybrid_zero = 0;
@ -458,7 +453,7 @@ void FixIntel::pair_init_check(const bool cdmessage)
force->special_coul[3] == 0.0) flag = 1; force->special_coul[3] == 0.0) flag = 1;
if (flag) if (flag)
error->all(FLERR,"Add -DLMP_INTEL_NBOR_COMPAT to build for special_bond" error->all(FLERR,"Add -DLMP_INTEL_NBOR_COMPAT to build for special_bond"
"exclusions with Intel"); " exclusions with Intel");
} }
#endif #endif
@ -478,6 +473,8 @@ void FixIntel::pair_init_check(const bool cdmessage)
get_double_buffers()->need_tag(need_tag); get_double_buffers()->need_tag(need_tag);
} }
_pair_intel_count++;
#ifdef _LMP_INTEL_OFFLOAD #ifdef _LMP_INTEL_OFFLOAD
set_offload_affinity(); set_offload_affinity();
#endif #endif
@ -521,16 +518,10 @@ void FixIntel::bond_init_check()
intel_pair = 1; intel_pair = 1;
else if (force->pair_match("hybrid", 1) != NULL) { else if (force->pair_match("hybrid", 1) != NULL) {
_hybrid_nonpair = 1; _hybrid_nonpair = 1;
PairHybrid *hybrid = (PairHybrid *) force->pair; if (_pair_intel_count) intel_pair = 1;
for (int i = 0; i < hybrid->nstyles; i++)
if (strstr(hybrid->keywords[i], "/intel") != NULL)
intel_pair = 1;
} else if (force->pair_match("hybrid/overlay", 1) != NULL) { } else if (force->pair_match("hybrid/overlay", 1) != NULL) {
_hybrid_nonpair = 1; _hybrid_nonpair = 1;
PairHybridOverlay *hybrid = (PairHybridOverlay *) force->pair; if (_pair_intel_count) intel_pair = 1;
for (int i = 0; i < hybrid->nstyles; i++)
if (strstr(hybrid->keywords[i], "/intel") != NULL)
intel_pair = 1;
} }
if (intel_pair == 0) if (intel_pair == 0)
@ -547,16 +538,10 @@ void FixIntel::kspace_init_check()
intel_pair = 1; intel_pair = 1;
else if (force->pair_match("hybrid", 1) != NULL) { else if (force->pair_match("hybrid", 1) != NULL) {
_hybrid_nonpair = 1; _hybrid_nonpair = 1;
PairHybrid *hybrid = (PairHybrid *) force->pair; if (_pair_intel_count) intel_pair = 1;
for (int i = 0; i < hybrid->nstyles; i++)
if (strstr(hybrid->keywords[i], "/intel") != NULL)
intel_pair = 1;
} else if (force->pair_match("hybrid/overlay", 1) != NULL) { } else if (force->pair_match("hybrid/overlay", 1) != NULL) {
_hybrid_nonpair = 1; _hybrid_nonpair = 1;
PairHybridOverlay *hybrid = (PairHybridOverlay *) force->pair; if (_pair_intel_count) intel_pair = 1;
for (int i = 0; i < hybrid->nstyles; i++)
if (strstr(hybrid->keywords[i], "/intel") != NULL)
intel_pair = 1;
} }
if (intel_pair == 0) if (intel_pair == 0)

View File

@ -101,7 +101,7 @@ class FixIntel : public Fix {
IntelBuffers<double,double> *_double_buffers; IntelBuffers<double,double> *_double_buffers;
int _precision_mode, _nthreads, _nbor_pack_width, _three_body_neighbor; int _precision_mode, _nthreads, _nbor_pack_width, _three_body_neighbor;
int _pair_hybrid_flag; int _pair_intel_count, _pair_hybrid_flag;
// These should be removed in subsequent update w/ simpler hybrid arch // These should be removed in subsequent update w/ simpler hybrid arch
int _pair_hybrid_zero, _hybrid_nonpair, _zero_master; int _pair_hybrid_zero, _hybrid_nonpair, _zero_master;