| 1707 | |
| 1708 | namespace { |
| 1709 | Vector<Long> |
| 1710 | gather_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 | |
| 1731 | DistributionMapping |
no test coverage detected