GPRidge v1.0.0
GPR-accelerated saddle point searches on potential energy surfaces
☾
Toggle main menu visibility
Loading...
Searching...
No Matches
MpiCommunicator.cpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
// Copyright (c) gpridge developers
3
4
#include "
MpiCommunicator.h
"
5
6
#include <stdexcept>
7
8
namespace
gpr::linalg
{
9
10
MpiCommunicator::MpiCommunicator
(
MpiCommType
source)
11
{
12
#if defined(GPR_HAVE_MPI) || defined(GPR_LINALG_SCALAPACK)
13
if
(source == MPI_COMM_NULL)
14
throw
std::invalid_argument(
"cannot own a null MPI communicator"
);
15
view_ = MpiContext::fromCommunicator(source);
16
if
(MPI_Comm_dup(source, &view_.comm) != MPI_SUCCESS)
17
throw
std::runtime_error(
"could not duplicate MPI communicator"
);
18
#else
19
(void)source;
20
throw
std::logic_error(
"MPI communicator requires an MPI build"
);
21
#endif
22
}
23
24
MpiCommunicator::~MpiCommunicator
()
25
{
26
#if defined(GPR_HAVE_MPI) || defined(GPR_LINALG_SCALAPACK)
27
int
finalized = 0;
28
MPI_Finalized(&finalized);
29
if
(!finalized && view_.comm != MPI_COMM_NULL) MPI_Comm_free(&view_.comm);
30
#endif
31
}
32
33
}
// namespace gpr::linalg
MpiCommunicator.h
gpr::linalg::MpiCommunicator::MpiCommunicator
MpiCommunicator(MpiCommType source)
Definition
MpiCommunicator.cpp:10
gpr::linalg::MpiCommunicator::~MpiCommunicator
~MpiCommunicator()
Definition
MpiCommunicator.cpp:24
gpr::linalg
Dense and structured linear algebra behind the GP: Cholesky and eigen solvers, linear operators,...
Definition
ConditionedKernel.h:14
gpr::linalg::MpiCommType
int MpiCommType
Definition
MpiContext.h:55
gpr
linalg
MpiCommunicator.cpp
Generated by
1.17.0
Generated by
Doxygen 1.17.0
Analytics by
Antics
provided by
TurtleTech ehf