diff --git a/CHANGELOG.md b/CHANGELOG.md index bfeefc95366c..7f5ad40fe076 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,36 @@ ## Current develop ### Added (new features/APIs/variables/...) + + +### Changed (changing behavior/API/variables/...) +- [[PR 1024]](https://github.com/parthenon-hpc-lab/parthenon/pull/1024) Add .outN. to history output filenames +- [[PR 1004]](https://github.com/parthenon-hpc-lab/parthenon/pull/1004) Allow parameter modification from an input file for restarts + +### Fixed (not changing behavior/API/variables/...) +- [[PR 1024]](https://github.com/parthenon-hpc-lab/parthenon/pull/1024) Add features to history output +- [[PR 1031]](https://github.com/parthenon-hpc-lab/parthenon/pull/1031) Fix bug in non-cell centered AMR + +### Infrastructure (changes irrelevant to downstream codes) +- [[PR 1009]](https://github.com/parthenon-hpc-lab/parthenon/pull/1009) Move from a single octree to a forest of octrees + + +### Removed (removing behavior/API/varaibles/...) + + +### Incompatibilities (i.e. breaking changes) + + +## Release 24.03 +Date: 2024-03-21 + +### Added (new features/APIs/variables/...) +- [[PR 852]](https://github.com/parthenon-hpc-lab/parthenon/pull/852) Add Mesh version of UserWorkBeforeOutput +- [[PR 998]](https://github.com/parthenon-hpc-lab/parthenon/pull/998) tensor indices added to sparse pack +- [[PR 999]](https://github.com/parthenon-hpc-lab/parthenon/pull/999) Add a post-initialization hook +- [[PR 987]](https://github.com/parthenon-hpc-lab/parthenon/pull/987) New tasking infrastructure and capabilities +- [[PR 969]](https://github.com/parthenon-hpc-lab/parthenon/pull/969) New macro-based auto-naming of profiling regions and kernels +- [[PR 981]](https://github.com/parthenon-hpc-lab/parthenon/pull/981) Add IndexSplit - [[PR 983]](https://github.com/parthenon-hpc-lab/parthenon/pull/983) Add Contains to SparsePack - [[PR 968]](https://github.com/parthenon-hpc-lab/parthenon/pull/968) Add per package registration of boundary conditions - [[PR 948]](https://github.com/parthenon-hpc-lab/parthenon/pull/948) Add solver interface and update Poisson geometric multi-grid example diff --git a/doc/sphinx/src/README.rst b/doc/sphinx/src/README.rst index 521cabf3bc03..5052febcfbd8 100644 --- a/doc/sphinx/src/README.rst +++ b/doc/sphinx/src/README.rst @@ -195,13 +195,13 @@ pointers in the ApplicationInput member app_input of the ParthenonManager class prior to calling ``ParthenonInit``. This is demonstrated in the ``main()`` functions in the examples. -Note that the ``ProblemGenerator``\ s of ``Mesh`` and ``MeshBlock`` are -mutually exclusive. Moreover, the ``Mesh`` one requires -``parthenon/mesh/pack_size=-1`` during initialization, i.e., all blocks -on a rank need to be in a single pack. This allows to use MPI reductions -inside the function, for example, to globally normalize quantities. The -``parthenon/mesh/pack_size=-1`` exists only during problem -inititalization, i.e., simulations can be restarted with an arbitrary +Note that the ``ProblemGenerator``\ s (and ``PostInitialization``\ s) of +``Mesh`` and ``MeshBlock`` are mutually exclusive. Moreover, the ``Mesh`` +ones requires ``parthenon/mesh/pack_size=-1`` during initialization, i.e., +all blocks on a rank need to be in a single pack. This allows to use MPI +reductions inside the function, for example, to globally normalize quantities. +The ``parthenon/mesh/pack_size=-1`` exists only during problem +initialization, i.e., simulations can be restarted with an arbitrary ``pack_size``. For an example of the ``Mesh`` version, see the `Poisson example `__. @@ -303,7 +303,12 @@ command. For example, the ``refine_tol`` parameter in the appending ``parthenon/refinement0/refine_tol=my_new_value`` to the launch command (e.g., ``srun ./myapp -i my_input.file parthenon/refinement0/refine_tol=my_new_value``). -This similarly applies to simulations that are restarted. +This similarly applies to simulations that are restarted, where modifications +from the command line and through an input file are possible, e.g., +``srun ./myapp -r out0.rhdf -i modified_input.in parthenon/refinement0/refine_tol=my_new_value``. +In the latter case, the input stored in the restart file will be read first, +then updated from the content in the input file, and finally modified from the +parameters provided on the command line. Global reductions ~~~~~~~~~~~~~~~~~ diff --git a/doc/sphinx/src/outputs.rst b/doc/sphinx/src/outputs.rst index c01c957fdcf5..81f32d17183b 100644 --- a/doc/sphinx/src/outputs.rst +++ b/doc/sphinx/src/outputs.rst @@ -3,10 +3,10 @@ Outputs ======= -Outputs from Parthenon are controled via ```` blocks, +Outputs from Parthenon are controlled via ```` blocks, where ``*`` should be replaced by a unique integer for each block. -To disable an output block without removing it from the intput file set +To disable an output block without removing it from the input file set the block's ``dt < 0.0``. In addition to time base outputs, two additional options to trigger @@ -113,7 +113,7 @@ Restart Files Parthenon allows users to output restart files for restarting a simulation. The restart file captures the input file, so no input file -is required to be specified. Parameters for the input can be overriden +is required to be specified. Parameters for the input can be overridden in the usual way from the command line. At a future date we will allow for users the ability to extensively edit the parameters stored within the restart file. @@ -133,8 +133,9 @@ This will produce an hdf5 (``.rhdf``) output file every 1 units of simulation time that can be used for restarting the simulation. To use this restart file, simply specify the restart file with a -``-r `` at the command line. It is an error to specify an -input file with the ``-i`` flag when using the restart option. +``-r `` at the command line. If both ``-r `` +and ``-i `` are specified, the simulation will be restarted from +the restart file with input parameters updated (or added) from the input file. For physics developers: The fields to be output are automatically selected as all the variables that have either the ``Independent`` or @@ -174,7 +175,7 @@ Currently supported are - weighting by volume and/or variable The output format follows ``numpy`` convention, so that plotting data -with Python based machinery should be straightfoward (see example below). +with Python based machinery should be straightforward (see example below). In other words, 2D histograms use C-ordering corresponding to ``[x,y]`` indexing with ``y`` being the fast index. In general, histograms are calculated using inclusive left bin edges and @@ -217,7 +218,7 @@ with the following parameters - ``hist_names=STRING, STRING, STRING, ...`` (comma separated names) The names of the histograms in this block. - Will be used as preifx in the block as well as in the output file. + Will be used as prefix in the block as well as in the output file. All histograms will be written to the same output file with the "group" in the output corresponding to the histogram name. - ``NAME_ndim=INT`` (either ``1`` or ``2``) @@ -333,7 +334,7 @@ Support for Ascent is disabled by default and must be enabled via ``PARTHENON_EN In the input file, include a ```` block and specify ``file_type = ascent``. A ``dt`` parameter controls the frequency of outputs for simulations involving evolution. *Note* that in principle Ascent can control its own output cadence (including -automated tiggers). +automated triggers). If you want to call Ascent on every cycle, set ``dt`` to a value smaller than the actual simulation ``dt``. The mandatory ``actions_file`` parameter points to a separate file that defines Ascent actions in ``.yaml`` or ``.json`` format, see @@ -347,7 +348,7 @@ If component label(s) are provided, they will be added as a suffix, e.g,. Otherwise, an integer index is added for vectors/tensors with more than one component, i.e., vectors/tensors with a single component and without component labels will not contain a suffix. The definition of component labels for variables is typically done by downstream codes -so that the downstream documention should be consulted for more specific information. +so that the downstream documentation should be consulted for more specific information. A ```` block might look like:: diff --git a/src/argument_parser.hpp b/src/argument_parser.hpp index 5019cab3e4cb..1bdcb9fdd566 100644 --- a/src/argument_parser.hpp +++ b/src/argument_parser.hpp @@ -47,7 +47,6 @@ class ArgParse { case 'i': // -i invalid = invalid_arg(); input_filename = argv[++i]; - iarg_flag = 1; break; case 'r': // -r invalid = invalid_arg(); @@ -129,7 +128,6 @@ class ArgParse { int analysis_flag = 0; int res_flag = 0; int narg_flag = 0; - int iarg_flag = 0; int mesh_flag = 0; int wtlim = 0; int exit_flag = 0; diff --git a/src/parthenon_manager.cpp b/src/parthenon_manager.cpp index 6e056097c24b..69797ae81553 100644 --- a/src/parthenon_manager.cpp +++ b/src/parthenon_manager.cpp @@ -95,10 +95,9 @@ ParthenonStatus ParthenonManager::ParthenonInitEnv(int argc, char *argv[]) { SignalHandler::SignalHandlerInit(); if (Globals::my_rank == 0 && arg.wtlim > 0) SignalHandler::SetWallTimeAlarm(arg.wtlim); - // Populate the ParameterInput object - if (arg.input_filename != nullptr) { - pinput = std::make_unique(arg.input_filename); - } else if (arg.res_flag != 0) { + // Populate the ParameterInput object. + // If restart, then ParameterInput in the restart file takes precedence. + if (arg.res_flag != 0) { // Read input from restart file restartReader = std::make_unique(arg.restart_filename); @@ -108,6 +107,20 @@ ParthenonStatus ParthenonManager::ParthenonInitEnv(int argc, char *argv[]) { std::istringstream is(inputString); pinput->LoadFromStream(is); } + // If an input was provided + if (arg.input_filename != nullptr) { + // Modify info read from restart file + if (arg.res_flag != 0) { + IOWrapper infile; + infile.Open(arg.input_filename, IOWrapper::FileMode::read); + pinput->LoadFromFile(infile); + infile.Close(); + + // Populate new object for fresh simulation + } else { + pinput = std::make_unique(arg.input_filename); + } + } // Modify based on command line inputs pinput->ModifyFromCmdline(argc, argv); diff --git a/tst/regression/test_suites/restart/parthinput_override.restart b/tst/regression/test_suites/restart/parthinput_override.restart new file mode 100644 index 000000000000..c5b368aebcbd --- /dev/null +++ b/tst/regression/test_suites/restart/parthinput_override.restart @@ -0,0 +1,9 @@ +# ======================================================================================== +# Parthenon performance portable AMR framework +# Copyright(C) 2024 The Parthenon collaboration +# Licensed under the 3-clause BSD License, see LICENSE file for details +# ======================================================================================== + +# Testing to override parameters in a restart file from an input file + +problem_id=silver diff --git a/tst/regression/test_suites/restart/restart.py b/tst/regression/test_suites/restart/restart.py index 0f9727052f8e..4b1602d44468 100644 --- a/tst/regression/test_suites/restart/restart.py +++ b/tst/regression/test_suites/restart/restart.py @@ -1,6 +1,6 @@ # ======================================================================================== # Parthenon performance portable AMR framework -# Copyright(C) 2020-2021 The Parthenon collaboration +# Copyright(C) 2020-2024 The Parthenon collaboration # Licensed under the 3-clause BSD License, see LICENSE file for details # ======================================================================================== # (C) (or copyright) 2020-2021. Triad National Security, LLC. All rights reserved. @@ -38,7 +38,8 @@ def Prepare(self, parameters, step): parameters.driver_cmd_line_args = [ "-r", "gold.out0.00001.rhdf", - "parthenon/job/problem_id=silver", + "-i", + f"{parameters.parthenon_path}/tst/regression/test_suites/restart/parthinput_override.restart", "-t", "00:00:02", ]