seapodym-parallel
Fish dynamics models with parameter estimations
Loading...
Searching...
No Matches
TaskScore.h
1#include <mpi.h>
2#include <vector>
3#include <set>
4
5#ifndef TASK_SCORE
6#define TASK_SCORE
7
12
13class TaskScore {
14
15 private:
16
17 // Communicator
18 MPI_Comm comm;
19
20 // number of tasks
21 int numTasks;
22
23 // local MPI rank
24 int me;
25
26 // scoreboard
27 std::vector<int> status;
28
29 // the MPI window to receive the score updates from remote processses
30 MPI_Win win;
31
32 public:
33
34 enum Status {
35 PENDING = -1,
36 RUNNING = -2,
37 SUCCEEDED = -3,
38 FAILED = -4,
39 };
40
41
47 TaskScore(MPI_Comm comm, int numTasks);
48
55 void store(int taskId, int status);
56
61 void print() const;
62
66 void free() {
67 if (this->win != MPI_WIN_NULL) {
68 MPI_Win_free(&this->win);
69 }
70 }
71
76 this->free();
77 }
78
84 std::set<int> get(int status) const;
85
86};
87
88#endif // TASK_SCORE
void store(int taskId, int status)
Definition TaskScore.cpp:23
void print() const
Definition TaskScore.cpp:35
std::set< int > get(int status) const
Definition TaskScore.cpp:50
~TaskScore()
Definition TaskScore.h:75
TaskScore(MPI_Comm comm, int numTasks)
Definition TaskScore.cpp:5
void free()
Definition TaskScore.h:66