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

Function gather_weights

Src/Base/AMReX_DistributionMapping.cpp:1709–1728  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1707
1708namespace {
1709Vector<Long>
1710gather_weights (const MultiFab& weight)
1711{
1712#ifdef AMREX_USE_MPI
1713 LayoutData<Real> costld(weight.boxArray(),weight.DistributionMap());
1714#ifdef AMREX_USE_OMP
1715#pragma omp parallel if (Gpu::notInLaunchRegion())
1716#endif
1717 for (MFIter mfi(weight); mfi.isValid(); ++mfi) {
1718 costld[mfi] = weight[mfi].sum<RunOn::Device>(mfi.validbox(),0);
1719 }
1720 Vector<Real> rcost(weight.size());
1721 ParallelDescriptor::GatherLayoutDataToVector(costld, rcost,
1722 ParallelContext::IOProcessorNumberSub());
1723 ParallelDescriptor::Bcast(rcost.data(), rcost.size(), ParallelContext::IOProcessorNumberSub());
1724 return DistributionMapping::ConvertCostRealToLong(rcost);
1725#else
1726 return Vector<Long>(weight.size(), 1L);
1727#endif
1728}
1729}
1730
1731DistributionMapping

Callers 3

makeKnapSackMethod · 0.85
makeRoundRobinMethod · 0.85
makeSFCMethod · 0.85

Calls 9

GatherLayoutDataToVectorFunction · 0.85
IOProcessorNumberSubFunction · 0.85
DistributionMapMethod · 0.80
BcastFunction · 0.70
boxArrayMethod · 0.45
isValidMethod · 0.45
validboxMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected