22 #include "pism/icemodel/IceModel.hh"
24 #include "pism/util/Grid.hh"
25 #include "pism/util/ConfigInterface.hh"
26 #include "pism/util/Time.hh"
27 #include "pism/util/io/File.hh"
28 #include "pism/util/pism_utilities.hh"
29 #include "pism/util/pism_signal.h"
51 "\ncaught signal SIGTERM: EXITING EARLY and saving with original filename.\n");
62 auto file_name =
pism::printf(
"pism-%s.nc", date_without_spaces.c_str());
64 "\ncaught signal SIGUSR1: Writing intermediate file `%s' and flushing time series.\n\n",
72 m_ctx->pio_iosys_id());
81 "\ncaught signal SIGUSR2: Flushing time series.\n\n");
96 result[
"source"] = std::string(
"PISM ") + pism::revision;
97 result[
"long_name"] =
"Run statistics";
107 result[
"processor_hours"] = { proc_hours };
108 result[
"model_years_per_processor_hour"] = { model_years / proc_hours };
High-level PISM I/O class.
virtual int process_signals()
Catch signals -USR1, -USR2 and -TERM.
VariableMetadata run_stats() const
const Config::Ptr m_config
Configuration flags and parameters.
unsigned int m_step_counter
const Time::Ptr m_time
Time manager.
std::shared_ptr< Grid > grid() const
Return the grid used by this model.
const std::shared_ptr< Context > m_ctx
Execution context.
const Logger::Ptr m_log
Logger.
VariableMetadata m_output_global_attributes
stores global attributes saved in a PISM output file
void flush_timeseries()
Flush scalar time-series.
virtual void prepend_history(const std::string &string)
Get time and user/host name and add it to the given string.
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
const units::System::Ptr m_sys
Unit system.
std::shared_ptr< Context > ctx() const
Return the context this model is running in.
std::set< std::string > m_output_vars
const std::shared_ptr< Grid > m_grid
Computational grid.
@ PISM_READWRITE_MOVE
create a file for writing, move foo.nc to foo.nc~ if present
double convert(System::Ptr system, double input, const std::string &spec1, const std::string &spec2)
Convert a quantity from unit1 to unit2.
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 printf(const char *format,...)
std::string username_prefix(MPI_Comm com)
Creates a string with the user name, hostname and the time-stamp (for history strings).
std::string replace_character(const std::string &input, char from, char to)
volatile sig_atomic_t pism_signal