| 856 | } |
| 857 | |
| 858 | void |
| 859 | DistributionMapping::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 | |
| 885 | void |
| 886 | DistributionMapping::KnapSackProcessorMap (const DistributionMapping& olddm, |