Skip to content

Commit

Permalink
updated doc; replace all #
Browse files Browse the repository at this point in the history
  • Loading branch information
cnpetra committed Sep 13, 2024
1 parent bfe1b40 commit 5bc2af6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
10 changes: 10 additions & 0 deletions doc/src/sections/solver_options.tex
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,16 @@ \subsubsection{Problem preprocessing}
\medskip
\subsubsection{Checkpointing of the solver state and restarting}
\Hi can save/load its internal state to/from disk. This can be helphul when running a job on a cluster that enforces limits on the job's running time. This functionality is currently available only for the quasi-Newton algorithm. The checkpointing is done using Axom's scalable Sidre data manager and IO (see \url{https://axom.readthedocs.io/en/develop/axom/sidre/docs/sphinx/index.html}) and requires an Axom-enabled build (use ``-DHIOP_USE_AXOM=ON'' with cmake).
\noindent \textbf{checkpoint\_save}: Save state of NLP solver to file indicated by value of option ``checkpoint\_file''. String values ``yes'' or ``no'', default ``no''.
\noindent \textbf{checkpoint\_load\_on\_start} On (re)start the NLP solver will load checkpoint file specified by ``checkpoint_file`` option. String values ``yes'' or ``no'', default ``no''.
\noindent \textbf{checkpoint\_file} Path to checkpoint file to load from or save to. If present, the character ``\#'' is replaced with the iteration number at which the checkpointing is saved (but \textit{not} when loaded). \Hi adds a ``.root'' extension internally if the value of the option is a directory. If this option is not specified and loading or saving checkpoints is enabled, \Hi will use a file named ``hiop_state_chk''.
\noindent \textbf{checkpoint\_save\_every\_N\_iter} Iteration frequency of saving checkpoints to disk if ``checkpoint_save'' is ``yes''. Takes positive integer values with a default value $10$.
\subsubsection{Miscellaneous options}
Expand Down
5 changes: 3 additions & 2 deletions src/Optimization/hiopAlgFilterIPM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1729,10 +1729,11 @@ void hiopAlgFilterIPMQuasiNewton::checkpointing_stuff()
using ::std::string;
// replace "#" in checkpointing file with iteration number
string path = nlp->options->GetString("checkpoint_file");
const auto s_it_num = ::std::to_string(iter_num_);
auto pos = path.find("#");
if(string::npos != pos) {
auto s_it_num = ::std::to_string(iter_num_);
while(string::npos != pos) {
path.replace(pos, 1, s_it_num);
pos = path.find("#", pos);
}

nlp->log->printf(hovSummary, "Saving checkpoint at iter %d in '%s'.\n", iter_num_, path.c_str());
Expand Down
9 changes: 4 additions & 5 deletions src/Utils/hiopOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1294,18 +1294,17 @@ void hiopOptionsNLP::register_options()
// - only available with HIOP_USE_AXOM
{
vector<string> range = {"yes", "no"};
constexpr char msgcs[] = "Save state of NLP solver to file specified by 'checkpoint_file'.";
constexpr char msgcs[] = "Save state of NLP solver to file indicated by 'checkpoint_file'.";
register_str_option("checkpoint_save", range[1], range, msgcs);

constexpr char msgcsN[] = "Iteration frequency of saving checkpoints to disk.";
register_int_option("checkpoint_save_every_N_iter", 10, 1, 1e+6, msgcsN);

constexpr char msgcf[] = "Path to checkpoint file. If present character '#' will be replaced "
"with the iteration number.";
register_str_option("checkpoint_file", "hiop_state_#.chk", msgcf);
constexpr char msgcf[] = "Path to checkpoint file to load from or save to.";
register_str_option("checkpoint_file", "hiop_state_chk", msgcf);

constexpr char msgclos[] = "On (re)start the NLP solver will load checkpoint file "
"specified by checkpoint_file'.";
"specified by 'checkpoint_file' option.";
register_str_option("checkpoint_load_on_start", range[1], range, msgclos);
}
}
Expand Down

0 comments on commit 5bc2af6

Please sign in to comment.