mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-05 01:49:02 +00:00
934f085e09
Support both mpi and nompi versions simultaneously.
47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
//============================================================================
|
|
// Copyright (c) Kitware, Inc.
|
|
// All rights reserved.
|
|
// See LICENSE.txt for details.
|
|
//
|
|
// This software is distributed WITHOUT ANY WARRANTY; without even
|
|
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
// PURPOSE. See the above copyright notice for more information.
|
|
//============================================================================
|
|
#include <vtkm/cont/EnvironmentTracker.h>
|
|
|
|
#include <vtkm/thirdparty/diy/diy.h>
|
|
|
|
#include <memory>
|
|
|
|
namespace vtkm
|
|
{
|
|
namespace cont
|
|
{
|
|
namespace internal
|
|
{
|
|
static std::unique_ptr<vtkmdiy::mpi::communicator> GlobalCommuncator;
|
|
}
|
|
|
|
void EnvironmentTracker::SetCommunicator(const vtkmdiy::mpi::communicator& comm)
|
|
{
|
|
if (!internal::GlobalCommuncator)
|
|
{
|
|
internal::GlobalCommuncator.reset(new vtkmdiy::mpi::communicator(comm));
|
|
}
|
|
else
|
|
{
|
|
*internal::GlobalCommuncator = comm;
|
|
}
|
|
}
|
|
|
|
const vtkmdiy::mpi::communicator& EnvironmentTracker::GetCommunicator()
|
|
{
|
|
if (!internal::GlobalCommuncator)
|
|
{
|
|
internal::GlobalCommuncator.reset(new vtkmdiy::mpi::communicator());
|
|
}
|
|
return *internal::GlobalCommuncator;
|
|
}
|
|
} // namespace vtkm::cont
|
|
} // namespace vtkm
|