Skip to content

Commit

Permalink
SFC load balancer sfcPartition(): stop when we run out of TreePieces.
Browse files Browse the repository at this point in the history
  • Loading branch information
trquinn committed Jul 17, 2024
1 parent 505663e commit ec82526
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions MultistepLB_SFC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ void MultistepLB_SFC::sfcPartition(int nProcs, vector<SFCObject> & tp,

double loadPrev = 0.0; // load on all lower processors
int iCurrPiece = 0; // Piece under consideration
for (int iProc = 0; iProc < nProcs; iProc++) {
const int nPieces = tp.size();
for (int iProc = 0; iProc < nProcs && iCurrPiece < nPieces; iProc++) {
if (!stats->procs[iProc].available)
continue;
// always assign one piece to a processor
Expand All @@ -248,8 +249,11 @@ void MultistepLB_SFC::sfcPartition(int nProcs, vector<SFCObject> & tp,

while ((nCurrPiece < maxPieceProc)
&& fabs(tp[iCurrPiece].load + loadPrev + loadCurr - loadTarget)
< dLoadError) { // add pieces to this processor to get
// the closest to the target load
< dLoadError
&& iCurrPiece < nPieces) { // add pieces to this
// processor to get the
// closest to the target
// load
oSFC = tp[iCurrPiece];
loadCurr += oSFC.load;
(*mapping)[oSFC.lbindex] = iProc;
Expand Down

0 comments on commit ec82526

Please sign in to comment.