Fenix @develop
 
Loading...
Searching...
No Matches
fenix_data_group.hpp
1/*
2//@HEADER
3// ************************************************************************
4//
5//
6// _|_|_|_| _|_|_|_| _| _| _|_|_| _| _|
7// _| _| _|_| _| _| _| _|
8// _|_|_| _|_|_| _| _| _| _| _|
9// _| _| _| _|_| _| _| _|
10// _| _|_|_|_| _| _| _|_|_| _| _|
11//
12//
13//
14//
15// Copyright (C) 2016 Rutgers University and Sandia Corporation
16//
17// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18// the U.S. Government retains certain rights in this software.
19//
20// Redistribution and use in source and binary forms, with or without
21// modification, are permitted provided that the following conditions are
22// met:
23//
24// 1. Redistributions of source code must retain the above copyright
25// notice, this list of conditions and the following disclaimer.
26//
27// 2. Redistributions in binary form must reproduce the above copyright
28// notice, this list of conditions and the following disclaimer in the
29// documentation and/or other materials provided with the distribution.
30//
31// 3. Neither the name of the Corporation nor the names of the
32// contributors may be used to endorse or promote products derived from
33// this software without specific prior written permission.
34//
35// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
36// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
38// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
39// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
40// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
41// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
42// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
43// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
44// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
45// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46//
47// Author Marc Gamell, Eric Valenzuela, Keita Teranishi, Manish Parashar,
48// Michael Heroux, and Matthew Whitlock
49//
50// Questions? Contact Keita Teranishi (knteran@sandia.gov) and
51// Marc Gamell (mgamell@cac.rutgers.edu)
52//
53// ************************************************************************
54//@HEADER
55*/
56#ifndef __FENIX_DATA_GROUP_H__
57#define __FENIX_DATA_GROUP_H__
58
59#include <unordered_map>
60#include <vector>
61#include <source_location>
62
63#include <mpi.h>
64#include "fenix.h"
65#include "fenix_data_member.hpp"
66#include "fenix_data_subset.hpp"
67
68#define __FENIX_DEFAULT_GROUP_SIZE 32
69
70namespace fenix::data {
71
72//We keep basic bookkeeping info here, policy specific
73//information is kept by the policy's data type.
76 int groupid, MPI_Comm c, int timestart, int depth, int policy
77 );
78
79 int groupid;
80 MPI_Comm comm;
81 int comm_size;
82 int current_rank;
83 int timestart;
84 int timestamp;
85 int depth;
86 int policy_name;
87 std::unordered_map<int, fenix_member_entry_t> members;
88 // Kept in order of creation
89 std::vector<int> member_order;
90
91 std::vector<int> get_member_ids();
92 //Search for id, returning null if not found.
93 fenix_member_entry_t* search_member(int id);
94 //As search_member, but throw if not found
95 fenix_member_entry_t* find_member(
96 int id, std::source_location loc = std::source_location::current()
97 );
98 int member_create(int id, void* data, int count, MPI_Datatype datatype);
99 int member_create(int id, void* data, int count, int datatype_size);
100 int member_delete(int memberid);
101
102 virtual int group_delete() = 0;
103 virtual int member_create(fenix_member_entry_t* member) = 0;
104 virtual int member_delete(fenix_member_entry_t* member) = 0;
105 virtual int get_redundant_policy(int* name, void* value, int* flag) = 0;
106 virtual void member_stage(int memberid, const DataSubset& subset) = 0;
107 virtual int member_store(int memberid, const DataSubset& subset) = 0;
108 virtual int member_storev(int memberid, const DataSubset& subset) = 0;
109 virtual int member_istore(int memberid, const DataSubset& subset, Fenix_Request* req) = 0;
110 virtual int member_istorev(int memberid, const DataSubset& subset, Fenix_Request* req) = 0;
111 virtual int commit() = 0;
112 virtual int snapshot_delete(int timestamp) = 0;
113 virtual int barrier() = 0;
114 virtual int member_restore(int member_id, void* target_bugger, int max, int timestamp, DataSubset& data_found) = 0;
115 virtual int member_lrestore(int member_id, void* target_bugger, int max, int timestamp, DataSubset& data_found) = 0;
116 virtual int member_restore_from_rank(int member_id, void* target_bugger, int max, int timestamp, int source_rank) = 0;
117 virtual int get_number_of_snapshots(int* num) = 0;
118 virtual int get_snapshot_at_position(int position, int* timestamp) = 0;
119 virtual std::vector<int> get_snapshots() = 0;
120 virtual int reinit(int* flag) = 0;
121 virtual int member_get_attribute(fenix_member_entry_t* mentry, int name, void* value, int* flag, int sourcerank) = 0;
122 virtual int member_set_attribute(fenix_member_entry_t* mentry, int name, void* value, int* flag) = 0;
123};
124
125typedef struct __fenix_data_recovery {
126 size_t count;
127 size_t total_size;
130
131typedef struct __group_entry_packet {
132 int groupid;
133 int timestamp;
134 int depth;
135 int rank_separation;
137
138fenix_data_recovery_t * __fenix_data_recovery_init();
139
140int __fenix_data_recovery_remove_group(int groupid);
141void __fenix_data_recovery_destroy( fenix_data_recovery_t *fx_data_recovery );
142
143void __fenix_ensure_data_recovery_capacity( fenix_data_recovery_t *dr);
144
145int __fenix_search_groupid( int key, fenix_data_recovery_t *dr);
146
147int __fenix_find_next_group_position( fenix_data_recovery_t *dr );
148
149fenix_group_t* search_group(int id);
150fenix_group_t* find_group(
151 int id, std::source_location loc = std::source_location::current()
152);
153
154} //end namespace fenix::data
155
156#endif // FENIX_DATA_GROUP_H
Contains all API function calls and Fenix types. This is the only header file a user should include.
<span class="mlabel"> UNIMPLEMENTED </span> As MPI_Request, but for Fenix asynchronous data recove...
Definition fenix.h:570
Definition fenix_data_subset.hpp:137
Definition fenix_data_group.hpp:125
Definition fenix_data_group.hpp:131
Definition fenix_data_group.hpp:74
Definition fenix_data_member.hpp:70