2017-12-14 01:30:04 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2017-12-14 01:30:04 +00:00
|
|
|
// 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>
|
|
|
|
|
2019-02-05 16:02:29 +00:00
|
|
|
#include <vtkm/thirdparty/diy/diy.h>
|
2018-01-03 19:37:54 +00:00
|
|
|
|
2020-06-08 20:57:51 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2017-12-14 01:30:04 +00:00
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace cont
|
|
|
|
{
|
|
|
|
namespace internal
|
|
|
|
{
|
2020-06-08 20:57:51 +00:00
|
|
|
static std::unique_ptr<vtkmdiy::mpi::communicator> GlobalCommuncator;
|
2017-12-14 01:30:04 +00:00
|
|
|
}
|
|
|
|
|
2019-02-05 16:02:29 +00:00
|
|
|
void EnvironmentTracker::SetCommunicator(const vtkmdiy::mpi::communicator& comm)
|
2017-12-14 01:30:04 +00:00
|
|
|
{
|
2020-06-08 20:57:51 +00:00
|
|
|
if (!internal::GlobalCommuncator)
|
|
|
|
{
|
|
|
|
internal::GlobalCommuncator.reset(new vtkmdiy::mpi::communicator(comm));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*internal::GlobalCommuncator = comm;
|
|
|
|
}
|
2017-12-14 01:30:04 +00:00
|
|
|
}
|
|
|
|
|
2019-02-05 16:02:29 +00:00
|
|
|
const vtkmdiy::mpi::communicator& EnvironmentTracker::GetCommunicator()
|
2017-12-14 01:30:04 +00:00
|
|
|
{
|
2020-06-08 20:57:51 +00:00
|
|
|
if (!internal::GlobalCommuncator)
|
2018-04-02 19:55:11 +00:00
|
|
|
{
|
2020-06-08 20:57:51 +00:00
|
|
|
internal::GlobalCommuncator.reset(new vtkmdiy::mpi::communicator());
|
2018-04-02 19:55:11 +00:00
|
|
|
}
|
2020-06-08 20:57:51 +00:00
|
|
|
return *internal::GlobalCommuncator;
|
2017-12-14 01:30:04 +00:00
|
|
|
}
|
|
|
|
} // namespace vtkm::cont
|
|
|
|
} // namespace vtkm
|