← Documentation
ADS-IDAC Engine 5.0.0
ParallelExecution.h
Go to the documentation of this file.
1
4
5#pragma once
6#ifdef ENABLE_MPI
7#include <mpi.h>
8#include <iostream>
9#include <stdio.h>
10#include <stdlib.h>
11#include <chrono>
12#include <thread>
13#include <string>
14#include <vector>
15#include <filesystem>
16#include "ParallelUtilities.h"
17#include "ParallelGlobal.h"
18#include "Server.h"
19#include "Client.h"
20
21#include "../System/SystemModule.h"
22#include "../ControlPanel/ControlPanel.h"
23#include "../Scheduler/InitiatingEventController.h"
24#include "../Procedure/Procedures.h"
25#include "../Global/RestartNodeInfo.h"
26#include "../Branch/BranchRecord.h"
27#include <sstream>
28#include <iostream>
29#include <boost/archive/text_oarchive.hpp>
30#include <boost/archive/text_iarchive.hpp>
31#include <boost/archive/binary_oarchive.hpp>
32#include <boost/archive/binary_iarchive.hpp>
33
36extern Client* g_client;
37
40
41using PU = ParallelUtilities;
42
43typedef double parameters;
44
52class parallelexec {
53public:
54 int argc;
55 char **argv;
56 MPI_Status statusServer;
57 MPI_Status statusClient;
58 BranchEndState *es_pt;
59 std::string str, time_begin, time_end;
60 time_t t_current;
61 RestartNodeInfo *restart_from_intfc;
62
63 parallelexec();
64
66 void parallel_init(int *argc, char **argv[]);
67
69 void parallel_final();
70
71 int ReceiveDonePacket();
72 RestartNodeInfo *NewReceiveNumberOfBranches();
73 void Start_Simulation();
74 void Branch_Sequence(int i);
75 void Simulate_Sequence();
76
78 void Setup_Directories();
79
81 template <typename T>
82 static void saveToFile(const T& object, const std::string& filePath);
83
85 template <typename T>
86 static void loadFromFile(T& object, const std::string& filePath);
87
89 template <typename T>
90 static void send_object(const T& obj, int dest_rank, int tag, MPI_Comm comm);
91
93 template <typename T>
94 static void receive_object(T& obj, int src_rank, int tag, MPI_Comm comm);
95};
96#endif // ENABLE_MPI
MPI client (rank > 0): executes simulation sequences.
ParallelUtilities PU
Definition: Client.h:35
void set_global_client(Client *c)
Client * g_client
Shared declarations for MPI parallel execution: message tags, utilities, Fortran callbacks.
Static MPI utility functions — colored logging, Boost object serialization over MPI.
MPI server (rank 0): dispatches DET sequences to worker clients.
The end state (ES node) that terminates one sequence of the DET.
MPI worker client that executes simulation sequences.
Definition: Client.h:42