ReservoirCouplingSpawnSlaves.hpp
Go to the documentation of this file.
1/*
2 Copyright 2024 Equinor ASA
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef OPM_RESERVOIR_COUPLING_SPAWN_SLAVES_HPP
21#define OPM_RESERVOIR_COUPLING_SPAWN_SLAVES_HPP
22
26
27#include <opm/input/eclipse/Schedule/ResCoup/ReservoirCouplingInfo.hpp>
28#include <opm/input/eclipse/Schedule/Schedule.hpp>
29#include <opm/common/OpmLog/OpmLog.hpp>
30
31#include <mpi.h>
32
33#include <filesystem>
34#include <vector>
35
36namespace Opm {
37
38template <class Scalar>
40public:
42
45 const ReservoirCoupling::CouplingInfo &rescoup
46 );
47
48 void spawn();
49
50private:
51 void createMasterGroupNameOrder_();
52 void createMasterGroupToSlaveNameMap_();
53 void createSlaveNameToMasterGroupsMap_();
54 std::pair<std::vector<char>, std::size_t>
55 getMasterGroupNamesForSlave_(std::size_t slave_idx) const;
56 std::vector<char *> getSlaveArgv_(
57 const std::filesystem::path &data_file,
58 const std::string &slave_name,
59 std::string &log_filename) const;
60 void receiveActivationDateFromSlaves_();
61 void receiveSimulationStartDateFromSlaves_();
69 void receiveSlaveStatus_();
70 void sendMasterGroupNamesToSlaves_();
71 void sendSlaveNamesToSlaves_();
72 void spawnSlaveProcesses_();
73 ReservoirCoupling::Logger& logger() { return this->logger_; }
74 ReservoirCoupling::Logger& logger() const { return this->logger_; }
75
76 ReservoirCouplingMaster<Scalar> &master_;
77 const ReservoirCoupling::CouplingInfo &rescoup_;
78 const Parallel::Communication &comm_;
79 mutable ReservoirCoupling::Logger logger_;
80};
81
82} // namespace Opm
83#endif // OPM_RESERVOIR_COUPLING_SPAWN_SLAVES_HPP
Definition: ReservoirCoupling.hpp:42
Definition: ReservoirCouplingMaster.hpp:38
Definition: ReservoirCouplingSpawnSlaves.hpp:39
ReservoirCouplingSpawnSlaves(ReservoirCouplingMaster< Scalar > &master, const ReservoirCoupling::CouplingInfo &rescoup)
Dune::Communication< MPIComm > Communication
Definition: ParallelCommunication.hpp:30
MessageTag
Definition: ReservoirCoupling.hpp:138
Definition: blackoilbioeffectsmodules.hh:45