14 #include "ParallelGravity.decl.h"
16 #if CHARM_VERSION > 60401 && CMK_BALANCED_INJECTION_API
17 #include "ckBIconfig.h"
35 struct UpdateParticlesStruct{
44 struct PendingBuffers {
45 CkVec<CudaMultipoleMoments> *moments;
46 CkVec<CompactPartData> *particles;
62 friend class OctTreeBuildPhaseIWorker;
65 CProxy_TreePiece treePieces;
85 int cumNumReplicatedNodes;
88 int treePiecesDonePrefetch;
89 int treePiecesDoneLocalComputation;
92 int treePiecesDoneRemoteChunkComputation;
93 int treePiecesWantParticlesBack;
96 int treePiecesParticlesUpdated;
97 int savedNumTotalParticles;
98 int savedNumTotalNodes;
108 std::map<NodeKey, int> cachedPartsOnGpu;
118 CkCallback *localTransferCallback;
120 PendingBuffers *currentChunkBuffers;
122 CkQ<PendingBuffers *> pendingChunkTransferQ;
125 int lastChunkMoments;
126 int lastChunkParticles;
139 #ifdef HAPI_INSTRUMENT_WRS
141 int treePiecesDoneInitInstrumentation;
174 void startLocalWalk();
175 void resumeRemoteChunk();
177 void donePrefetch(
int chunk);
178 void serializeLocalTree();
180 #ifdef GPU_LOCAL_TREE_WALK
181 void transformLocalTreeRecursive(GenericTreeNode *node, CkVec<CudaMultipoleMoments>& localMoments);
182 #endif //GPU_LOCAL_TREE_WALK
185 PendingBuffers *serializeRemoteChunk(GenericTreeNode *);
186 void serializeLocal(GenericTreeNode *);
187 void freeLocalTreeMemory();
188 void freeRemoteChunkMemory(
int chunk);
189 void transferParticleVarsBack();
190 void updateParticles(UpdateParticlesStruct *data);
191 void updateParticlesFreeMemory(UpdateParticlesStruct *data);
192 void initiateNextChunkTransfer();
193 #ifdef HAPI_INSTRUMENT_WRS
194 int initInstrumentation();
198 void clearInstrument(CkCallback
const& cb);
206 for (
unsigned int i = 0; i <
nodeTable.length(); i++) {
219 const CkCallback& cb);
228 void acceptFinalKeys(
const SFC::Key* keys,
const int* responsible, uint64_t* bins,
const int n,
const CkCallback& cb);
229 void pup(PUP::er& p);
237 std::map<NodeKey, int> &getCachedPartsOnGpuTable(){
238 return cachedPartsOnGpu;
255 void getChunks(
int &num, Tree::NodeKey *&roots);
262 void initCooling(
double dGmPerCcUnit,
double dComovingGmPerCcUnit,
263 double dErgPerGmUnit,
double dSecUnit,
double dKpcUnit,
264 COOLPARAM inParam,
const CkCallback& cb);
265 void initStarLog(std::string _fileName,
const CkCallback &cb);
266 void dmCoolTableRead(
double *dTableData,
int nData,
const CkCallback& cb);
267 void CoolingSetTime(
double z,
269 const CkCallback& cb);
270 void SetStarCM(
double dCenterOfMass[4],
const CkCallback& cb);
271 void memoryStats(
const CkCallback& cb);
272 void resetReadOnly(
Parameters param,
const CkCallback &cb);
278 inline static void setBIconfig()
280 #if CHARM_VERSION > 60401 && CMK_BALANCED_INJECTION_API
282 #define GNI_BI_DEFAULT 64
283 uint16_t cur_bi = ck_get_GNI_BIConfig();
284 if (cur_bi > GNI_BI_DEFAULT) {
285 ck_set_GNI_BIConfig(GNI_BI_DEFAULT);
289 CkPrintf(
"Balanced injection is set to %d.\n", ck_get_GNI_BIConfig());
303 #ifndef LB_MANAGER_VERSION
312 #ifndef LB_MANAGER_VERSION
319 void on(CkCallback cb) {
321 CkPrintf(
"\n\n**** PROJECTIONS ON *****\n\n");
327 void off(CkCallback cb) {
329 CkPrintf(
"\n\n**** PROJECTIONS OFF *****\n\n");
335 void pup(PUP::er &p){
336 CBase_ProjectionsControl::pup(p);
340 #endif //DATAMANAGER_H
std::vector< int > particleCounts
An array with how many particles are held by each TreePiece when sorted.
Definition: DataManager.h:76
CkVec< GenericTreeNode * > nodeTable
Definition: DataManager.h:148
void SetStarCM(double dCenterOfMass[4], const CkCallback &cb)
DataManager::SetStarCM saves the total mass and center of mass of the star(s) to the COOL struct Cool...
Definition: Sph.cpp:281
void getChunks(int &num, Tree::NodeKey *&roots)
return the number of chunks and the roots of the remote walk subtrees.
Definition: DataManager.cpp:421
Information about TreePieces on an SMP node.
Definition: DataManager.h:22
void clearRegisteredPieces(const CkCallback &cb)
Clear registeredTreePieces on this node.
Definition: DataManager.cpp:162
void acceptResponsibleIndex(const int *responsible, const int n, const CkCallback &cb)
Definition: DataManager.cpp:66
static Tree::GenericTreeNode * pickNodeFromMergeList(int n, GenericTreeNode **gtn, int &nUnresolved, int &pickedIndex)
Pick a node out of equivalent nodes on different TreePieces. If one of the nodes is internal to a Tre...
Definition: DataManager.cpp:269
Hold parameters of the run.
Definition: parameters.h:14
void combineLocalTrees(CkReductionMsg *msg)
Build a local tree inside the node.
Definition: DataManager.cpp:175
Version of MultipoleMoments using cudatype.
Definition: cuda_typedef.h:95
CkVec< TreePieceDescriptor > registeredTreePieces
A list of roots of the TreePieces in this node.
Definition: DataManager.h:80
StarLog * starLog
log of star formation events.
Definition: DataManager.h:167
Definition: DataManager.h:60
int oldNumChunks
Number of chunks in which the tree was splitted during last combine operation.
Definition: DataManager.h:151
std::vector< SFC::Key > boundaryKeys
The array of splitter keys for the sort.
Definition: DataManager.h:70
Particle data that gets calculated by the GPU.
Definition: cuda_typedef.h:259
Base class for tree nodes.
Definition: GenericTreeNode.h:59
void initCooling(double dGmPerCcUnit, double dComovingGmPerCcUnit, double dErgPerGmUnit, double dSecUnit, double dKpcUnit, COOLPARAM inParam, const CkCallback &cb)
Definition: Sph.cpp:136
Particle data needed on the GPU to calculate gravity.
Definition: cuda_typedef.h:231
Fundamental structure that holds particle and tree data.
Definition: ParallelGravity.h:730
void acceptFinalKeys(const SFC::Key *keys, const int *responsible, uint64_t *bins, const int n, const CkCallback &cb)
Definition: DataManager.cpp:73
Heating/Cooling context: parameters and tables.
Definition: cooling_boley.h:83
std::vector< int > responsibleIndex
An array identifying which chare is responsible for each interval of keys.
Definition: DataManager.h:73
Tree::GenericTreeNode * root
The root of the combined trees.
Definition: DataManager.h:145
Tree::NodeLookupType chunkRootTable
Lookup table for the chunkRoots.
Definition: DataManager.h:155
Tree::NodeKey * chunkRoots
Nodes currently used as roots for remote computation.
Definition: DataManager.h:153
void notifyPresence(Tree::GenericTreeNode *root, TreePiece *treePiece)
Collect roots of treepieces on this node.
Definition: DataManager.cpp:148
Log of star formation events to be written out to a file.
Definition: starform.h:129
Control recording of Charm++ projections logs.
Definition: DataManager.h:298
CmiNodeLock lockStarLog
Lock for accessing starlog from TreePieces.
Definition: DataManager.h:169