17 #define VECTOR(A) A ## _X, A ## _Y, A ## _Z
18 #define TENSOR(A) A ## _XX, A ## _XY, A ## _XZ, \
19 A ## _YX, A ## _YY, A ## _YZ, \
20 A ## _ZX, A ## _ZY, A ## _ZZ
22 #define ADD_VECTOR(R,RL,D,DL) \
23 R->item( RL ## _X ) += D[ DL ## _X ]; \
24 R->item( RL ## _Y ) += D[ DL ## _Y ]; \
25 R->item( RL ## _Z ) += D[ DL ## _Z ]
27 #define ADD_VECTOR_OBJECT(R,RL,D) \
28 R->item( RL ## _X ) += D.x; \
29 R->item( RL ## _Y ) += D.y; \
30 R->item( RL ## _Z ) += D.z
32 #define ADD_TENSOR(R,RL,D,DL) \
33 R->item( RL ## _XX) += D[ DL ## _XX ]; \
34 R->item( RL ## _XY) += D[ DL ## _XY ]; \
35 R->item( RL ## _XZ) += D[ DL ## _XZ ]; \
36 R->item( RL ## _YX) += D[ DL ## _YX ]; \
37 R->item( RL ## _YY) += D[ DL ## _YY ]; \
38 R->item( RL ## _YZ) += D[ DL ## _YZ ]; \
39 R->item( RL ## _ZX) += D[ DL ## _ZX ]; \
40 R->item( RL ## _ZY) += D[ DL ## _ZY ]; \
41 R->item( RL ## _ZZ) += D[ DL ## _ZZ ]
43 #define ADD_TENSOR_OBJECT(R,RL,D) \
44 R->item( RL ## _XX) += D.xx; \
45 R->item( RL ## _XY) += D.xy; \
46 R->item( RL ## _XZ) += D.xz; \
47 R->item( RL ## _YX) += D.yx; \
48 R->item( RL ## _YY) += D.yy; \
49 R->item( RL ## _YZ) += D.yz; \
50 R->item( RL ## _ZX) += D.zx; \
51 R->item( RL ## _ZY) += D.zy; \
52 R->item( RL ## _ZZ) += D.zz
54 #define GET_VECTOR(O,R,A) \
55 O.x = R->item( A ## _X ); \
56 O.y = R->item( A ## _Y ); \
57 O.z = R->item( A ## _Z )
59 #define GET_TENSOR(O,R,A) \
60 O.xx = R->item( A ## _XX); \
61 O.xy = R->item( A ## _XY); \
62 O.xz = R->item( A ## _XZ); \
63 O.yx = R->item( A ## _YX); \
64 O.yy = R->item( A ## _YY); \
65 O.yz = R->item( A ## _YZ); \
66 O.zx = R->item( A ## _ZX); \
67 O.zy = R->item( A ## _ZY); \
68 O.zz = R->item( A ## _ZZ)
112 TENSOR(REDUCTION_VIRIAL_NBOND),
113 TENSOR(REDUCTION_VIRIAL_SLOW),
114 TENSOR(REDUCTION_VIRIAL_AMD_DIHE),
116 TENSOR(REDUCTION_ALT_VIRIAL_NORMAL),
117 TENSOR(REDUCTION_ALT_VIRIAL_NBOND),
118 TENSOR(REDUCTION_ALT_VIRIAL_SLOW),
120 TENSOR(REDUCTION_INT_VIRIAL_NORMAL),
121 TENSOR(REDUCTION_INT_VIRIAL_NBOND),
122 TENSOR(REDUCTION_INT_VIRIAL_SLOW),
124 VECTOR(REDUCTION_EXT_FORCE_NBOND),
125 VECTOR(REDUCTION_EXT_FORCE_SLOW),
127 VECTOR(REDUCTION_MOMENTUM),
128 TENSOR(REDUCTION_MOMENTUM_SQUARED),
129 VECTOR(REDUCTION_ANGULAR_MOMENTUM),
130 VECTOR(REDUCTION_HALFSTEP_MOMENTUM),
138 VECTOR(REDUCTION_PAIR_VDW_FORCE),
139 VECTOR(REDUCTION_PAIR_ELECT_FORCE),
152 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
164 TENSOR(MULTIGRATOR_REDUCTION_MOMENTUM_SQUARED),
186 #define REDUCTION_MAX_CHILDREN 4
204 for (
int i = 0; i < size; ++i ) {
data[i] = 0; }
243 int firstChild, lastChild;
244 int isMyChild(
int nodeID)
const {
245 return ( nodeID >= firstChild && nodeID < lastChild );
250 int isMyChild(
int nodeID)
const {
252 for(i=0;i<numChildren;i++)
253 if (children[i]==nodeID)
return 1;
256 int childIndex(
int nodeID)
const {
258 for(i=0;i<numChildren;i++)
259 if (children[i]==nodeID)
return i;
262 int isRoot(
void)
const {
return ( myParent == -1 ); }
265 void delSet(
int setID);
279 return CkpvAccess(ReductionMgr_instance);
286 const int max_intranode_children,
287 const int max_internode_children,
321 for (
int i=0; i<nitems; i++) data[i] += arr[i];
324 master->submit(
this);
342 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)
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)
void add(int nitems, const BigReal *arr)
int waitingForSequenceNumber
ReductionSetData * removeData(int seqNum)
BigReal item(int i) const
void remoteSubmit(ReductionSubmitMsg *msg)
RequireReduction * willRequire(int setID, int size=-1)
friend class RequireReduction
void remoteUnregister(ReductionRegisterMsg *msg)
ReductionSetData * dataQueue