64#include "fenix_init.h"
66#if defined(MPIX_ERR_PROC_FAILED) && !defined(MPI_ERR_PROC_FAILED)
67#define MPI_ERR_PROC_FAILED MPIX_ERR_PROC_FAILED
70#if defined(MPIX_ERR_PROC_FAILED_PENDING) && \
71 !defined(MPI_ERR_PROC_FAILED_PENDING)
72#define MPI_ERR_PROC_FAILED_PENDING MPIX_ERR_PROC_FAILED_PENDING
75#if defined(MPIX_ERR_REVOKED) && !defined(MPI_ERR_REVOKED)
76#define MPI_ERR_REVOKED MPIX_ERR_REVOKED
79#if defined(c_plusplus) || defined(__cplusplus)
99 FENIX_ERROR_UNINITIALIZED = -100,
100 FENIX_ERROR_NOCATEGORY,
101 FENIX_ERROR_CALLBACK_NOT_REGISTERED,
102 FENIX_ERROR_GROUP_CREATE,
103 FENIX_ERROR_MEMBER_CREATE,
104 FENIX_ERROR_MEMBER_EXISTS,
105 FENIX_ERROR_MEMBER_STAGING,
106 FENIX_ERROR_MEMBER_LOADING,
107 FENIX_ERROR_MEMBER_UNSTORED,
108 FENIX_ERROR_COMMIT_BARRIER,
109 FENIX_ERROR_INVALID_GROUPID,
110 FENIX_ERROR_INVALID_MEMBERID,
111 FENIX_ERROR_INVALID_LOGIC_CALL,
112 FENIX_ERROR_INVALID_POLICY_NAME,
113 FENIX_ERROR_INVALID_POLICY_VALUE,
114 FENIX_ERROR_INVALID_TIMESTAMP,
115 FENIX_ERROR_INVALID_TIMESTART,
116 FENIX_ERROR_INVALID_DEPTH,
117 FENIX_ERROR_INVALID_ATTRIBUTE_NAME,
118 FENIX_ERROR_INVALID_ATTRIBUTE_VALUE,
119 FENIX_ERROR_INVALID_POSITION,
120 FENIX_ERROR_INVALID_SUBSET,
121 FENIX_ERROR_DATA_WAIT,
122 FENIX_ERROR_SUBSET_NUM_BLOCKS,
123 FENIX_ERROR_SUBSET_START_OFFSET,
124 FENIX_ERROR_SUBSET_END_OFFSET,
125 FENIX_ERROR_SUBSET_STRIDE,
126 FENIX_ERROR_NODATA_FOUND,
128 FENIX_ERROR_CANCELLED,
129 FENIX_ERROR_INVALID_SETTING_NAME,
130 FENIX_ERROR_INVALID_SETTING_OPTION,
131 FENIX_ERROR_INVALID_MLOGID,
132 FENIX_ERROR_MLOG_EXISTS,
133 FENIX_ERROR_MLOG_LIBRARY_UNAVAILABLE,
134 FENIX_ERROR_PROCESS_FAILURE,
137 FENIX_WARNING_SPARE_RANKS_DEPLETED = 100,
138 FENIX_WARNING_PARTIAL_RESTORE,
143#define FENIX_ERRHANDLER_LOC 1
145#define FENIX_FINALIZE_LOC 2
147#define FENIX_DATA_COMMIT_BARRIER_LOC 4
392#define Fenix_Init(_role, _comm, _newcomm, _argc, _argv, _spare_ranks, _err) \
394 static jmp_buf bufjmp; \
395 *(_role) = __fenix_preinit( \
396 _role, _comm, _newcomm, _argc, _argv, _spare_ranks, _err, &bufjmp \
399 __fenix_postinit(); \
469 void (*recover)(MPI_Comm,
int,
void*),
void* callback_data
585#define FENIX_DATA_GROUP_WORLD_ID 10
586#define FENIX_GROUP_ID_MAX 11
587#define FENIX_DATA_MEMBER_ALL -1
588#define FENIX_DATA_MEMBER_ATTRIBUTE_BUFFER 11
589#define FENIX_DATA_MEMBER_ATTRIBUTE_COUNT 12
590#define FENIX_DATA_MEMBER_ATTRIBUTE_DATATYPE 13
591#define FENIX_DATA_MEMBER_ATTRIBUTE_SIZE 14
592#define FENIX_DATA_SNAPSHOT_LATEST -1
593#define FENIX_DATA_SNAPSHOT_ALL -2
594#define FENIX_DATA_RESTORE_INPLACE NULL
595#define FENIX_DATA_RESTORE_FULL INT_MAX
596#define FENIX_RESIZEABLE 0
597#define FENIX_DATA_SUBSET_CREATED 2
598#define FENIX_STOREV_ALL -1
599#define FENIX_SERIALIZE -2
600#define FENIX_DESERIALIZE -3
602#define FENIX_DATA_POLICY_IN_MEMORY_RAID 13
603#define FENIX_DATA_POLICY_IMR FENIX_DATA_POLICY_IN_MEMORY_RAID
604#define FENIX_DATA_POLICY_LOCAL 14
606#define FENIX_TIME_STAMP_IGNORE NULL
612 MPI_Request mpi_send_req;
613 MPI_Request mpi_recv_req;
704 int group_id, MPI_Comm comm,
int start_time_stamp,
int depth,
int policy_name,
705 void* policy_value,
int* flag
743 int group_id,
int member_id,
void* buffer,
int count, MPI_Datatype datatype
750 int group_id,
int member_id,
void* buffer,
int count, MPI_Datatype datatype,
762 int group_id,
int member_id,
void* buffer,
int count, MPI_Datatype datatype
774 int group_id,
int member_id,
void* buffer,
int count, MPI_Datatype datatype,
799 int group_id,
int* policy_name,
void* policy_value,
int* flag
1074 int group_id,
int member_id,
void* target,
int target_count,
int time_stamp,
1101 int group_id,
int member_id, FILE** fpp,
int time_stamp,
1141 int group_id,
int member_id,
void* target_buffer,
int max_count,
1163 int group_id,
int member_id,
void* target_buffer,
int max_count,
1170 int group_id,
int member_id,
void* data,
int max_count,
int time_stamp,
1199 int num_blocks,
int start_offset,
int end_offset,
int stride,
1222 int num_blocks,
int* array_start_offsets,
int* array_end_offsets,
1243 int group_id,
int* number_of_members
1256 int group_id,
int* member_id,
int position
1269 int group_id,
int* number_of_snapshots
1285 int group_id,
int position,
int* time_stamp
1307 int group_id,
int member_id,
int attributename,
void* attributevalue,
1329 int group_id,
int member_id,
int attribute_name,
void* attribute_value,
1370#define FENIX_MLOG_NONE -1
1371#define FENIX_MLOG_CONTINUE -1
1492#if defined(c_plusplus) || defined(__cplusplus)
int Fenix_Data_member_attr_get(int group_id, int member_id, int attributename, void *attributevalue, int *flag)
<span class="mlabel"> UNIMPLEMENTED </span> Get the value of a member's attribute.
Definition recovery.cpp:536
int Fenix_Data_member_store(int group_id, int member_id, const Fenix_Data_subset subset)
Store a particular group member into the group's resilient storage space, in uncommitted storage.
Definition fenix.cpp:358
int Fenix_Data_group_created(int group_id)
Query if a data group exists on this rank.
Definition fenix.cpp:291
int Fenix_Data_member_stage_inplace(int group_id, int member_id, void *buf, const Fenix_Data_subset subset)
As Fenix_Data_member_stage, but takes ownership of buf to possibly avoid a copy.
const Fenix_Data_subset FENIX_DATA_SUBSET_FULL
A standin for checkpointing/recovering the full member's data.
Definition fenix.cpp:71
int Fenix_Data_member_fcreate(int group_id, int member_id, void *buffer, int count, MPI_Datatype datatype, Fenix_Serialize_file_fn serializer, void *ctx)
Create a data member to be (de)serialized with a file pointer.
Definition fenix.cpp:305
int Fenix_Data_checkpoint(int group_id, const Fenix_Data_subset subset, int num_storev, int *storev_ids, int *time_stamp)
Store all members of a group and then commit that group.
Definition fenix.cpp:406
int Fenix_Data_member_istorev(int group_id, int member_id, const Fenix_Data_subset subset, Fenix_Request *request)
<span class="mlabel"> UNIMPLEMENTED </span> As [istore](Fenix_Data_member_istore),...
Definition fenix.cpp:383
int Fenix_Data_group_get_redundancy_policy(int group_id, int *policy_name, void *policy_value, int *flag)
Get the storage policy of a data group.
Definition recovery.cpp:546
int Fenix_Data_group_delete(int group_id)
Delete a data group.
Definition fenix.cpp:493
const Fenix_Data_subset FENIX_DATA_SUBSET_EMPTY
A standin for checkpointing/recovering no data.
Definition fenix.cpp:72
void(* Fenix_Serialize_file_fn)(FILE *, int, void *, int, int, void *)
Serializer function type for file-serializable data members.
Definition fenix.h:669
int Fenix_Data_member_repair(int group_id, int member_id)
Repair the resilient storage of committed data for this member.
int Fenix_Data_group_create(int group_id, MPI_Comm comm, int start_time_stamp, int depth, int policy_name, void *policy_value, int *flag)
Create a Data Group.
Definition fenix.cpp:280
int Fenix_Data_member_load_to(int group_id, int member_id, void *target, int target_count, int time_stamp, Fenix_Data_subset *found_data)
As Fenix_Data_member_load, but with a custom load destination.
int Fenix_Data_member_create(int group_id, int member_id, void *buffer, int count, MPI_Datatype datatype)
Create a data member for store/restore operations.
Definition fenix.cpp:297
int Fenix_Data_member_restore(int group_id, int member_id, void *target_buffer, int max_count, int time_stamp, Fenix_Data_subset *found_data)
Repair and load a member.
Definition fenix.cpp:423
int Fenix_data_member_load_begin(int group_id, int member_id, FILE **fpp, int time_stamp, Fenix_Data_subset *found_data)
Get a file to read this member's committed data from.
int Fenix_Data_subset_delete(Fenix_Data_subset *subset)
Delete a data subset.
Definition fenix.cpp:479
int Fenix_Data_snapshot_delete(int group_id, int time_stamp)
Delete a snapshot from a data group.
Definition fenix.cpp:487
int Fenix_Data_member_lrestore(int group_id, int member_id, void *target_buffer, int max_count, int time_stamp, Fenix_Data_subset *found_data)
Local-only version of Fenix_Data_member_restore.
Definition fenix.cpp:441
int Fenix_Data_group_get_number_of_snapshots(int group_id, int *number_of_snapshots)
Get the number of locally-available snapshots in a data group.
Definition recovery.cpp:508
const Fenix_Data_subset FENIX_DATA_SUBSET_PRESTAGED
A standin for checkpointing/recovering all of pre-staged data.
Definition fenix.cpp:73
int Fenix_Data_member_created(int group_id, int member_id)
Query if a data member exists on this rank.
Definition fenix.cpp:352
int Fenix_Data_group_get_number_of_members(int group_id, int *number_of_members)
Get the number of members in a data group.
Definition recovery.cpp:572
int Fenix_Data_member_fdefine(int group_id, int member_id, void *buffer, int count, MPI_Datatype datatype, Fenix_Serialize_file_fn serializer, void *ctx)
Idempotent version of Fenix_Data_member_fcreate.
Definition fenix.cpp:327
int Fenix_Data_group_get_member_at_position(int group_id, int *member_id, int position)
Get member ID based on member index.
Definition recovery.cpp:579
int Fenix_Data_group_get_cohort(int group_id, MPI_Group *cohort)
Get the cohort (redundancy partner group) for a data group.
Definition recovery.cpp:528
int Fenix_Data_wait(Fenix_Request request)
<span class="mlabel"> UNIMPLEMENTED </span> Block on completion of the store operation specified b...
Definition recovery.cpp:594
int Fenix_Data_subset_createv(int num_blocks, int *array_start_offsets, int *array_end_offsets, Fenix_Data_subset *subset)
As Fenix_Data_subset_create, but with varying start and end offsets.
Definition fenix.cpp:468
int Fenix_Data_test(Fenix_Request request, int *flag)
<span class="mlabel"> UNIMPLEMENTED </span> Query completion of the store operation specified by t...
Definition recovery.cpp:602
int Fenix_Data_member_istore(int group_id, int member_id, const Fenix_Data_subset subset, Fenix_Request *request)
<span class="mlabel"> UNIMPLEMENTED </span> As [store](Fenix_Data_member_store),...
Definition fenix.cpp:374
int Fenix_Data_member_stage_begin(int group_id, int member_id, FILE **fpp)
Open a file for manually staging a member into.
int Fenix_Data_member_storev(int group_id, int member_id, const Fenix_Data_subset subset)
<span class="mlabel"> UNIMPLEMENTED </span> As [store](Fenix_Data_member_store),...
Definition fenix.cpp:366
int Fenix_Data_member_restore_from_rank(int group_id, int member_id, void *data, int max_count, int time_stamp, Fenix_Data_subset *found_data, int source_rank)
<span class="mlabel"> UNIMPLEMENTED </span> As Fenix_Data_member_restore, but restores from a spec...
int Fenix_Data_member_load(int group_id, int member_id, int time_stamp, Fenix_Data_subset *found_data)
Load this member's committed data into user's data.
int Fenix_Data_member_delete(int group_id, int member_id)
Delete a data member.
Definition fenix.cpp:499
int Fenix_Data_commit_barrier(int group_id, int *time_stamp)
As commit, but ensures a globally consistent commit.
Definition fenix.cpp:400
int Fenix_Data_member_attr_set(int group_id, int member_id, int attribute_name, void *attribute_value, int *flag)
Set the value of a member's attribute.
Definition fenix.cpp:344
int Fenix_Data_member_stage_end(int group_id, int member_id)
Concludes a Fenix_Data_member_stage_begin.
int Fenix_Data_commit(int group_id, int *time_stamp)
Commit stored data members to the group's next snapshot.
Definition fenix.cpp:394
int Fenix_Data_group_get_snapshot_at_position(int group_id, int position, int *time_stamp)
Get the time stamp of a snapshot at a given index.
Definition recovery.cpp:516
int Fenix_Data_member_define(int group_id, int member_id, void *buffer, int count, MPI_Datatype datatype)
Idempotent version of Fenix_Data_member_create.
Definition fenix.cpp:319
int Fenix_Data_member_stage(int group_id, int member_id, const Fenix_Data_subset subset)
Serialize a group member's data into the member's local store.
int Fenix_Data_subset_create(int num_blocks, int start_offset, int end_offset, int stride, Fenix_Data_subset *subset)
Create a data subset for use in store operations.
Definition fenix.cpp:458
int Fenix_Data_member_load_end(int group_id, int member_id)
Concludes a #Fenix_Data_member_load_begin.
int Fenix_Mlog_delete(int mlog_id)
Delete an mlog.
Definition fenix.cpp:554
int Fenix_Mlog_begin_region(int mlog_id, int region_id)
Set the region of the given message logger.
Definition fenix.cpp:524
int Fenix_Mlog_activate_region(int mlog_id, int region_id)
Activate the mlog and begin the region.
Definition fenix.cpp:530
int Fenix_Mlog_sync(int mlog_id, int region_id)
Synchronize messages across ranks each starting at their given region.
Definition fenix.cpp:536
int Fenix_Mlog_active(int *mlog_id)
Get the currently active message log.
Definition fenix.cpp:517
int Fenix_Mlog_create(int mlog_id, MPI_Comm *comm, int depth)
Create a new message logger.
Definition fenix.cpp:505
int Fenix_Mlog_create_data_member(int mlog_id, int group_id, int member_id)
Create a data member that can be used to stage/restore this mlog.
Definition fenix.cpp:542
int Fenix_Mlog_define_data_member(int mlog_id, int group_id, int member_id)
Define a data member that can be used to stage/restore this mlog, see Fenix_Data_member_define.
Definition fenix.cpp:548
int Fenix_Mlog_activate(int mlog_id)
Active a given mlog, deactivating any previously active mlog.
Definition fenix.cpp:511
Fenix_Unhandled_mode
Options for dealing with 'unhandled' errors, e.g. invalid rank IDs.
Definition fenix.h:274
Fenix_Spare_finalize_mode
Options for what spare ranks should do when Fenix_Finalize is called. Must be set before Fenix_Init t...
Definition fenix.h:319
int Fenix_get_option(Fenix_Setting_name setting, unsigned *option)
Get the current option for a Fenix setting.
Definition fenix.cpp:91
Fenix_Resume_mode
Options for passing control back to application after recovery.
Definition fenix.h:247
int Fenix_Finalized(int *flag)
Sets flag to true if Fenix_Finalize has been called, else false.
Definition fenix.cpp:126
int Fenix_get_error()
Returns the error value from Fenix_Init or the latest recovery.
Definition fenix.cpp:163
int Fenix_Callback_pop()
Pop the most recently registered callback from the callback stack.
Definition fenix.cpp:109
int Fenix_Callback_register(void(*recover)(MPI_Comm, int, void *), void *callback_data)
Register a callback to be invoked after failure process recovery.
Definition fenix.cpp:98
Fenix_Recovery_mode
Options for recovering after a failed rank is detected.
Definition fenix.h:205
Fenix_Spare_wait_mode
Options for how spare ranks wait to be needed. Must be set before Fenix_Init to take effect.
Definition fenix.h:290
int Fenix_Process_fail_list(int **fail_list)
Get the list of ranks that failed in the most recent failure.
Definition fenix.cpp:131
int Fenix_get_nspare()
Returns the number of spare ranks currently available to Fenix.
Definition fenix.cpp:168
int Fenix_get_number_of_ranks_with_role(int, int *)
<span class="mlabel"> UNIMPLEMENTED </span> Returns the number of ranks with a given Fenix_Rank_ro...
int Fenix_Initialized(int *flag)
Sets flag to true if Fenix_Init has been called, else false.
Definition fenix.cpp:121
int Fenix_check_cancelled(MPI_Request *request, MPI_Status *status)
Check a pre-recovery request without error.
Definition fenix.cpp:138
int Fenix_set_option(Fenix_Setting_name setting, unsigned option)
Configure a global Fenix setting.
Definition fenix.cpp:76
int Fenix_Finalize()
Clean up Fenix state. Each active rank must call Fenix_Finalize before exiting.
Definition fenix_process_recovery.cpp:856
int Fenix_Process_detect_failures(int do_recovery)
Check for any failed ranks.
Definition fenix.cpp:152
Fenix_Rank_role Fenix_get_role()
Returns this rank's Fenix_Rank_role.
Definition fenix.cpp:158
int Fenix_Callback_invoke_all()
Invoke all callbacks with information from the last recovered fault.
Definition fenix.cpp:115
Fenix_Callback_exception_mode
Options for dealing with CommExceptions generated in callbacks.
Definition fenix.h:305
Fenix_Setting_name
Global Fenix settings.
Definition fenix.h:182
Fenix_Mlog_recovery_mode
Definition fenix.h:223
Fenix_Rank_role
All possible roles returned by Fenix_Init.
Definition fenix.h:168
int Fenix_get_rank_role(MPI_Comm comm, int rank, int *role)
<span class="mlabel"> UNIMPLEMENTED </span> Returns the Fenix_Rank_role for a given rank
@ FENIX_UNHANDLED_PRINT
Print error and continue without handling.
Definition fenix.h:278
@ FENIX_UNHANDLED_SILENT
Ignore unhandled errors.
Definition fenix.h:276
@ FENIX_UNHANDLED_ABORT
Print error and abort Fenix's world (default)
Definition fenix.h:280
@ FENIX_UNHANDLED_MODE_MAXCODE
Not a valid option.
Definition fenix.h:283
@ FENIX_SPARE_FINALIZE_EXIT
Finalize MPI and exit (default),.
Definition fenix.h:323
@ FENIX_SPARE_FINALIZE_MODE_MAXCODE
Not a valid option.
Definition fenix.h:326
@ FENIX_SPARE_FINALIZE_RELEASE
Continue from Fenix_Init with Fenix_Rank_role FENIX_RANK_ROLE_SPARE.
Definition fenix.h:321
@ FENIX_RESUME_MODE_MAXCODE
Not a valid option.
Definition fenix.h:268
@ FENIX_RESUME_THROW
Throw a fenix::CommException.
Definition fenix.h:265
@ FENIX_RESUME_JUMP
Return to Fenix_Init via longjmp (default)
Definition fenix.h:261
@ FENIX_RESUME_RETURN
Return the error code inline.
Definition fenix.h:263
@ FENIX_RECOVERY_IGNORE
Do not repair communicator, immediately resume per FENIX_RESUME_MODE.
Definition fenix.h:207
@ FENIX_RECOVERY_REPAIR
Repair the communicator with spares or by shrinking.
Definition fenix.h:215
@ FENIX_RECOVERY_MODE_MAXCODE
Not a valid option.
Definition fenix.h:220
@ FENIX_RECOVERY_SPAWN
<span class="mlabel"> UNIMPLEMENTED </span> As REPAIR, but attempt to respawn failed processes
Definition fenix.h:217
@ FENIX_RECOVERY_NOOP
Do not repair communicator, otherwise behave normally.
Definition fenix.h:213
@ FENIX_SPARE_WAIT_YIELD
Tell MPI to yield this thread while waiting (if supported, else busy wait)
Definition fenix.h:294
@ FENIX_SPARE_WAIT_MODE_MAXCODE
Not a valid option.
Definition fenix.h:299
@ FENIX_SPARE_WAIT_SLEEP
Sleep 100ms between checks to see if this thread is needed for recovery.
Definition fenix.h:296
@ FENIX_SPARE_WAIT_BUSY
Busy wait, consuming CPU time in exchange for faster response.
Definition fenix.h:292
@ FENIX_CALLBACK_EXCEPTION_MODE_MAXCODE
Not a valid option.
Definition fenix.h:312
@ FENIX_CALLBACK_EXCEPTION_SQUASH
CommExceptions from callbacks are squashed.
Definition fenix.h:309
@ FENIX_CALLBACK_EXCEPTION_RETHROW
CommExceptions are allowed to propagate out of callbacks.
Definition fenix.h:307
@ FENIX_SETTING_NAME_MAXCODE
Not a valid option.
Definition fenix.h:199
@ FENIX_RESUME_MODE
See Fenix_Resume_mode.
Definition fenix.h:186
@ FENIX_MLOG_RECOVERY_MODE
See Fenix_Mlog_recovery_mode.
Definition fenix.h:192
@ FENIX_SPARE_FINALIZE_MODE
See Fenix_Spare_finalize_mode.
Definition fenix.h:196
@ FENIX_SPARE_WAIT_MODE
See Fenix_Spare_wait_mode.
Definition fenix.h:194
@ FENIX_CALLBACK_EXCEPTION_MODE
See Fenix_Callback_exception_mode.
Definition fenix.h:190
@ FENIX_RECOVERY_MODE
See Fenix_Recovery_mode.
Definition fenix.h:184
@ FENIX_UNHANDLED_MODE
See Fenix_Unhandled_mode.
Definition fenix.h:188
@ FENIX_MLOG_RECOVERY_MANUAL
All message logging recovery is manual.
Definition fenix.h:225
@ FENIX_MLOG_RECOVERY_INLINE_AUTOSYNC
As INLINE, but automatically sync logs with FENIX_MLOG_CONTINUE.
Definition fenix.h:239
@ FENIX_MLOG_RECOVERY_INLINE
Automatically repeats failed, logged MPI operations without disrupting normal application control flo...
Definition fenix.h:232
@ FENIX_MLOG_RECOVERY_MODE_MAXCODE
Not a valid option.
Definition fenix.h:242
@ FENIX_ROLE_SPARE_RANK
This rank was a spare when Fenix finalized.
Definition fenix.h:176
@ FENIX_ROLE_RECOVERED_RANK
This rank was a spare before the most recent failure, or was just spawned.
Definition fenix.h:172
@ FENIX_ROLE_INITIAL_RANK
No failures have occurred yet.
Definition fenix.h:170
@ FENIX_ROLE_SURVIVOR_RANK
This rank was not a spare before the most recent failure.
Definition fenix.h:174
Represents a data subset that can be stored/recovered.
Definition fenix.h:625
<span class="mlabel"> UNIMPLEMENTED </span> As MPI_Request, but for Fenix asynchronous data recove...
Definition fenix.h:611