18 #define VECTOR(A) A ## _X, A ## _Y, A ## _Z 19 #define TENSOR(A) A ## _XX, A ## _XY, A ## _XZ, \ 20 A ## _YX, A ## _YY, A ## _YZ, \ 21 A ## _ZX, A ## _ZY, A ## _ZZ 23 #define ADD_VECTOR(R,RL,D,DL) \ 24 R->item( RL ## _X ) += D[ DL ## _X ]; \ 25 R->item( RL ## _Y ) += D[ DL ## _Y ]; \ 26 R->item( RL ## _Z ) += D[ DL ## _Z ] 28 #define ADD_VECTOR_OBJECT(R,RL,D) \ 29 R->item( RL ## _X ) += D.x; \ 30 R->item( RL ## _Y ) += D.y; \ 31 R->item( RL ## _Z ) += D.z 33 #define ADD_TENSOR(R,RL,D,DL) \ 34 R->item( RL ## _XX) += D[ DL ## _XX ]; \ 35 R->item( RL ## _XY) += D[ DL ## _XY ]; \ 36 R->item( RL ## _XZ) += D[ DL ## _XZ ]; \ 37 R->item( RL ## _YX) += D[ DL ## _YX ]; \ 38 R->item( RL ## _YY) += D[ DL ## _YY ]; \ 39 R->item( RL ## _YZ) += D[ DL ## _YZ ]; \ 40 R->item( RL ## _ZX) += D[ DL ## _ZX ]; \ 41 R->item( RL ## _ZY) += D[ DL ## _ZY ]; \ 42 R->item( RL ## _ZZ) += D[ DL ## _ZZ ] 44 #define ADD_TENSOR_OBJECT(R,RL,D) \ 45 R->item( RL ## _XX) += D.xx; \ 46 R->item( RL ## _XY) += D.xy; \ 47 R->item( RL ## _XZ) += D.xz; \ 48 R->item( RL ## _YX) += D.yx; \ 49 R->item( RL ## _YY) += D.yy; \ 50 R->item( RL ## _YZ) += D.yz; \ 51 R->item( RL ## _ZX) += D.zx; \ 52 R->item( RL ## _ZY) += D.zy; \ 53 R->item( RL ## _ZZ) += D.zz 55 #define GET_VECTOR(O,R,A) \ 56 O.x = R->item( A ## _X ); \ 57 O.y = R->item( A ## _Y ); \ 58 O.z = R->item( A ## _Z ) 60 #define GET_TENSOR(O,R,A) \ 61 O.xx = R->item( A ## _XX); \ 62 O.xy = R->item( A ## _XY); \ 63 O.xz = R->item( A ## _XZ); \ 64 O.yx = R->item( A ## _YX); \ 65 O.yy = R->item( A ## _YY); \ 66 O.yz = R->item( A ## _YZ); \ 67 O.zx = R->item( A ## _ZX); \ 68 O.zy = R->item( A ## _ZY); \ 69 O.zz = R->item( A ## _ZZ) 113 TENSOR(REDUCTION_VIRIAL_NBOND),
114 TENSOR(REDUCTION_VIRIAL_SLOW),
115 TENSOR(REDUCTION_VIRIAL_AMD_DIHE),
117 TENSOR(REDUCTION_ALT_VIRIAL_NORMAL),
118 TENSOR(REDUCTION_ALT_VIRIAL_NBOND),
119 TENSOR(REDUCTION_ALT_VIRIAL_SLOW),
121 TENSOR(REDUCTION_INT_VIRIAL_NORMAL),
122 TENSOR(REDUCTION_INT_VIRIAL_NBOND),
123 TENSOR(REDUCTION_INT_VIRIAL_SLOW),
125 VECTOR(REDUCTION_EXT_FORCE_NBOND),
126 VECTOR(REDUCTION_EXT_FORCE_SLOW),
128 VECTOR(REDUCTION_MOMENTUM),
129 TENSOR(REDUCTION_MOMENTUM_SQUARED),
130 VECTOR(REDUCTION_ANGULAR_MOMENTUM),
131 VECTOR(REDUCTION_HALFSTEP_MOMENTUM),
139 VECTOR(REDUCTION_PAIR_VDW_FORCE),
140 VECTOR(REDUCTION_PAIR_ELECT_FORCE),
153 #if defined(NAMD_CUDA) || defined(NAMD_HIP) 165 TENSOR(MULTIGRATOR_REDUCTION_MOMENTUM_SQUARED),
187 #define REDUCTION_MAX_CHILDREN 4 205 for (
int i = 0; i < size; ++i ) {
data[i] = 0; }
244 int firstChild, lastChild;
245 int isMyChild(
int nodeID)
const {
246 return ( nodeID >= firstChild && nodeID < lastChild );
251 int isMyChild(
int nodeID)
const {
253 for(i=0;i<numChildren;i++)
254 if (children[i]==nodeID)
return 1;
257 int childIndex(
int nodeID)
const {
259 for(i=0;i<numChildren;i++)
260 if (children[i]==nodeID)
return i;
263 int isRoot(
void)
const {
return ( myParent == -1 ); }
266 void delSet(
int setID);
280 return CkpvAccess(ReductionMgr_instance);
287 const int max_intranode_children,
288 const int max_internode_children,
322 for (
int i=0; i<nitems; i++) data[i] += arr[i];
325 master->submit(
this);
343 master->require(
this);
void max(int i, BigReal v)
void buildSpanTree(const int pe, const int max_intranode_children, const int max_internode_children, int *parent, int *num_children, int **children)
ReductionValue & operator[](int index)
ReductionSetData(int seqNum, int size)
int * addToRemoteSequenceNumber
ReductionSetData * getData(int seqNum)
ReductionSet(int setID, int size, int numChildren)
void remoteRegister(ReductionRegisterMsg *msg)
SubmitReduction * willSubmit(int setID, int size=-1)
static ReductionMgr * Object(void)
double operator+=(double other)
void add(int nitems, const BigReal *arr)
ReductionValue & item(int index)
int waitingForSequenceNumber
ReductionSetData * removeData(int seqNum)
double operator=(double &other)
void remoteSubmit(ReductionSubmitMsg *msg)
BigReal item(int i) const
void setVal(const NodeReduction *other)
RequireReduction * willRequire(int setID, int size=-1)
friend class RequireReduction
void remoteUnregister(ReductionRegisterMsg *msg)
ReductionSetData * dataQueue