Gromacs  2024.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Functions
handlerestart.cpp File Reference
#include "gmxpre.h"
#include "handlerestart.h"
#include "config.h"
#include <fcntl.h>
#include <cerrno>
#include <cstring>
#include <filesystem>
#include <algorithm>
#include <exception>
#include <functional>
#include <optional>
#include <tuple>
#include "gromacs/commandline/filenm.h"
#include "gromacs/fileio/checkpoint.h"
#include "gromacs/fileio/gmxfio.h"
#include "gromacs/mdrunutility/multisim.h"
#include "gromacs/mdtypes/mdrunoptions.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/enumerationhelpers.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/path.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/stringstream.h"
#include "gromacs/utility/textwriter.h"
+ Include dependency graph for handlerestart.cpp:

Description

This file declares functions for mdrun to call to manage the details of doing a restart (ie. reading checkpoints, appending output files).

Todo:
Clean up the error-prone logic here. Add doxygen.
Author
Berk Hess hess@.nosp@m.kth..nosp@m.se
Erik Lindahl erik@.nosp@m.kth..nosp@m.se
Mark Abraham mark..nosp@m.j.ab.nosp@m.raham.nosp@m.@gma.nosp@m.il.co.nosp@m.m

Classes

class  gmx::anonymous_namespace{handlerestart.cpp}::StartingBehaviorHandler
 Describes how mdrun will (re)start and provides supporting functionality based on that data. More...
 

Functions

gmx_bool gmx::anonymous_namespace{handlerestart.cpp}::exist_output_file (const std::filesystem::path &fnm_cp, int nfile, const t_filenm fnm[])
 Search for fnm_cp in fnm and return true iff found. More...
 
void gmx::anonymous_namespace{handlerestart.cpp}::throwBecauseOfMissingOutputFiles (const std::filesystem::path &checkpointFilename, ArrayRef< const gmx_file_position_t > outputfiles, int nfile, const t_filenm fnm[], size_t numFilesMissing)
 Throw when mdrun -cpi fails because previous output files are missing. More...
 
const char * gmx::anonymous_namespace{handlerestart.cpp}::precisionToString (bool isDoublePrecision)
 Return a string describing the precision of a build of GROMACS.
 
StartingBehaviorHandler gmx::anonymous_namespace{handlerestart.cpp}::chooseStartingBehavior (const AppendingBehavior appendingBehavior, const int nfile, t_filenm fnm[])
 Choose the starting behaviour for this simulation. More...
 
void gmx::anonymous_namespace{handlerestart.cpp}::checkOutputFile (t_fileio *fileToCheck, const gmx_file_position_t &outputfile)
 Check whether chksum_file output file has a checksum that matches outputfile from the checkpoint.
 
void gmx::anonymous_namespace{handlerestart.cpp}::lockLogFile (t_fileio *logfio, const std::filesystem::path &logFilename)
 If supported, obtain a write lock on the log file. More...
 
void gmx::anonymous_namespace{handlerestart.cpp}::prepareForAppending (const ArrayRef< const gmx_file_position_t > outputFiles, t_fileio *logfio)
 Prepare to append to output files. More...
 
std::tuple< StartingBehavior,
LogFilePtr > 
gmx::handleRestart (bool isSimulationMain, MPI_Comm communicator, const gmx_multisim_t *ms, AppendingBehavior appendingBehavior, int nfile, t_filenm fnm[])
 Handle startup of mdrun, particularly regarding -cpi and -append. More...