20 #include "pism/icemodel/IceModel.hh"
22 #include "pism/util/pism_utilities.hh"
23 #include "pism/util/Profiling.hh"
33 std::string output_file =
m_config->get_string(
"output.file");
34 if (not output_file.empty()) {
51 double checkpoint_interval =
m_config->get_number(
"output.checkpoint.interval");
66 " [%s] Saving a checkpoint to '%s' (%1.3f hours after the beginning of the run)\n",
70 profiling.
begin(
"io.checkpoint");
76 m_ctx->pio_iosys_id());
83 profiling.
end(
"io.checkpoint");
90 " [%s] Done saving a checkpoint in %f seconds (%f minutes).\n",
92 checkpoint_end_time - checkpoint_start_time,
93 (checkpoint_end_time - checkpoint_start_time) / 60.0);
95 return m_config->get_flag(
"output.checkpoint.exit");
High-level PISM I/O class.
void init_checkpoints()
Initialize checkpointing (snapshot-on-wallclock-time) mechanism.
VariableMetadata run_stats() const
const Config::Ptr m_config
Configuration flags and parameters.
const Time::Ptr m_time
Time manager.
double m_last_checkpoint_time
const std::shared_ptr< Context > m_ctx
Execution context.
const Logger::Ptr m_log
Logger.
void flush_timeseries()
Flush scalar time-series.
bool write_checkpoint()
Write a checkpoint (i.e. an intermediate result of a run).
std::set< std::string > m_checkpoint_vars
virtual void save_variables(const File &file, OutputKind kind, const std::set< std::string > &variables, double time, io::Type default_diagnostics_type=io::PISM_FLOAT) const
virtual std::set< std::string > output_variables(const std::string &keyword)
Assembles a list of diagnostics corresponding to an output file size.
std::string m_checkpoint_filename
virtual void write_metadata(const File &file, MappingTreatment mapping_flag, HistoryTreatment history_flag) const
Write time-independent metadata to a file.
const std::shared_ptr< Grid > m_grid
Computational grid.
void begin(const char *name) const
void end(const char *name) const
@ PISM_READWRITE_MOVE
create a file for writing, move foo.nc to foo.nc~ if present
double get_time(MPI_Comm comm)
io::Backend string_to_backend(const std::string &backend)
double wall_clock_hours(MPI_Comm com, double start_time)
Return time since the beginning of the run, in hours.
std::string filename_add_suffix(const std::string &filename, const std::string &separator, const std::string &suffix)
Adds a suffix to a filename.
std::string timestamp(MPI_Comm com)
Creates a time-stamp used for the history NetCDF attribute.
void write_run_stats(const File &file, const pism::VariableMetadata &stats)