refactor fix for detecting intel pair styles in hybrid pair styles

This commit is contained in:
Axel Kohlmeyer
2020-01-07 15:09:50 -05:00
parent 4c974c6d5e
commit f8ad7cc90f
3 changed files with 21 additions and 5 deletions

View File

@ -16,6 +16,7 @@
Anupama Kurpad (Intel) - Host Affinitization
------------------------------------------------------------------------- */
#include "fix_intel.h"
#include "comm.h"
#include "error.h"
#include "force.h"
@ -27,7 +28,7 @@
#include "timer.h"
#include "universe.h"
#include "update.h"
#include "fix_intel.h"
#include "utils.h"
#include <cstring>
#include <cstdlib>
@ -391,6 +392,20 @@ void FixIntel::setup_pre_reverse(int eflag, int vflag)
/* ---------------------------------------------------------------------- */
bool FixIntel::pair_hybrid_check()
{
PairHybrid *ph = (PairHybrid *)force->pair;
bool has_intel = false;
int nstyles = ph->nstyles;
for (int i = 0; i < nstyles; ++i)
if (ph->styles[i]->suffix_flag & Suffix::INTEL) has_intel = true;
return has_intel;
}
/* ---------------------------------------------------------------------- */
void FixIntel::pair_init_check(const bool cdmessage)
{
#ifdef INTEL_VMASK
@ -510,9 +525,9 @@ void FixIntel::bond_init_check()
int intel_pair = 0;
if (force->pair_match("/intel$", 0) != NULL)
intel_pair = 1;
else if (force->pair_match("^hybrid", 1) != NULL) {
else if (force->pair_match("^hybrid", 0) != NULL) {
_hybrid_nonpair = 1;
if (_pair_intel_count) intel_pair = 1;
if (pair_hybrid_check()) intel_pair = 1;
}
if (intel_pair == 0)
@ -529,8 +544,7 @@ void FixIntel::kspace_init_check()
intel_pair = 1;
else if (force->pair_match("^hybrid", 0) != NULL) {
_hybrid_nonpair = 1;
pair_init_check(); // need to run this here explicitly, since pair->init() was not run yet.
if (_pair_intel_count) intel_pair = 1;
if (pair_hybrid_check()) intel_pair = 1;
}
if (intel_pair == 0)

View File

@ -46,6 +46,7 @@ class FixIntel : public Fix {
inline void min_setup(int in) { setup(in); }
void setup_pre_reverse(int eflag = 0, int vflag = 0);
bool pair_hybrid_check();
void pair_init_check(const bool cdmessage=false);
void bond_init_check();
void kspace_init_check();

View File

@ -26,6 +26,7 @@ class Pair : protected Pointers {
friend class DihedralCharmm;
friend class DihedralCharmmOMP;
friend class FixGPU;
friend class FixIntel;
friend class FixOMP;
friend class ThrOMP;
friend class Info;