Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove REDUCTION_HELPER macro #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ defines := $(strip @HEXADECAPOLE@ @FLAG_RTFORCE@ @FLAG_ARCH@ \
@FLAG_VSIGVISC@ @FLAG_DAMPING@ @FLAG_DIFFHARMONIC@ \
@FLAG_TREE_BUILD@ $(debug_defines) @FLAG_INTERLIST@ \
@FLAG_NSMOOTHINNER@ @FLAG_SPLITGAS@ @FLAG_SIDMINTERACT@ \
@FLAG_SUPERBUBBLE@ $(cuda_defines) -DREDUCTION_HELPER)
@FLAG_SUPERBUBBLE@ $(cuda_defines))

modules := $(strip -language charm++ -balancer @DEFAULT_LB@ \
$(foreach m,$(charm_modules),-module $(m)) \
Expand Down
4 changes: 0 additions & 4 deletions ParallelGravity.ci
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ mainmodule ParallelGravity {
readonly CProxy_Main mainChare;
readonly int verbosity;
readonly CProxy_TreePiece treeProxy;
#ifdef REDUCTION_HELPER
readonly CProxy_ReductionHelper reductionHelperProxy;
#endif
readonly CProxy_LvArray lvProxy;
readonly CProxy_LvArray smoothProxy;
readonly CProxy_LvArray gravityProxy;
Expand Down Expand Up @@ -203,15 +201,13 @@ mainmodule ParallelGravity {
entry [notrace] void off(CkCallback);
};

#ifdef REDUCTION_HELPER
group [migratable] ReductionHelper {
entry ReductionHelper();
entry void countTreePieces(const CkCallback &cb);
entry [nokeep] void evaluateBoundaries(SFC::Key keys[n], const int n, int isRefine, const CkCallback& cb);

entry void evaluateBoundaries(const CkBitVector &binsToSplit, const CkCallback& cb);
};
#endif

chare [migratable] Sorter {
entry Sorter();
Expand Down
4 changes: 0 additions & 4 deletions ParallelGravity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ CProxy_Main mainChare;
int verbosity;
int bVDetails;
CProxy_TreePiece treeProxy; ///< Proxy for the TreePiece chare array
#ifdef REDUCTION_HELPER
CProxy_ReductionHelper reductionHelperProxy;
#endif
CProxy_LvArray lvProxy; ///< Proxy for the liveViz array
CProxy_LvArray smoothProxy; ///< Proxy for smooth reductions
CProxy_LvArray gravityProxy; ///< Proxy for gravity reductions
Expand Down Expand Up @@ -1337,9 +1335,7 @@ Main::Main(CkArgMsg* m) {
prjgrp = CProxy_ProjectionsControl::ckNew();

treeProxy = pieces;
#ifdef REDUCTION_HELPER
reductionHelperProxy = CProxy_ReductionHelper::ckNew();
#endif
opts.bindTo(treeProxy);
lvProxy = CProxy_LvArray::ckNew(opts);
// Create an array for the smooth reductions
Expand Down
9 changes: 2 additions & 7 deletions ParallelGravity.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ extern double dGlassDamper;
extern int bUseCkLoopPar;
extern GenericTrees useTree;
extern CProxy_TreePiece treeProxy;
#ifdef REDUCTION_HELPER
extern CProxy_ReductionHelper reductionHelperProxy;
#endif
extern CProxy_LvArray lvProxy; // Proxy for the liveViz array
extern CProxy_LvArray smoothProxy; // Proxy for smooth reduction
extern CProxy_LvArray gravityProxy; // Proxy for gravity reduction
Expand Down Expand Up @@ -1148,10 +1146,9 @@ class TreePiece : public CBase_TreePiece {

/// The counts of how many particles belonging to other
/// TreePieces I currently hold
#ifndef REDUCTION_HELPER
CkVec<int64_t> myBinCounts;
#endif
std::vector<int> myBinCountsORB;

/// My index in the responsibility array.
int myPlace;
/// The keys determined by the Sorter that separate me from my
Expand Down Expand Up @@ -2055,8 +2052,6 @@ bool bIsReplica(int reqID);
void printGenericTree(GenericTreeNode* node, std::ostream& os) ;
//bool compBucket(GenericTreeNode *ln,GenericTreeNode *rn);

#ifdef REDUCTION_HELPER

class TreePieceCounter : public CkLocIterator {
public:
TreePieceCounter() { reset(); }
Expand Down Expand Up @@ -2091,7 +2086,7 @@ class ReductionHelper : public CBase_ReductionHelper {
TreePieceCounter localTreePieces;
std::vector<SFC::Key> splitters;
};
#endif


/// @brief Used to count non-empty treepieces on the local processor.
class NonEmptyTreePieceCounter : public CkLocIterator {
Expand Down
14 changes: 1 addition & 13 deletions Sorter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,9 @@ void Sorter::startSorting(const CkGroupID& dataManagerID,
Key k;
BinaryTreeNode *rt;

#ifdef REDUCTION_HELPER
// The reduction helper needs to know the number of pieces on each processor.
reductionHelperProxy.countTreePieces(CkCallbackResumeThread());
CProxy_ReductionHelper boundariesTargetProxy = reductionHelperProxy;
#else
CProxy_TreePiece boundariesTargetProxy = treeProxy;
#endif

decompTime = CmiWallTimer();

Expand Down Expand Up @@ -542,12 +538,9 @@ void Sorter::collectEvaluationsOct(CkReductionMsg* m) {
int arraySize = (1<<refineLevel)+1;
startTimer = CmiWallTimer();
Key *array = convertNodesToSplittersRefine(nodesOpened.size(),nodesOpened.getVec());

//CkPrintf("convertNodesToSplittersRefine elts %d took %g s\n", nodesOpened.size()*arraySize, CmiWallTimer()-startTimer);
#ifdef REDUCTION_HELPER
CProxy_ReductionHelper boundariesTargetProxy = reductionHelperProxy;
#else
CProxy_TreePiece boundariesTargetProxy = treeProxy;
#endif
boundariesTargetProxy.evaluateBoundaries(array, nodesOpened.size()*arraySize, 1<<refineLevel, CkCallback(CkIndex_Sorter::collectEvaluations(0), thishandle));
delete[] array;
}
Expand Down Expand Up @@ -883,13 +876,8 @@ void Sorter::collectEvaluationsSFC(CkReductionMsg* m) {

} else {
//send out the new guesses to be evaluated
#ifdef REDUCTION_HELPER
CProxy_ReductionHelper boundariesTargetProxy = reductionHelperProxy;
boundariesTargetProxy.evaluateBoundaries(binsToSplit, CkCallback(CkIndex_Sorter::collectEvaluations(0), thishandle));
#else
CProxy_TreePiece boundariesTargetProxy = treeProxy;
boundariesTargetProxy.evaluateBoundaries(&splitters[0], splitters.size(), 0, CkCallback(CkIndex_Sorter::collectEvaluations(0), thishandle));
#endif
}

}
Expand Down
20 changes: 1 addition & 19 deletions TreePiece.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,6 @@ void TreePiece::evaluateParticleCounts(ORBSplittersMsg *splittersMsg)
delete splittersMsg;
}

#ifdef REDUCTION_HELPER
void ReductionHelper::evaluateBoundaries(SFC::Key* keys, const int n, int skipEvery, const CkCallback& cb){
splitters.assign(keys, keys + n);
if(localTreePieces.presentTreePieces.size() == 0){
Expand Down Expand Up @@ -578,7 +577,6 @@ void ReductionHelper::evaluateBoundaries(const CkBitVector &binsToSplit, const C
evaluateBoundaries(&newSplitters[0], newSplitters.size(), 0, cb);
}

#endif

/// Determine my part of the sorting histograms by counting the number
/// of my particles in each bin.
Expand All @@ -597,16 +595,7 @@ void TreePiece::evaluateBoundaries(SFC::Key* keys, const int n, int skipEvery, c
int numBins = skipEvery ? n - (n-1)/(skipEvery+1) - 1 : n - 1;

//this array will contain the number of particles I own in each bin
int64_t *myCounts;

#ifdef REDUCTION_HELPER
myCounts = new int64_t[numBins];
#else
//myBinCounts.assign(numBins, 0);
myBinCounts.resize(numBins);
myCounts = myBinCounts.getVec();
#endif

int64_t *myCounts = new int64_t[numBins];
memset(myCounts, 0, numBins*sizeof(int64_t));

if (myNumParticles > 0) {
Expand Down Expand Up @@ -686,12 +675,8 @@ void TreePiece::evaluateBoundaries(SFC::Key* keys, const int n, int skipEvery, c
}

//send my bin counts back in a reduction
#ifdef REDUCTION_HELPER
reductionHelperProxy.ckLocalBranch()->reduceBinCounts(numBins, myCounts, cb);
delete[] myCounts;
#else
contribute(numBins * sizeof(int64_t), myCounts, CkReduction::sum_long, cb);
#endif
}

void TreePiece::unshuffleParticlesWoDD(const CkCallback& callback) {
Expand Down Expand Up @@ -6640,7 +6625,6 @@ void TreePiece::clearMarkedBucketsAll(){

#endif

#ifdef REDUCTION_HELPER
ReductionHelper::ReductionHelper(){
}

Expand Down Expand Up @@ -6705,6 +6689,4 @@ void ReductionHelper::senseLocalTreePieces(){
mgr->iterate(localTreePieces);
}

#endif