4#ifdef COOLING_MOLECULARH
33 Compute(ComputeType t) : type(t) {}
37 void setOpt(
Opt *opt);
44 virtual int openCriterion(
TreePiece *ownerTP,
47 virtual void stateReady(
State *state,
TreePiece *owner,
int chunk,
int start,
int end) {}
49 virtual void stateReadyPar(
TreePiece *tp,
int start,
int end,
50 CkVec<OffsetNode>& clist, CkVec<RemotePartInfo>& rpilist,
51 CkVec<LocalPartInfo>& lpilist){}
53 virtual void fillLists(State *state_, TreePiece *tp,
int chunk,
int start,
54 int end, CkVec<OffsetNode>& clistforb, CkVec<RemotePartInfo>& rplistforb,
55 CkVec<LocalPartInfo>& lplistforb) {}
59 virtual void init(
void *cE,
int activeRung, Opt *opt);
60 virtual void reassoc(
void *cE,
int aR, Opt *opt){}
61 ComputeType getSelfType(){
return type;}
63 int getActiveRung() {
return activeRung;}
67 virtual void initState(State *state){}
85 virtual void walkDone(State *state){}
86 virtual void setComputeEntity(
void *ce){
90 virtual void *getComputeEntity(){
94 virtual State *getNewState(
int d1,
int d2);
95 virtual State *getNewState(
int d1);
96 virtual State *getNewState();
97 virtual void freeState(State *state);
105class GravityCompute :
public Compute{
106#ifdef BENCHMARK_TIME_COMPUTE
107 double computeTimePart;
108 double computeTimeNode;
111 void updateInterMass(
GravityParticle *p,
int start,
int end,
double mass);
115 GravityCompute() : Compute(Gravity){
116#ifdef BENCHMARK_TIME_COMPUTE
117 computeTimePart = 0.0;
118 computeTimeNode = 0.0;
122#ifdef BENCHMARK_TIME_COMPUTE
123 CkPrintf(
"Compute time part: %f\n",computeTimePart);
124 CkPrintf(
"Compute time node: %f\n",computeTimeNode);
138 void reassoc(
void *cE,
int activeRung,
Opt *o);
148class ListCompute :
public Compute{
151 ListCompute() : Compute(List) {
169 CkVec<OffsetNode>& clist, CkVec<RemotePartInfo>& rpilist,
170 CkVec<LocalPartInfo>& lpilist);
173 int end, CkVec<OffsetNode>& clistforb, CkVec<RemotePartInfo>& rplistforb,
174 CkVec<LocalPartInfo>& lplistforb);
178 void reassoc(
void *cE,
int activeRung,
Opt *o);
188#ifdef GPU_LOCAL_TREE_WALK
189 void sendLocalTreeWalkTriggerToGpu(
State *state,
TreePiece *tp,
int activeRung,
int startBucket,
int endBucket);
204#if defined CHANGA_REFACTOR_PRINT_INTERACTIONS || defined CHANGA_REFACTOR_WALKCHECK_INTERLIST || defined CUDA
219 void getBucketParameters(
TreePiece *tp,
int bucket,
int &bucketStart,
int &bucketSize, std::map<NodeKey, int>&lpref);
224 void initCudaState(
DoubleWalkState *state,
int numBuckets,
int nodeThreshold,
int partThreshold,
bool resume);
232class PrefetchCompute :
public Compute{
235 PrefetchCompute() : Compute(Prefetch) {
263 remoteGravityAwi = 2,
278 tw(_tw), c(_c), o(_o), s(state){}
294 bool requestNonLocalMoments;
297 RemoteTreeBuilder(
TreePiece *owner,
bool req) :
299 requestNonLocalMoments(req)
337 LocalTreePrinter(
string d,
int idx) :
345 file <<
"}" << std::endl;
353#ifdef COOLING_MOLECULARH
360 LocalLymanWernerDistributor(
TreePiece *owner) :
364 bool work(GenericTreeNode *node,
int level);
365 void doneChildren(GenericTreeNode *node,
int level);
WalkIndices
distingish between the walks that could be running.
Definition Compute.h:260
KeyType NodeKey
This key is the identification of a node inside the global tree, and it is unique for the node....
Definition GenericTreeNode.h:35
CkQ< OffsetNode > CheckList
Queue of nodes to check for interactions.
Definition ParallelGravity.h:654
Base clase for all tree based computations.
Definition Compute.h:26
virtual void nodeMissedEvent(int reqID, int chunk, State *state, TreePiece *tp)
Allow book-keeping of a cache miss.
Definition Compute.h:77
virtual void recvdParticlesFull(GravityParticle *egp, int num, int chunk, int reqID, State *state, TreePiece *tp, Tree::NodeKey &remoteBucket)
Allow book-keeping of a cache receive event.
Definition Compute.h:83
virtual void startNodeProcessEvent(State *state)
Definition Compute.h:73
virtual void nodeRecvdEvent(TreePiece *owner, int chunk, State *state, int bucket)
Allow book-keeping of a cache receive event.
Definition Compute.h:79
virtual void recvdParticles(ExternalGravityParticle *egp, int num, int chunk, int reqID, State *state, TreePiece *tp, Tree::NodeKey &remoteBucket)
Allow book-keeping of a cache receive event.
Definition Compute.h:81
virtual int doWork(GenericTreeNode *, TreeWalk *tw, State *state, int chunk, int reqID, bool isRoot, bool &didcomp, int awi)=0
Work to be done at each node.
virtual void finishNodeProcessEvent(TreePiece *owner, State *state)
Allow book-keeping when finished with a node.
Definition Compute.h:75
virtual void init(void *cE, int activeRung, Opt *opt)
Associate computeEntity (target bucket or node), activeRung and Optimization with this Compute object...
Definition Compute.cpp:22
Hold state where both the targets and sources are tree walked.
Definition State.h:117
int doWork(GenericTreeNode *, TreeWalk *tw, State *state, int chunk, int reqID, bool isRoot, bool &didcomp, int awi)
Immediately stop the walk.
Definition Compute.h:253
Information needed to calculate gravity.
Definition GravityParticle.h:33
void nodeRecvdEvent(TreePiece *owner, int chunk, State *state, int bucket)
Allow book-keeping of a cache receive event.
Definition Compute.cpp:335
void recvdParticles(ExternalGravityParticle *egp, int num, int chunk, int reqID, State *state, TreePiece *tp, Tree::NodeKey &remoteBucket)
Allow book-keeping of a cache receive event.
Definition Compute.cpp:269
void nodeMissedEvent(int reqID, int chunk, State *state, TreePiece *tp)
Allow book-keeping of a cache miss.
Definition Compute.cpp:220
int computeParticleForces(TreePiece *owner, GenericTreeNode *node, ExternalGravityParticle *part, int reqID)
Calculate forces due to particles in a node.
Definition Compute.cpp:590
int doWork(GenericTreeNode *, TreeWalk *tw, State *state, int chunk, int reqID, bool isRoot, bool &didcomp, int awi)
Work to be done at each node.
Definition Compute.cpp:406
Fundamental type for a particle.
Definition GravityParticle.h:364
int doWork(GenericTreeNode *, TreeWalk *tw, State *state, int chunk, int reqID, bool isRoot, bool &didcomp, int awi)
Process a node.
Definition Compute.cpp:690
void fillLists(State *state_, TreePiece *tp, int chunk, int start, int end, CkVec< OffsetNode > &clistforb, CkVec< RemotePartInfo > &rplistforb, CkVec< LocalPartInfo > &lplistforb)
Populate CkLoop Data.
Definition Compute.cpp:1241
void stateReadyPar(TreePiece *tp, int start, int end, CkVec< OffsetNode > &clist, CkVec< RemotePartInfo > &rpilist, CkVec< LocalPartInfo > &lpilist)
CkLoop version of stateReady()
Definition Compute.cpp:1929
void initState(State *state)
Clear lists.
Definition Compute.cpp:180
void recvdParticles(ExternalGravityParticle *egp, int num, int chunk, int reqID, State *state, TreePiece *tp, Tree::NodeKey &remoteBucket)
Process received remote particles.
Definition Compute.cpp:893
void nodeMissedEvent(int reqID, int chunk, State *state, TreePiece *tp)
Update state on a node miss.
Definition Compute.cpp:244
void enableCpu()
Flag the cpu (instead of gpu) for usage for the next walk.
Definition Compute.h:185
void stateReady(State *, TreePiece *, int chunk, int start, int end)
Check for computation Computation can be done on buckets indexed from start to end.
Definition Compute.cpp:1543
State * getNewState()
Version that allocates a DoubleWalkState.
Definition Compute.cpp:165
void reassoc(void *cE, int activeRung, Opt *o)
Reassociate the target node.
Definition Compute.cpp:213
void freeDoubleWalkState(DoubleWalkState *state)
Free up all the lists.
Definition Compute.cpp:83
void freeState(State *state)
Version that frees a DoubleWalkState.
Definition Compute.cpp:77
int openCriterion(TreePiece *ownerTP, GenericTreeNode *node, int reqID, State *state)
apply node opening criterion to this node.
Definition Compute.cpp:973
void nodeRecvdEvent(TreePiece *owner, int chunk, State *state, int bucket)
Update state upon receiving a remote node.
Definition Compute.cpp:356
Base class for optimizing walk actions.
Definition Opt.h:12
void startNodeProcessEvent(State *state)
Definition Compute.cpp:227
void finishNodeProcessEvent(TreePiece *owner, State *state)
Allow book-keeping when finished with a node.
Definition Compute.cpp:233
void recvdParticles(ExternalGravityParticle *egp, int num, int chunk, int reqID, State *state, TreePiece *tp, Tree::NodeKey &remoteBucket)
Allow book-keeping of a cache receive event.
Definition Compute.cpp:322
virtual int doWork(GenericTreeNode *, TreeWalk *tw, State *state, int chunk, int reqID, bool isRoot, bool &didcomp, int awi)
Work to be done at each node.
Definition Compute.cpp:625
Base class for maintaining the state of a tree walk.
Definition State.h:6
Interface for work in LocalTreeTraversal.
Definition Compute.h:283
Fundamental structure that holds particle and tree data.
Definition ParallelGravity.h:755
Base class for walking trees.
Definition TreeWalk.h:11
Base class for tree nodes.
Definition GenericTreeNode.h:59