MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / KnapSackProcessorMap

Method KnapSackProcessorMap

Src/Base/AMReX_DistributionMapping.cpp:858–883  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

856}
857
858void
859DistributionMapping::KnapSackProcessorMap (const std::vector<Long>& wgts,
860 int nprocs,
861 Real* efficiency,
862 bool do_full_knapsack,
863 int nmax,
864 bool sort)
865{
866 BL_ASSERT( ! wgts.empty());
867
868 m_ref->clear();
869 m_ref->m_pmap.resize(wgts.size());
870
871 if (std::ssize(wgts) <= nprocs || nprocs < 2)
872 {
873 RoundRobinProcessorMap(static_cast<int>(wgts.size()),nprocs, sort);
874
875 if (efficiency) { *efficiency = 1; }
876 }
877 else
878 {
879 Real eff = 0;
880 KnapSackDoIt(wgts, nprocs, eff, do_full_knapsack, nmax, sort);
881 if (efficiency) { *efficiency = eff; }
882 }
883}
884
885void
886DistributionMapping::KnapSackProcessorMap (const DistributionMapping& olddm,

Callers 2

makeKnapSackMethod · 0.80

Calls 15

lower_boundFunction · 0.85
rotateFunction · 0.85
topMethod · 0.80
rankMethod · 0.80
addWeightMethod · 0.80
boxidMethod · 0.80
NProcsFunction · 0.70
emptyMethod · 0.45
clearMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected