Commit f966a362 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Remove MultiBlock::GetGlobalNumberOfBlocks.

Removing another API that need not be on MultiBlock. There's generally
no need for apps to know this. If needed, we can add `...Compute`
function. This removes another API on MultiBlock that could trigger
parallel communication/synchronization.
parent f37e6425
......@@ -138,24 +138,6 @@ vtkm::Id MultiBlock::GetNumberOfBlocks() const
return static_cast<vtkm::Id>(this->Blocks.size());
}
VTKM_CONT
vtkm::Id MultiBlock::GetGlobalNumberOfBlocks() const
{
auto world = vtkm::cont::EnvironmentTracker::GetCommunicator();
const auto local_count = this->GetNumberOfBlocks();
diy::Master master(world, 1, -1);
int block_not_used = 1;
master.add(world.rank(), &block_not_used, new diy::Link());
// empty link since we're only using collectives.
master.foreach ([=](void*, const diy::Master::ProxyWithLink& cp) {
cp.all_reduce(local_count, std::plus<vtkm::Id>());
});
master.process_collectives();
vtkm::Id global_count = master.proxy(0).get<vtkm::Id>();
return global_count;
}
VTKM_CONT
const vtkm::cont::DataSet& MultiBlock::GetBlock(vtkm::Id blockId) const
{
......
......@@ -64,13 +64,6 @@ public:
VTKM_CONT
vtkm::Id GetNumberOfBlocks() const;
/// Returns the number of blocks across all ranks. For non-MPI builds, this
/// will be same as `GetNumberOfBlocks()`.
/// This method is not thread-safe and may involve global communication across
/// all ranks in distributed environments with MPI.
VTKM_CONT
vtkm::Id GetGlobalNumberOfBlocks() const;
VTKM_CONT
const vtkm::cont::DataSet& GetBlock(vtkm::Id blockId) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment