Skip to content

Commit

Permalink
DistributionMapping::makeSFC - distribute to user-defined procs
Browse files Browse the repository at this point in the history
Extends the makeSFC method to take an additional argument where the user
can override the number of processes a BoxArray is distributed to.
  • Loading branch information
sayerhs committed Jun 1, 2020
1 parent 227bf82 commit 4c7f247
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Src/Base/AMReX_DistributionMapping.H
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,9 @@ class DistributionMapping
* if use_box_vol is true, weight boxes by their volume in Distribute
* otherwise, all boxes will be treated with equal weight
*/
static std::vector<std::vector<int> > makeSFC (const BoxArray& ba, bool use_box_vol=true);
static std::vector<std::vector<int> > makeSFC (const BoxArray& ba,
bool use_box_vol=true
const int nprocs=ParallelContext::NProcsSub() );

/** \brief Computes the average cost per MPI rank given a distribution mapping
* global cost vector.
Expand Down
3 changes: 1 addition & 2 deletions Src/Base/AMReX_DistributionMapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1818,7 +1818,7 @@ DistributionMapping::makeSFC (const LayoutData<Real>& rcost_local,
}

std::vector<std::vector<int> >
DistributionMapping::makeSFC (const BoxArray& ba, bool use_box_vol)
DistributionMapping::makeSFC (const BoxArray& ba, bool use_box_vol, const int nprocs)
{
BL_PROFILE("makeSFC");

Expand Down Expand Up @@ -1857,7 +1857,6 @@ DistributionMapping::makeSFC (const BoxArray& ba, bool use_box_vol)
//
std::sort(tokens.begin(), tokens.end(), SFCToken::Compare());

const int nprocs = ParallelContext::NProcsSub();
Real volper;
volper = vol_sum / nprocs;

Expand Down

0 comments on commit 4c7f247

Please sign in to comment.