Fenix @develop
 
Loading...
Searching...
No Matches
policy_local.hpp
1#ifndef FENIX_DATA_POLICY_LOCAL_HPP
2#define FENIX_DATA_POLICY_LOCAL_HPP
3
4#include <mpi.h>
5#include <deque>
6#include <algorithm>
7#include <string>
8#include <vector>
9#include "fenix/data/group.hpp"
10#include "fenix/data/member.hpp"
11#include "fenix/data/subset.hpp"
12
13namespace fenix::data::local {
14
15struct LocalGroup : public DataGroup {
16 LocalGroup(int id, MPI_Comm c, int ts, int depth)
17 : DataGroup(id, c, ts, depth, FENIX_DATA_POLICY_LOCAL) {}
18
19 MPI_Group create_cohort() override {
20 MPI_Group comm_group;
21 MPI_Comm_group(comm, &comm_group);
22 int rank;
23 MPI_Comm_rank(comm, &rank);
24 MPI_Group cohort_group;
25 MPI_Group_incl(comm_group, 1, &rank, &cohort_group);
26 MPI_Group_free(&comm_group);
27 return cohort_group;
28 }
29
30 void get_redundant_policy(int* name, void* value) override {
31 *name = FENIX_DATA_POLICY_LOCAL;
32 }
33
34 void member_restore_from_rank(
35 int member_id, void* buffer, int max, int timestamp, int source_rank
36 ) override {
37 fenix_require(false, "unimplemented");
38 }
39};
40
41} // namespace fenix::data::local
42
43#endif //FENIX_DATA_POLICY_LOCAL_HPP
Definition group.hpp:78
Definition policy_local.hpp:15