ARTS  2.3.1285(git:92a29ea9-dirty)
agenda_wrapper_mpi.h
Go to the documentation of this file.
1 
10 #ifndef agenda_wrappers_mpi_h
11 #define agenda_wrappers_mpi_h
12 
13 #include "oem.h"
14 #include "oem_mpi.h"
15 #include "mpi.h"
16 
18 
24 {
26  OEMMatrix local_jacobian;
28 
29 public:
30 
31  const unsigned int m,n;
32 
34  Workspace *ws_,
35  const Agenda *inversion_iterate_agenda_,
36  Index m_, Index n_) :
37  ws(ws_), local_jacobian(),
38  inversion_iterate_agenda(inversion_iterate_agenda_),
39  m(static_cast<unsigned int>(m_)),
40  n(static_cast<unsigned int>(n_))
41  {}
42 
43  MPIMatrix Jacobian(const OEMVector &xi, OEMVector &yi)
44  {
45  yi.resize(m);
46  inversion_iterate_agendaExecute( *ws, yi, local_jacobian, xi,
47  1, *inversion_iterate_agenda );
48  // Create MPI vector from local results, use conversion to vector
49  // to broadcast local results.
50  MPIVector yi_mpi(yi);
51  yi = yi_mpi;
52 
53  MPIMatrix jacobian = local_jacobian;
54  return jacobian;
55  }
56 
57  OEMVector evaluate(const OEMVector &xi)
58  {
59  Matrix dummy = local_jacobian;
60  OEMVector yi; yi.resize(m);
61  inversion_iterate_agendaExecute( *ws, yi, dummy, xi, 0,
62  *inversion_iterate_agenda );
63 
64  // Create MPI vector from local results, use conversion to vector
65  // to broadcast local results.
66  MPIVector yi_mpi = yi;
67  yi = yi_mpi;
68  return yi;
69  }
70 };
71 
72 #endif // agenda_wrapper_mpi_h
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
The Agenda class.
Definition: agenda_class.h:44
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:23933
const unsigned int m
OEMVector evaluate(const OEMVector &xi)
const unsigned int n
Wrapper class for forward model using a distributed Jacobian with MPI.
MPIMatrix Jacobian(const OEMVector &xi, OEMVector &yi)
AgendaWrapperMPI(Workspace *ws_, const Agenda *inversion_iterate_agenda_, Index m_, Index n_)
The Matrix class.
Definition: matpackI.h:1193
Defines the ARTS interface to the invlib library.
const Agenda * inversion_iterate_agenda
Workspace class.
Definition: workspace_ng.h:40
Optimal estimation method for MPI-distributed retrieval.
invlib::Matrix< invlib::MPIMatrix< invlib::Timer< ArtsMatrix > >> MPIMatrix
MPI-distributed matrix type based on ARTS built-in dense matrices.
Definition: oem_mpi.h:24
invlib::Vector< invlib::MPIVector< invlib::Timer< ArtsVector > >> MPIVector
MPI-distributed vector type.
Definition: oem_mpi.h:29