Unverified Commit 6e99b3d8 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

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

Fix to allow suffix and pair hybrid to work together with USER-INTEL.
parents 7968d2ed bea0a309
Loading
Loading
Loading
Loading
+11 −26
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)

  _nbor_pack_width = 1;
  _three_body_neighbor = 0;
  _pair_intel_count = 0;
  _hybrid_nonpair = 0;

  _precision_mode = PREC_MODE_MIXED;
@@ -312,22 +313,14 @@ void FixIntel::init()
  }
  #endif

  int nstyles = 0;
  const int nstyles = _pair_intel_count;
  if (force->pair_match("hybrid", 1) != NULL) {
    _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)
      error->all(FLERR,
                 "Intel package requires fdotr virial with newton on.");
  } else if (force->pair_match("hybrid/overlay", 1) != NULL) {
    _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)
      error->all(FLERR,
                 "Intel package requires fdotr virial with newton on.");
@@ -345,6 +338,8 @@ void FixIntel::init()
      _pair_hybrid_zero = 1;
  _hybrid_nonpair = 0;

  _pair_intel_count = 0;

  #ifdef _LMP_INTEL_OFFLOAD
  if (offload_balance() != 0.0) {
    _pair_hybrid_zero = 0;
@@ -478,6 +473,8 @@ void FixIntel::pair_init_check(const bool cdmessage)
    get_double_buffers()->need_tag(need_tag);
  }

  _pair_intel_count++;

  #ifdef _LMP_INTEL_OFFLOAD
  set_offload_affinity();
  #endif
@@ -521,16 +518,10 @@ void FixIntel::bond_init_check()
    intel_pair = 1;
  else if (force->pair_match("hybrid", 1) != NULL) {
    _hybrid_nonpair = 1;
    PairHybrid *hybrid = (PairHybrid *) force->pair;
    for (int i = 0; i < hybrid->nstyles; i++)
      if (strstr(hybrid->keywords[i], "/intel") != NULL)
        intel_pair = 1;
    if (_pair_intel_count) intel_pair = 1;
  } else if (force->pair_match("hybrid/overlay", 1) != NULL) {
    _hybrid_nonpair = 1;
    PairHybridOverlay *hybrid = (PairHybridOverlay *) force->pair;
    for (int i = 0; i < hybrid->nstyles; i++)
      if (strstr(hybrid->keywords[i], "/intel") != NULL)
        intel_pair = 1;
    if (_pair_intel_count) intel_pair = 1;
  }

  if (intel_pair == 0)
@@ -547,16 +538,10 @@ void FixIntel::kspace_init_check()
    intel_pair = 1;
  else if (force->pair_match("hybrid", 1) != NULL) {
    _hybrid_nonpair = 1;
    PairHybrid *hybrid = (PairHybrid *) force->pair;
    for (int i = 0; i < hybrid->nstyles; i++)
      if (strstr(hybrid->keywords[i], "/intel") != NULL)
        intel_pair = 1;
    if (_pair_intel_count) intel_pair = 1;
  } else if (force->pair_match("hybrid/overlay", 1) != NULL) {
    _hybrid_nonpair = 1;
    PairHybridOverlay *hybrid = (PairHybridOverlay *) force->pair;
    for (int i = 0; i < hybrid->nstyles; i++)
      if (strstr(hybrid->keywords[i], "/intel") != NULL)
        intel_pair = 1;
    if (_pair_intel_count) intel_pair = 1;
  }

  if (intel_pair == 0)
+1 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ class FixIntel : public Fix {
  IntelBuffers<double,double> *_double_buffers;

  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
  int _pair_hybrid_zero, _hybrid_nonpair, _zero_master;