Fault Tolerance Interface
tools.c File Reference

Utility functions for the FTI library. More...

#include "interface.h"
#include <dirent.h>
Include dependency graph for tools.c:

Functions

int FTI_InitExecVars (FTIT_configuration *FTI_Conf, FTIT_execution *FTI_Exec, FTIT_topology *FTI_Topo, FTIT_checkpoint *FTI_Ckpt, FTIT_injection *FTI_Inje)
 Init of the static variables. More...
 
int FTI_Checksum (FTIT_execution *FTI_Exec, FTIT_dataset *FTI_Data, FTIT_configuration *FTI_Conf, char *checksum)
 It calculates checksum of the checkpoint file. More...
 
int FTI_VerifyChecksum (char *fileName, char *checksumToCmp)
 It compares checksum of the checkpoint file. More...
 
int FTI_Try (int result, char *message)
 It receives the return code of a function and prints a message. More...
 
void FTI_MallocMeta (FTIT_execution *FTI_Exec, FTIT_topology *FTI_Topo)
 It mallocs memory for the metadata. More...
 
void FTI_FreeMeta (FTIT_execution *FTI_Exec)
 It frees memory for the metadata. More...
 
int FTI_InitGroupsAndTypes (FTIT_execution *FTI_Exec)
 It mallocs memory for the metadata. More...
 
void FTI_FreeTypesAndGroups (FTIT_execution *FTI_Exec)
 It frees memory for the types. More...
 
int FTI_InitBasicTypes (FTIT_dataset *FTI_Data)
 It creates the basic datatypes and the dataset array. More...
 
int FTI_RmDir (char path[FTI_BUFS], int flag)
 It erases a directory and all its files. More...
 
int FTI_Clean (FTIT_configuration *FTI_Conf, FTIT_topology *FTI_Topo, FTIT_checkpoint *FTI_Ckpt, int level)
 It erases the previous checkpoints and their metadata. More...
 

Variables

int FTI_filemetastructsize
 
int FTI_dbstructsize
 
int FTI_dbvarstructsize
 

Detailed Description

Utility functions for the FTI library.

Copyright (c) 2017 Leonardo A. Bautista-Gomez All rights reserved

FTI - A multi-level checkpointing library for C/C++/Fortran applications

Revision 1.0 : Fault Tolerance Interface (FTI)

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Date
October, 2017

Function Documentation

int FTI_Checksum ( FTIT_execution FTI_Exec,
FTIT_dataset FTI_Data,
FTIT_configuration FTI_Conf,
char *  checksum 
)

It calculates checksum of the checkpoint file.

Parameters
FTI_ExecExecution metadata.
FTI_DataDataset metadata.
checksumChecksum that is calculated.
Returns
integer FTI_SCES if successful.

This function calculates checksum of the checkpoint file based on MD5 algorithm and saves it in checksum.

int FTI_Clean ( FTIT_configuration FTI_Conf,
FTIT_topology FTI_Topo,
FTIT_checkpoint FTI_Ckpt,
int  level 
)

It erases the previous checkpoints and their metadata.

Parameters
FTI_ConfConfiguration metadata.
FTI_TopoTopology metadata.
FTI_CkptCheckpoint metadata.
levelLevel of cleaning.
Returns
integer FTI_SCES if successful.

This function erases previous checkpoint depending on the level of the current checkpoint. Level 5 means complete clean up. Level 6 means clean up local nodes but keep last checkpoint data and metadata in the PFS.

Here is the call graph for this function:

void FTI_FreeMeta ( FTIT_execution FTI_Exec)

It frees memory for the metadata.

Parameters
FTI_ExecExecution metadata.

This function frees the memory used for the metadata storage.

void FTI_FreeTypesAndGroups ( FTIT_execution FTI_Exec)

It frees memory for the types.

Parameters
FTI_ExecExecution metadata.

This function frees the memory used for the type storage.

Here is the call graph for this function:

int FTI_InitBasicTypes ( FTIT_dataset FTI_Data)

It creates the basic datatypes and the dataset array.

Parameters
FTI_DataDataset metadata.
Returns
integer FTI_SCES if successful.

This function creates the basic data types using FTIT_Type.

Here is the call graph for this function:

int FTI_InitExecVars ( FTIT_configuration FTI_Conf,
FTIT_execution FTI_Exec,
FTIT_topology FTI_Topo,
FTIT_checkpoint FTI_Ckpt,
FTIT_injection FTI_Inje 
)

Init of the static variables.

Returns
integer FTI_SCES if successful.

This function initializes all static variables to zero.

int FTI_InitGroupsAndTypes ( FTIT_execution FTI_Exec)

It mallocs memory for the metadata.

Parameters
FTI_ExecExecution metadata.
FTI_TopoTopology metadata.

This function mallocs the memory used for the metadata storage.

void FTI_MallocMeta ( FTIT_execution FTI_Exec,
FTIT_topology FTI_Topo 
)

It mallocs memory for the metadata.

Parameters
FTI_ExecExecution metadata.
FTI_TopoTopology metadata.

This function mallocs the memory used for the metadata storage.

int FTI_RmDir ( char  path[FTI_BUFS],
int  flag 
)

It erases a directory and all its files.

Parameters
pathPath to the directory we want to erase.
flagSet to 1 to activate.
Returns
integer FTI_SCES if successful.

This function erases a directory and all its files. It focusses on the checkpoint directories created by FTI so it does NOT handle recursive erasing if the given directory includes other directories.

Here is the call graph for this function:

int FTI_Try ( int  result,
char *  message 
)

It receives the return code of a function and prints a message.

Parameters
resultResult to check.
messageMessage to print.
Returns
integer The same result as passed in parameter.

This function checks the result from a function and then decides to print the message either as a debug message or as a warning.

Here is the call graph for this function:

int FTI_VerifyChecksum ( char *  fileName,
char *  checksumToCmp 
)

It compares checksum of the checkpoint file.

Parameters
fileNameFilename of the checkpoint.
checksumToCmpChecksum to compare.
Returns
integer FTI_SCES if successful.

This function calculates checksum of the checkpoint file based on MD5 algorithm. It compares calculated hash value with the one saved in the file.

Here is the call graph for this function:

Variable Documentation

int FTI_dbstructsize

size of FTIFF_db struct in file

int FTI_dbvarstructsize

size of FTIFF_db struct in file

int FTI_filemetastructsize

size of FTIFF_db struct in file