NAMD
Public Member Functions | Public Attributes | List of all members
cr_sortop_reverse_priority Struct Reference

Public Member Functions

 cr_sortop_reverse_priority (cr_sortop_distance &sod, const CudaComputeNonbonded::PatchRecord *patchrecs)
 
bool pid_compare_priority (int2 pidi, int2 pidj)
 
bool operator() (CudaComputeNonbonded::ComputeRecord j, CudaComputeNonbonded::ComputeRecord i)
 

Public Attributes

cr_sortop_distancedistop
 
const CudaComputeNonbonded::PatchRecordpr
 

Detailed Description

Definition at line 2139 of file CudaComputeNonbonded.C.

Constructor & Destructor Documentation

◆ cr_sortop_reverse_priority()

cr_sortop_reverse_priority::cr_sortop_reverse_priority ( cr_sortop_distance sod,
const CudaComputeNonbonded::PatchRecord patchrecs 
)
inline

Definition at line 2142 of file CudaComputeNonbonded.C.

2143  : distop(sod), pr(patchrecs) { }
const CudaComputeNonbonded::PatchRecord * pr

Member Function Documentation

◆ operator()()

bool cr_sortop_reverse_priority::operator() ( CudaComputeNonbonded::ComputeRecord  j,
CudaComputeNonbonded::ComputeRecord  i 
)
inline

Definition at line 2162 of file CudaComputeNonbonded.C.

References distop, CudaComputeNonbonded::ComputeRecord::patchInd, CudaComputeNonbonded::ComputeRecord::pid, and pid_compare_priority().

2163  { // i and j reversed
2164  // Choose patch i (= patch with greater priority)
2165  int2 pidi = pid_compare_priority(make_int2(i.pid[0], i.patchInd[0]), make_int2(i.pid[1], i.patchInd[1])) ? make_int2(i.pid[0], i.patchInd[0]) : make_int2(i.pid[1], i.patchInd[1]);
2166  // Choose patch j
2167  int2 pidj = pid_compare_priority(make_int2(j.pid[0], j.patchInd[0]), make_int2(j.pid[1], j.patchInd[1])) ? make_int2(j.pid[0], j.patchInd[0]) : make_int2(j.pid[1], j.patchInd[1]);
2168  if ( pidi.x != pidj.x ) return pid_compare_priority(pidi, pidj);
2169  return distop(i,j);
2170  }
bool pid_compare_priority(int2 pidi, int2 pidj)

◆ pid_compare_priority()

bool cr_sortop_reverse_priority::pid_compare_priority ( int2  pidi,
int2  pidj 
)
inline

Definition at line 2144 of file CudaComputeNonbonded.C.

References CudaComputeNonbonded::PatchRecord::isSameNode, CudaComputeNonbonded::PatchRecord::isSamePhysicalNode, PATCH_PRIORITY, CudaComputeNonbonded::PatchRecord::pe, pr, CudaComputeNonbonded::PatchRecord::reversePriorityRankInPe, and sortop_bitreverse().

Referenced by operator()().

2144  {
2145  const CudaComputeNonbonded::PatchRecord &pri = pr[pidi.y];
2146  const CudaComputeNonbonded::PatchRecord &prj = pr[pidj.y];
2147  if ( pri.isSamePhysicalNode && ! prj.isSamePhysicalNode ) return 0;
2148  if ( prj.isSamePhysicalNode && ! pri.isSamePhysicalNode ) return 1;
2149  if ( pri.isSameNode && ! prj.isSameNode ) return 0;
2150  if ( prj.isSameNode && ! pri.isSameNode ) return 1;
2151  if ( pri.isSameNode ) { // and prj.isSameNode
2152  int rpri = pri.reversePriorityRankInPe;
2153  int rprj = prj.reversePriorityRankInPe;
2154  if ( rpri != rprj ) return rpri > rprj;
2155  return sortop_bitreverse(CkRankOf(pri.pe),CkRankOf(prj.pe));
2156  }
2157  int ppi = PATCH_PRIORITY(pidi.x);
2158  int ppj = PATCH_PRIORITY(pidj.x);
2159  if ( ppi != ppj ) return ppi < ppj;
2160  return pidi.x < pidj.x;
2161  }
const CudaComputeNonbonded::PatchRecord * pr
static bool sortop_bitreverse(int a, int b)
#define PATCH_PRIORITY(PID)
Definition: Priorities.h:25

Member Data Documentation

◆ distop

cr_sortop_distance& cr_sortop_reverse_priority::distop

Definition at line 2140 of file CudaComputeNonbonded.C.

Referenced by operator()().

◆ pr

const CudaComputeNonbonded::PatchRecord* cr_sortop_reverse_priority::pr

Definition at line 2141 of file CudaComputeNonbonded.C.

Referenced by pid_compare_priority().


The documentation for this struct was generated from the following file: