ARTS 2.5.9 (git: 825fa5f2)
oem_mpi.h
Go to the documentation of this file.
1
8#endif _ARTS_OEM_MPI_H_
9
10#include "invlib/algebra.h"
11#include "invlib/algebra/precision_matrix.h"
12#include "invlib/algebra/solvers.h"
13#include "invlib/interfaces/arts_wrapper.h"
14#include "invlib/map.h"
15#include "invlib/mpi/log.h"
16#include "invlib/mpi/mpi_matrix.h"
17#include "invlib/mpi/mpi_vector.h"
18#include "invlib/optimization.h"
19#include "invlib/profiling/timer.h"
20
21namespace oem {
22
24using MPIMatrix = invlib::Matrix<invlib::MPIMatrix<invlib::Timer<ArtsMatrix>>>;
26using MPICovarianceMatrix = invlib::Matrix<
27 invlib::MPIMatrix<invlib::Timer<ArtsCovarianceMatrixWrapper>>>;
29using MPIVector = invlib::Vector<invlib::MPIVector<invlib::Timer<ArtsVector>>>;
30
37template <typename ForwardModel>
38using OEM_STANDARD_MPI = invlib::MAP<ForwardModel,
39 OEMMatrix,
42 OEMVector,
43 Formulation::STANDARD>;
44
46using LM_MPI = invlib::LevenbergMarquardt<Numeric, MPISparse, CG>;
47
57
58 public:
59 const unsigned int m, n;
60
62 const Agenda *inversion_iterate_agenda,
63 Index m_,
64 Index n_)
65 : ws_(ws),
67 inversion_iterate_agenda_(inversion_iterate_agenda),
68 m(static_cast<unsigned int>(m_)),
69 n(static_cast<unsigned int>(n_)) {}
70
77 MPIMatrix Jacobian(const OEMVector &xi, OEMVector &yi) {
78 yi.resize(m);
81 // Create MPI vector from local results, use conversion to vector
82 // to broadcast local results.
83 MPIVector yi_mpi(yi);
84 yi = yi_mpi;
85
86 MPIMatrix jacobian = local_jacobian_;
87 return jacobian;
88 }
89
98 OEMVector evaluate(const OEMVector &xi) {
99 Matrix dummy = local_jacobian_;
100 OEMVector yi;
101 yi.resize(m);
103 *ws_, yi, dummy, xi, 0, *inversion_iterate_agenda_);
104
105 // Create MPI vector from local results, use conversion to vector
106 // to broadcast local results.
107 MPIVector yi_mpi = yi;
108 yi = yi_mpi;
109 return yi;
110 }
111
112 private:
119};
120} // namespace oem
121#endif // _ARTS_OEM_MPI_H_
void inversion_iterate_agendaExecute(Workspace &ws, Vector &yf, Matrix &jacobian, const Vector &x, const Index jacobian_do, const Index inversion_iteration_counter, const Agenda &input_agenda)
Definition: auto_md.cc:24902
The Agenda class.
Definition: agenda_class.h:69
The Matrix class.
Definition: matpackI.h:1285
Workspace class.
Definition: workspace_ng.h:53
Interface for distributed ARTS forward model.
Definition: oem_mpi.h:56
const unsigned int m
Definition: oem_mpi.h:59
OEMMatrix local_jacobian_
Process-local part of the Jacobian.
Definition: oem_mpi.h:116
Workspace * ws_
Pointer to current workspace.
Definition: oem_mpi.h:114
const unsigned int n
Definition: oem_mpi.h:59
const Agenda * inversion_iterate_agenda_
Pointer to the inversion_iterate_agenda defining the foward model.
Definition: oem_mpi.h:118
OEMVector evaluate(const OEMVector &xi)
Evaluate forward model.
Definition: oem_mpi.h:98
MPIMatrix Jacobian(const OEMVector &xi, OEMVector &yi)
Compute Jacobian of forward model.
Definition: oem_mpi.h:77
AgendaWrapperMPI(Workspace *ws_, const Agenda *inversion_iterate_agenda, Index m_, Index n_)
Definition: oem_mpi.h:61
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
Definition: oem.h:28
invlib::MAP< ForwardModel, OEMMatrix, MPICovarianceMatrix, MPICovarianceMatrix, OEMVector, Formulation::STANDARD > OEM_STANDARD_MPI
Distributed OEM standard form.
Definition: oem_mpi.h:43
invlib::LevenbergMarquardt< Numeric, MPISparse, CG > LM_MPI
Distributed Levenberg-Marquardt optimization.
Definition: oem_mpi.h:46
invlib::Matrix< invlib::MPIMatrix< invlib::Timer< ArtsCovarianceMatrixWrapper > > > MPICovarianceMatrix
MPI-distributed covariance matrix type.
Definition: oem_mpi.h:27
invlib::Vector< invlib::MPIVector< invlib::Timer< ArtsVector > > > MPIVector
MPI-distributed vector type.
Definition: oem_mpi.h:29
invlib::Matrix< invlib::MPIMatrix< invlib::Timer< ArtsMatrix > > > MPIMatrix
MPI-distributed matrix type based on ARTS built-in dense matrices.
Definition: oem_mpi.h:24