Pakman
MPIWorkerHandler.h
1 #ifndef MPIWORKERHANDLER_H
2 #define MPIWORKERHANDLER_H
3 
4 #include <string>
5 
6 #include <mpi.h>
7 
8 #include "AbstractWorkerHandler.h"
9 
24 {
25 
26  public:
27 
45  MPIWorkerHandler(const Command& simulator, const std::string&
46  input_string);
47 
57  virtual ~MPIWorkerHandler() override;
58 
64  virtual bool isDone() override;
65 
72  static void terminateStatic();
73 
74  private:
75 
76  // Receive message from Worker
77  std::string receiveMessage() const;
78 
79  // Receive error code from Worker
80  int receiveErrorCode() const;
81 
82  // Discard results from MPI process
83  void discardResults();
84 
85  // Intercomm with child
86  // This intercommunicator is static so that it survives across multiple
87  // instances of MPIWorkerHandler
88  static MPI_Comm s_child_comm;
89 
90  // Flag for receiving result
91  bool m_result_received = false;
92 };
93 
94 #endif // MPIWORKERHANDLER_H
static void terminateStatic()
virtual ~MPIWorkerHandler() override
virtual bool isDone() override
MPIWorkerHandler(const Command &simulator, const std::string &input_string)