diff --git a/Docs/sphinx_documentation/source/Basics.rst b/Docs/sphinx_documentation/source/Basics.rst index da14577f26e..5b9b137e30c 100644 --- a/Docs/sphinx_documentation/source/Basics.rst +++ b/Docs/sphinx_documentation/source/Basics.rst @@ -278,6 +278,9 @@ runtime error that will abort the run. Math Expressions ---------------- +.. versionadded:: 24.08 + Math expression support in :cpp:`ParmParse`. + :cpp:`ParmParse` supports math expressions for integers and floating point numbers. For example, @@ -600,6 +603,9 @@ literals. Additionally, a floating point like number with a positive exponent may be accepted as an integer if it is reasonable to do so. For example, it's okay to have ``1.234e3``, but ``1.234e2`` is an error. + .. versionadded:: 24.08 + Support for ``'`` and ``e`` in :cpp:`IParser` integers. + .. _sec:basics:initialize: Initialize and Finalize @@ -1057,7 +1063,7 @@ an :cpp:`int` pointer or array specifying periodicity. If a :cpp:`RealBox` is no given in the first constructor, AMReX will construct one based on :cpp:`ParmParse` parameters, ``geometry.prob_lo`` / ``geometry.prob_hi`` / ``geometry.prob_extent``, where each of the parameter is an array of ``AMREX_SPACEDIM`` real numbers. -See the section on :ref:`sec:inputs:pd` for more details about how to specify these. +See the section on :ref:`sec:inputs:geom` for more details about how to specify these. The argument for coordinate system is an integer type with valid values being 0 (Cartesian), or 1 (cylindrical), or 2 (spherical). If it diff --git a/Docs/sphinx_documentation/source/InputsCheckpoint.rst b/Docs/sphinx_documentation/source/InputsCheckpoint.rst deleted file mode 100644 index 13bae0e467f..00000000000 --- a/Docs/sphinx_documentation/source/InputsCheckpoint.rst +++ /dev/null @@ -1,18 +0,0 @@ -.. _Chap:InputsCheckpoint: - -Checkpoint/Restart -================== - -The following inputs must be preceded by "amr" and control checkpoint/restart. - -+------------------+-----------------------------------------------------------------------+-------------+-----------+ -| | Description | Type | Default | -+==================+=======================================================================+=============+===========+ -| restart | If present, then the name of file to restart from | String | None | -+------------------+-----------------------------------------------------------------------+-------------+-----------+ -| check_int | Frequency of checkpoint output; | Int | -1 | -| | if -1 then no checkpoints will be written | | | -+------------------+-----------------------------------------------------------------------+-------------+-----------+ -| check_file | Prefix to use for checkpoint output | String | chk | -+------------------+-----------------------------------------------------------------------+-------------+-----------+ - diff --git a/Docs/sphinx_documentation/source/InputsComputeBackends.rst b/Docs/sphinx_documentation/source/InputsComputeBackends.rst deleted file mode 100644 index 26e5d527508..00000000000 --- a/Docs/sphinx_documentation/source/InputsComputeBackends.rst +++ /dev/null @@ -1,21 +0,0 @@ -.. _Chap:InputsComputeBackends: - -Compute Backends -================ - -The following inputs must be preceded by ``amrex.`` and determine runtime options of CPU or GPU compute implementations. - -+------------------------+-----------------------------------------------------------------------+-------------+------------+ -| Parameter | Description | Type | Default | -+========================+=======================================================================+=============+============+ -| ``omp_threads`` | If OpenMP is enabled, this can be used to set the default number of | String | ``system`` | -| | threads. The special value ``nosmt`` can be used to avoid using | or Int | | -| | threads for virtual cores (aka Hyperthreading or SMT), as is default | | | -| | in OpenMP, and instead only spawns threads equal to the number of | | | -| | physical cores in the system. | | | -| | For the values ``system`` and ``nosmt``, the environment variable | | | -| | ``OMP_NUM_THREADS`` takes precedence. For Integer values, | | | -| | ``OMP_NUM_THREADS`` is ignored. | | | -+------------------------+-----------------------------------------------------------------------+-------------+------------+ - -For GPU-specific parameters, see also the :ref:`GPU chapter `. diff --git a/Docs/sphinx_documentation/source/InputsLoadBalancing.rst b/Docs/sphinx_documentation/source/InputsLoadBalancing.rst deleted file mode 100644 index ea7ff2ebaae..00000000000 --- a/Docs/sphinx_documentation/source/InputsLoadBalancing.rst +++ /dev/null @@ -1,56 +0,0 @@ -.. _Chap:InputsLoadBalancing: - -Gridding and Load Balancing -=========================== - -The following inputs must be preceded by "amr" and determine how we create the grids and how often we regrid. - -+------------------------+-----------------------------------------------------------------------+-------------+-----------+ -| Parameter | Description | Type | Default | -+========================+=======================================================================+=============+===========+ -| regrid_int | How often to regrid (in number of steps at level 0) | Int | -1 | -| | if regrid_int = -1 then no regridding will occur | | | -+------------------------+-----------------------------------------------------------------------+-------------+-----------+ -| max_grid_size_x | Maximum number of cells at level 0 in each grid in x-direction | Int | 32 | -+------------------------+-----------------------------------------------------------------------+-------------+-----------+ -| max_grid_size_y | Maximum number of cells at level 0 in each grid in y-direction | Int | 32 | -+------------------------+-----------------------------------------------------------------------+-------------+-----------+ -| max_grid_size_z | Maximum number of cells at level 0 in each grid in z-direction | Int | 32 | -+------------------------+-----------------------------------------------------------------------+-------------+-----------+ -| blocking_factor_x | Each grid must be divisible by blocking_factor_x in x-direction | Int | 8 | -| | (must be 1 or power of 2) | | | -+------------------------+-----------------------------------------------------------------------+-------------+-----------+ -| blocking_factor_y | Each grid must be divisible by blocking_factor_y in y-direction | Int | 8 | -| | (must be 1 or power of 2) | | | -+------------------------+-----------------------------------------------------------------------+-------------+-----------+ -| blocking_factor_z | Each grid must be divisible by blocking_factor_z in z-direction | Int | 8 | -| | (must be 1 or power of 2) | | | -+------------------------+-----------------------------------------------------------------------+-------------+-----------+ -| refine_grid_layout | Split grids in half until the number of grids is no less than the | Bool | true | -| | number of procs. (Will be overridden if refine_grid_layout_[x,y,z] | | | -| | is specified) | | | -+------------------------+-----------------------------------------------------------------------+-------------+-----------+ -| refine_grid_layout_x | Allow grids to be split in the x-dimension when refining the layout. | Int | 1 | -| | (1 to allow or 0 to disallow) | | | -+------------------------+-----------------------------------------------------------------------+-------------+-----------+ -| refine_grid_layout_y | Allow grids to be split in the y-dimension when refining the layout. | Int | 1 | -| | (1 to allow or 0 to disallow) | | | -+------------------------+-----------------------------------------------------------------------+-------------+-----------+ -| refine_grid_layout_z | Allow grids to be split in the z-dimension when refining the layout. | Int | 1 | -| | (1 to allow or 0 to disallow) | | | -+------------------------+-----------------------------------------------------------------------+-------------+-----------+ - -The following inputs must be preceded by "particles". - -+-------------------+-----------------------------------------------------------------------+-------------+-----------+ -| Parameter | Description | Type | Default | -+===================+=======================================================================+=============+===========+ -| max_grid_size_x | Maximum number of cells at level 0 in each grid in x-direction | Int | 32 | -| | for grids in the ParticleBoxArray if dual_grid is true | | | -+-------------------+-----------------------------------------------------------------------+-------------+-----------+ -| max_grid_size_y | Maximum number of cells at level 0 in each grid in y-direction | Int | 32 | -| | for grids in the ParticleBoxArray if dual_grid is true | | | -+-------------------+-----------------------------------------------------------------------+-------------+-----------+ -| max_grid_size_z | Maximum number of cells at level 0 in each grid in z-direction | Int | 32 | -| | for grids in the ParticleBoxArray if dual_grid is true. | | | -+-------------------+-----------------------------------------------------------------------+-------------+-----------+ diff --git a/Docs/sphinx_documentation/source/InputsPlotFiles.rst b/Docs/sphinx_documentation/source/InputsPlotFiles.rst deleted file mode 100644 index 9e8789a90ac..00000000000 --- a/Docs/sphinx_documentation/source/InputsPlotFiles.rst +++ /dev/null @@ -1,18 +0,0 @@ -.. _Chap:InputsPlotfiles: - -Plotfiles and Other Output -========================== - -The following inputs must be preceded by "amr" and control the frequency and naming of plotfile generation, as well -as whether a plotfile should be written out immediately after restarting a simulation. - -+---------------------+-----------------------------------------------------------------------+-------------+-----------+ -| | Description | Type | Default | -+=====================+=======================================================================+=============+===========+ -| plot_int | Frequency of plotfile output; | Int | -1 | -| | if -1 then no plotfiles will be written | | | -+---------------------+-----------------------------------------------------------------------+-------------+-----------+ -| plotfile_on_restart | Should we write a plotfile when we restart (only used if plot_int>0) | Bool | 0 (false) | -+---------------------+-----------------------------------------------------------------------+-------------+-----------+ -| plot_file | Prefix to use for plotfile output | String | plt | -+---------------------+-----------------------------------------------------------------------+-------------+-----------+ diff --git a/Docs/sphinx_documentation/source/InputsProblemDefinition.rst b/Docs/sphinx_documentation/source/InputsProblemDefinition.rst deleted file mode 100644 index 3e67ffdb38e..00000000000 --- a/Docs/sphinx_documentation/source/InputsProblemDefinition.rst +++ /dev/null @@ -1,41 +0,0 @@ -.. _sec:inputs:pd: - -Problem Definition -================== - -The following inputs must be preceded by "amr." - -+-------------------+-----------------------------------------------------------------------+-------------+-----------+ -| | Description | Type | Default | -+===================+=======================================================================+=============+===========+ -| n_cell | Number of cells at level 0 in each coordinate direction | Int Int Int | None | -+-------------------+-----------------------------------------------------------------------+-------------+-----------+ -| max_level | Maximum level of refinement allowed (0 when single-level) | Int | None | -+-------------------+-----------------------------------------------------------------------+-------------+-----------+ - -The following inputs must be preceded by "geometry." - -+-----------------+-----------------------------------------------------------------------+-------------+-----------+ -| | Description | Type | Default | -+=================+=======================================================================+=============+===========+ -| coord_sys | 0 for Cartesian | Int | 0 | -+-----------------+-----------------------------------------------------------------------+-------------+-----------+ -| is_periodic | 1 for true, 0 for false (one value for each coordinate direction) | Ints | 0 0 0 | -+-----------------+-----------------------------------------------------------------------+-------------+-----------+ -| prob_lo | Low corner of physical domain (physical not index space) | Reals | 0 0 0 | -+-----------------+-----------------------------------------------------------------------+-------------+-----------+ -| prob_hi | High corner of physical domain (physical not index space) | Reals | None | -+-----------------+-----------------------------------------------------------------------+-------------+-----------+ -| prob_extent | Extent of physical domain (physical not index space) | Reals | None | -+-----------------+-----------------------------------------------------------------------+-------------+-----------+ - -Note that internally ``prob_lo`` and ``prob_hi`` are the variables carried by the ``Geometry`` class. -In the inputs file (or command line), one can specify -1) ``geometry.prob_hi`` only or -2) ``geometry.prob_extent`` only or -3) ``geometry.prob_lo`` and ``geometry.prob_hi`` or -4) ``geometry.prob_lo`` and ``geometry.prob_extent``. -If ``geometry.prob_lo`` is not specified then it will be 0 in each coordinate direction. -If ``geometry.prob_extent`` is specified (and ``geometry.prob_hi`` is not) then internally -"prob_hi" will be set to "prob_lo" + "prob_extent". - diff --git a/Docs/sphinx_documentation/source/InputsTimeStepping.rst b/Docs/sphinx_documentation/source/InputsTimeStepping.rst deleted file mode 100644 index 144ef0fe6dd..00000000000 --- a/Docs/sphinx_documentation/source/InputsTimeStepping.rst +++ /dev/null @@ -1,18 +0,0 @@ -.. sec:InputsTimeStepping: - -Time Stepping -============= - -The following inputs must be preceded by "amr." Note that if both are specified, both criteria -are used and the simulation still stop when the first criterion is hit. In the case of unsteady flow, -the simulation will stop when either the number of steps reaches max_step or time reaches stop_time. -In the case of unsteady flow, the simulation will stop when either the tolerance (difference between -subsequent steps) is reached or the number of iterations reaches the maximum number specified. - -+------------------+-----------------------------------------------------------------------+-------------+-----------+ -| | Description | Type | Default | -+==================+=======================================================================+=============+===========+ -| max_step | Maximum number of time steps to take | Int | -1 | -+------------------+-----------------------------------------------------------------------+-------------+-----------+ -| stop_time | Maximum time to reach | Real | -1.0 | -+------------------+-----------------------------------------------------------------------+-------------+-----------+ diff --git a/Docs/sphinx_documentation/source/Inputs_Chapter.rst b/Docs/sphinx_documentation/source/Inputs_Chapter.rst deleted file mode 100644 index 43ead40b3c6..00000000000 --- a/Docs/sphinx_documentation/source/Inputs_Chapter.rst +++ /dev/null @@ -1,15 +0,0 @@ -.. _Chap:Inputs: - -Run-time Inputs -=============== - -.. toctree:: - :maxdepth: 1 - - InputsProblemDefinition - InputsTimeStepping - InputsLoadBalancing - InputsComputeBackends - InputsPlotFiles - InputsCheckpoint - diff --git a/Docs/sphinx_documentation/source/RuntimeParameters.rst b/Docs/sphinx_documentation/source/RuntimeParameters.rst new file mode 100644 index 00000000000..d0242388737 --- /dev/null +++ b/Docs/sphinx_documentation/source/RuntimeParameters.rst @@ -0,0 +1,533 @@ + +.. _chap:inputs: + +Runtime Parameters +================== + +.. role:: cpp(code) + :language: c++ + +This chapter contains a list of AMReX :cpp:`ParmParse` runtime parameters +and their default values. They can be set by either including them in an +inputs file, or specifying them at the command line, or passing a function +to :cpp:`amrex::Initialize` and the function adds parameters to AMReX's +:cpp:`ParmParse`'s parameter database. For more information on +:cpp:`ParmParse`, see :ref:`sec:basics:parmparse`. + +.. important:: AMReX reserves the following prefixes in :cpp:`ParmParse` + parameters: ``amr``, ``amrex``, ``blprofiler``, ``device``, + ``DistributionMapping``, ``eb2``, ``fab``, ``fabarray``, + ``geometry``, ``particles``, ``tiny_profiler``, and + ``vismf``. + +AMR +--- + +AMR Mesh +^^^^^^^^ + +AMR mesh + +.. + AmrCore/AMReX_AmrMesh.cpp: ParmParse pp("amr"); + +Amr Class +^^^^^^^^^ + +AmrClass + +.. + Amr/AMReX_Amr.cpp: ParmParse pp("amr"); + Amr/AMReX_AmrLevel.cpp: ParmParse pp("amr"); + +Basic Controls +-------------- + +.. py:data:: amrex.verbose + :type: int + :value: 1 + + This controls the verbosity level of AMReX. Besides using + :cpp:`ParmParse`, you can also call :cpp:`amrex::SetVerbose(int)` to set + it. + +.. py:data:: amrex.init_snan + :type: bool + :value: [build dependent] + + This controls whether :cpp:`MultiFab`, :cpp:`FArrayBox`, + :cpp:`BaseFab`, :cpp:`PODVectors`, + :cpp:`Gpu::DeviceVector`, etc. will be initialized to + signaling NaNs at construction. The default value is true for debug + builds. For non-debug builds, the default is false unless ``TEST=TRUE`` + for GNU Make or ``AMReX_TESTING`` is enabled for CMake. + +.. py:data:: amrex.abort_on_unused_inputs + :type: bool + :value: false + + If this is true, AMReX will abort during :cpp:`amrex::Finalize`. + +.. py:data:: amrex.parmparse.verbose + :type: int + :value: amrex.verbose + + If this is greater than zero, unused :cpp:`ParmParse` variables will be + printed out during :cpp:`amrex::Finalize` or + :cpp:`ParmParse::QueryUnusedInputs`. The parameter can also be set by + calling :cpp:`amrex::ParmParse::SetVerbose(int)`. + +.. py:data:: amrex.device.verbose + :type: int + :value: 0 + + This controls whether AMReX prints out GPU device properties such name, + vendor, total memory size, etc. This is only relevant for GPU runs. + +.. py:data:: amrex.max_gpu_streams + :type: int + :value: 4 + + This controls the number of GPU streams used by AMReX. It's only relevant + for GPU runs. + +.. py:data:: amrex.omp_threads + :type: string + :value: system + + If OpenMP is enabled, this can be used to set the default number of + threads. Possible values are ``system``, ``nosmt``, or an integer + string. The special value ``nosmt`` can be used to avoid using threads + for virtual cores (aka Hyperthreading or SMT), as is default in OpenMP, + and instead only spawns threads equal to the number of physical cores in + the system. For the values ``system`` and ``nosmt``, the environment + variable ``OMP_NUM_THREADS`` takes precedence. If the string can be + converted to an integer, ``OMP_NUM_THREADS`` is ignored. + +.. py:data:: amrex.memory_log + :type: string + :value: memlog + + This is the name of the memory log file when memory profiling is enabled. + +Communication +------------- + +.. py:data:: amrex.use_gpu_aware_mpi + :type: bool + :value: false + + For GPU runs, this controls the memory type used for AMReX's + communication buffers. When set to true, AMReX uses GPU device memory for + communication data in MPI function calls. When set to false, the data are + placed in pinned memory. Note that this flag does not enable GPU-aware + MPI by itself. Enabling GPU-aware MPI is system dependent. Users should + consult their system's documentation for instructions on setting up the + environment and linking to GPU-aware MPI libraries. + +Distribution Mapping +-------------------- + +.. py:data:: DistributionMapping.verbose + :type: int + :value: 0 + + This controls the verbosity level of :cpp:`DistributionMapping` + functions. + +.. py:data:: DistributionMapping.strategy + :type: string + :value: SFC + + This is the default :cpp:`DistributionMapping` strategy. Possible values + are ``SFC``, ``KNAPSACK``, ``ROUNDROBIN``, or ``RRSFC``. Note that the + default strategy can also be set by calling + :cpp:`DistributionMapping::strategy(DistributionMapping::Strategy)`. + +Embedded Boundary +----------------- + +EB + +.. + EB/AMReX_EB2.cpp: ParmParse pp("eb2"); + EB/AMReX_EB2_Level.H: ParmParse pp("eb2"); + + +Error Handling +-------------- + +By default AMReX installs a signal handler that will be run when a signal +such as segfault is received. You can also enable floating point exception +trapping. The signal handler will print out backtraces that can be useful +for debugging. + +.. note:: Floating point exception trapping is not enabled by default, + because compilers might generate optimized SIMD code that raises the + exceptions. + +.. py:data:: amrex.signal_handling + :type: bool + :value: true + + This controls whether AMReX should handle signals. + +.. py:data:: amrex.handle_sigsegv + :type: bool + :value: true + + If both this flag and ``amrex.signal_handling`` are true, ``SIGSEGV`` + will be handled by AMReX. + +.. py:data:: amrex.handle_sigterm + :type: bool + :value: false + + If both this flag and ``amrex.signal_handling`` are true, ``SIGTERM`` + will be handled by AMReX. This flag is false by default because this + could generate lots of backtrace files on some batch systems that issue + ``SIGTERM`` for jobs running out of wall clock time. + +.. py:data:: amrex.handle_sigint + :type: bool + :value: true + + If both this flag and ``amrex.signal_handling`` are true, ``SIGINT`` + will be handled by AMReX. + +.. py:data:: amrex.handle_sigabrt + :type: bool + :value: true + + If both this flag and ``amrex.signal_handling`` are true, ``SIGABGT`` + will be handled by AMReX. + +.. py:data:: amrex.handle_sigfpe + :type: bool + :value: true + + If both this flag and ``amrex.signal_handling`` are true, ``SIGFPE`` + will be handled by AMReX. + + .. seealso:: + Use :py:data:`amrex.fpe_trap_invalid`, :py:data:`amrex.fpe_trap_zero` + and :py:data:`amrex.fpe_trap_overflow` to enable ``FE_INVALID``, + ``FE_DIVBYZERO`` and ``FE_OVERFLOW`` trapping, respectively. + +.. py:data:: amrex.handle_sigill + :type: bool + :value: true + + If both this flag and ``amrex.signal_handling`` are true, ``SIGILL`` + will be handled by AMReX. + +.. py:data:: amrex.throw_exception + :type: bool + :value: false + + If this flag is true and ``amrex.signal_handling`` is false, + :cpp:`amrex::Abort` and :cpp:`amrex::Error` will throw + :cpp:`std::runtime_error` instead of aborting immediately. Note that + according the C++ standard, if an exception is thrown and not caught, + :cpp:`std::terminate` will be called. + +.. py:data:: amrex.fpe_trap_invalid + :type: bool + :value: false + + If ``SIGFPE`` is handled by AMReX and this flag is true, ``FE_INVALID`` + (e.g., ``0/0``) trapping will be enabled. This flag has no effect on + Windows. + +.. py:data:: amrex.fpe_trap_zero + :type: bool + :value: false + + If ``SIGFPE`` is handled by AMReX and this flag is true, + ``FE_DIVBYZERO`` (e.g., ``1/0``) trapping will be enabled. This flag has + no effect on Windows. + +.. py:data:: amrex.fpe_trap_overflow + :type: bool + :value: false + + If ``SIGFPE`` is handled by AMReX and this flag is true, ``FE_OVERFLOW`` + (i.e., the result is too large to be representable) trapping will be + enabled. This flag has no effect on Windows. + +Extern +------ + +HDF5 +^^^^ + +.. + Extern/HDF5/AMReX_WriteBinaryParticleDataHDF5.H: ParmParse pp("particles"); + +Hypre +^^^^^ + +.. + pp.queryAdd("init_hypre", init_hypre); + pp.queryAdd("hypre_spgemm_use_vendor", hypre_spgemm_use_vendor); + pp.queryAdd("hypre_spmv_use_vendor", hypre_spmv_use_vendor); + pp.queryAdd("hypre_sptrans_use_vendor", hypre_sptrans_use_vendor); + Extern/HYPRE/AMReX_HypreIJIface.cpp: amrex::ParmParse pp; + Extern/HYPRE/AMReX_HypreIJIface.cpp: amrex::ParmParse pp(prefix); + + +.. _sec:inputs:geom: + +Geometry +-------- + +All these parameters are optional for constructing a :ref:`Geometry ` +object. There are only used if the information is not provided via function +arguments. + +.. py:data:: geometry.coord_sys + :type: int + :value: 0 + + This specifies the coordinate system type with valid values being 0 + (Cartesian), or 1 (cylindrical), or 2 (spherical). + +.. py:data:: geometry.prob_lo + :type: amrex::Real array + :value: 0 0 0 + + This specifies the position of the lower corner of the physical domain. + +.. py:data:: geometry.prob_hi + :type: amrex::Real array + :value: [none] + + This specifies the position of the upper corner of the physical + domain. If this is provided, :py:data:`geometry.prob_extent` will be + ignored. + +.. py:data:: geometry.prob_extent + :type: amrex::Real array + :value: [none] + + This specifies the length of the physical domain. If + :py:data:`geometry.prob_hi` is provided, this will be ignored. + +.. py:data:: geometry.is_periodic + :type: int array + :value: 0 0 0 + + These integer parameters are boolean flags to indicate whether the domain + is periodic in each direction. It's considered true (i.e., periodic) if + its value is non-zero, and false (i.e., non-periodic) if its value is + zero. + +I/O +--- + +.. py:data:: amrex.async_out + :type: bool + :value: false + + If this is true, AMReX's native mesh and particle plotfiles will be + written asynchronously by a background thread. + +.. py:data:: amrex.async_out_nfiles + :type: int + :value: 64 + + This is the maximum number of binary files on each AMR level that will be + used when AMReX writes a plotfile asynchronously. + +.. py:data:: vismf.verbose + :type: int + :value: 0 + + This controls the verbosity level of :cpp:`VisMF` functions. + +Memory +------ + +.. py:data:: amrex.the_arena_init_size + :type: long + :value: [system dependent] + + This controls the main memory arena's initial size in bytes. For CPU + runs, the default is 0, whereas for GPU runs, the default is set at run + time to 3/4 of the system's device memory. + + .. tip:: Since ``amrex v24.08``, instead of + ``amrex.the_arena_init_size=10000000000``, one can use + ``amrex.the_arena_init_size=10'000'000'000`` or + ``amrex.the_arena_init_size=1e10`` to set :cpp:`ParmParse` + integer parameters like this one. + +.. py:data:: amrex.the_device_arena_init_size + :type: long + :value: 8388608 [8 MB] + + This controls the GPU device arena's initial size in bytes. For CPU runs, + this is ignored. If the main arena uses the device memory (as opposed to + managed memory), this parameter is also ignored. + +.. py:data:: amrex.the_managed_arena_init_size + :type: long + :value: 8388608 [8 MB] + + This controls the managed device arena's initial size in bytes. For CPU + runs, this is ignored. If the main arena uses the managed memory (as + opposed to device memory), this parameter is also ignored. + +.. py:data:: amrex.the_pinned_arena_init_size + :type: long + :value: [system dependent] + + This controls the pinned host memory arena's initial size in bytes. The + default is 8 MB for CPU runs. For GPU runs it's set to half of the GPU + device memory be default. + +.. py:data:: amrex.the_comms_arena_init_size + :type: long + :value: 8388608 [8 MB] + + This controls the MPI communication memory arena's initial size in bytes. + +.. py:data:: amrex.the_arena_release_threshold + :type: long + :value: LONG_MAX + + This controls the release threshold of the main arena. + +.. py:data:: amrex.the_device_arena_release_threshold + :type: long + :value: LONG_MAX + + This controls the release threshold of the device arena. + +.. py:data:: amrex.the_managed_arena_release_threshold + :type: long + :value: LONG_MAX + + This controls the release threshold of the managed arena. + +.. py:data:: amrex.the_pinned_arena_release_threshold + :type: long + :value: LONG_MAX + + This controls the release threshold of the pinned arena. + +.. py:data:: amrex.the_comms_arena_release_threshold + :type: long + :value: LONG_MAX + + This controls the release threshold of the communication arena. + +.. py:data:: amrex.the_async_arena_release_threshold + :type: long + :value: LONG_MAX + + This controls the release threshold of the asynchronous arena. Note that + this is only relevant for the CUDA (>= 11.2) and HIP backends that + support stream-ordered memory allocator. + +.. py:data:: amrex.the_arena_is_managed + :type: bool + :value: false + + This controls if AMReX uses the managed memory for the main arena. This + is only relevant for GPU runs. + +.. py:data:: amrex.abort_on_out_of_gpu_memory + :type: bool + :value: false + + This controls if AMReX should simply abort when the reported free device + memory is less than the amount an arena is asked to allocate. Note that + for managed memory it's possible to allocate more than the amount of free + device memory available. However, the code will be very slow. This + parameter is only relevant for GPU runs. + +.. py:data:: amrex.mf.alloc_single_chunk + :type: bool + :value: false + + This controls if all the data in a :cpp:`FabArray` (including + :cpp:`MultiFab`) are in a contiguous chunk of memory. + +.. py:data:: amrex.vector_growth_factor + :type: amrex::Real + :value: 1.5 + + This controls the growth factor of :cpp:`amrex::PODVector` and its + derived classes such as :cpp:`amrex::Gpu::DeviceVector`, + :cpp:`amrex::Gpu::ManagedVector`, etc. A smaller value can avoid wasting + memory, but it may result in a performance penalty during resizing. + +Particles +--------- + +Particles + +.. + Particle/AMReX_ParticleContainerBase.cpp: ParmParse pp("particles"); + Particle/AMReX_ParticleContainerI.H: ParmParse pp("particles"); + Particle/AMReX_ParticleIO.H: ParmParse pp("particles"); + Particle/AMReX_TracerParticles.cpp: ParmParse pp("particles"); + Particle/AMReX_WriteBinaryParticleData.H: ParmParse pp("particles"); + + +Tiling +------ + +.. py:data:: fabarray.mfiter_tile_size + :type: int array + :value: [build dependent] + + This is the default size for :ref:`tiling `. For GPU + runs, it is disabled by default. For CPU runs, it is disabled by default + in 1D and 2D, but enabled in 3D with a tile size of 8 in the y and + z-directions. + +.. py:data:: fabarray.comm_tile_size + :type: int array + :value: [build dependent] + + This is the default tiling size used in moving data in and out of the MPI + communication buffer . It is disabled by default for GPU runs, but + enabled for CPU runs with a tile size of 8 in the y and z-directions (if + they exist). + +Tiny Profiler +------------- + +These parameters are ignored unless profiling with :cpp:`TinyProfiler` is +enabled. + +.. py:data:: tiny_profiler.verbose + :type: int + :value: 0 + + If this value is greater than 0, messages about entering or leaving + profiled regions will be printed on the I/O process. + +.. py:data:: tiny_profiler.print_threshold + :type: double + :value: 1.0 + + In the profiling report, regions with very small run times are not listed + individually. Instead, they are included in a section named "Other". This + parameter specifies the maximum inclusive run time that the "Other" + section can take in percent relative to the total run time. + +.. py:data:: tiny_profiler.device_synchronize_around_region + :type: bool + :value: false + + This parameter is only relevant for GPU runs. If it is set to true, the + current GPU stream is synchronized when entering and leaving a profiling + region. Because GPU kernels are asynchronous, time measurements without + synchronization could be misleading. Enabling this parameter can provide + more accurate measurements. However, the added synchronization points, + which are unnecessary for correctness, could potentially degrade the + performance. + diff --git a/Docs/sphinx_documentation/source/index.rst b/Docs/sphinx_documentation/source/index.rst index d302af07468..203545cf40a 100644 --- a/Docs/sphinx_documentation/source/index.rst +++ b/Docs/sphinx_documentation/source/index.rst @@ -57,7 +57,7 @@ Documentation on migration from BoxLib is available in the AMReX repository at D Visualization_Chapter Post_Processing_Chapter Debugging - Inputs_Chapter + RuntimeParameters AMReX_Profiling_Tools_Chapter External_Profiling_Tools_Chapter External_Frameworks_Chapter @@ -69,13 +69,6 @@ Documentation on migration from BoxLib is available in the AMReX repository at D :maxdepth: 1 :caption: API -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - The copyright notice of AMReX is included in the AMReX home directory as README.txt. Your use of this software is under the 3-clause BSD license -- the license agreement is included in the diff --git a/Src/Base/AMReX.H b/Src/Base/AMReX.H index ba131a9d94e..4094d4f2ff2 100644 --- a/Src/Base/AMReX.H +++ b/Src/Base/AMReX.H @@ -49,23 +49,23 @@ namespace amrex extern AMREX_EXPORT int verbose; - extern AMREX_EXPORT int signal_handling; - extern AMREX_EXPORT int handle_sigsegv; - extern AMREX_EXPORT int handle_sigterm; - extern AMREX_EXPORT int handle_sigint; - extern AMREX_EXPORT int handle_sigabrt; - extern AMREX_EXPORT int handle_sigfpe; + extern AMREX_EXPORT bool signal_handling; + extern AMREX_EXPORT bool handle_sigsegv; + extern AMREX_EXPORT bool handle_sigterm; + extern AMREX_EXPORT bool handle_sigint; + extern AMREX_EXPORT bool handle_sigabrt; + extern AMREX_EXPORT bool handle_sigfpe; - extern AMREX_EXPORT int call_addr2line; - extern AMREX_EXPORT int throw_exception; + extern AMREX_EXPORT bool call_addr2line; + extern AMREX_EXPORT bool throw_exception; - extern AMREX_EXPORT int regtest_reduction; + extern AMREX_EXPORT bool regtest_reduction; extern AMREX_EXPORT std::ostream* osout; extern AMREX_EXPORT std::ostream* oserr; extern AMREX_EXPORT ErrorHandler error_handler; - extern AMREX_EXPORT int abort_on_unused_inputs; + extern AMREX_EXPORT bool abort_on_unused_inputs; extern AMREX_EXPORT bool init_snan; } diff --git a/Src/Base/AMReX.cpp b/Src/Base/AMReX.cpp index 67a3e39aa58..77774ce6ffb 100644 --- a/Src/Base/AMReX.cpp +++ b/Src/Base/AMReX.cpp @@ -99,17 +99,17 @@ namespace system { std::string exename; int verbose = 1; - int signal_handling; - int handle_sigsegv; - int handle_sigterm; - int handle_sigint; - int handle_sigabrt; - int handle_sigfpe; - int handle_sigill; - int call_addr2line; - int throw_exception; - int regtest_reduction; - int abort_on_unused_inputs = 0; + bool signal_handling; + bool handle_sigsegv; + bool handle_sigterm; + bool handle_sigint; + bool handle_sigabrt; + bool handle_sigfpe; + bool handle_sigill; + bool call_addr2line; + bool throw_exception; + bool regtest_reduction; + bool abort_on_unused_inputs = false; std::ostream* osout = &std::cout; std::ostream* oserr = &std::cerr; ErrorHandler error_handler = nullptr; @@ -336,16 +336,16 @@ amrex::Initialize (int& argc, char**& argv, bool build_parm_parse, { system::exename.clear(); // system::verbose = 0; - system::regtest_reduction = 0; - system::signal_handling = 1; - system::handle_sigsegv = 1; - system::handle_sigterm = 0; - system::handle_sigint = 1; - system::handle_sigabrt = 1; - system::handle_sigfpe = 1; - system::handle_sigill = 1; - system::call_addr2line = 1; - system::throw_exception = 0; + system::regtest_reduction = false; + system::signal_handling = true; + system::handle_sigsegv = true; + system::handle_sigterm = false; + system::handle_sigint = true; + system::handle_sigabrt = true; + system::handle_sigfpe = true; + system::handle_sigill = true; + system::call_addr2line = true; + system::throw_exception = false; system::osout = &a_osout; system::oserr = &a_oserr; system::error_handler = a_errhandler; @@ -451,8 +451,9 @@ amrex::Initialize (int& argc, char**& argv, bool build_parm_parse, { ParmParse pp("amrex"); - pp.queryAdd("v", system::verbose); - pp.queryAdd("verbose", system::verbose); + if (! pp.query("verbose", "v", system::verbose)) { + pp.add("verbose", system::verbose); + } pp.queryAdd("init_snan", system::init_snan); } @@ -511,10 +512,10 @@ amrex::Initialize (int& argc, char**& argv, bool build_parm_parse, { ParmParse pp("amrex"); - pp.queryAdd("regtest_reduction", system::regtest_reduction); + pp.query("regtest_reduction", system::regtest_reduction); pp.queryAdd("signal_handling", system::signal_handling); pp.queryAdd("throw_exception", system::throw_exception); - pp.queryAdd("call_addr2line", system::call_addr2line); + pp.query("call_addr2line", system::call_addr2line); pp.queryAdd("abort_on_unused_inputs", system::abort_on_unused_inputs); #ifdef AMREX_USE_SYCL @@ -574,7 +575,7 @@ amrex::Initialize (int& argc, char**& argv, bool build_parm_parse, if (system::handle_sigfpe) { - int invalid = 0, divbyzero=0, overflow=0; + bool invalid = false, divbyzero=false, overflow=false; pp.queryAdd("fpe_trap_invalid", invalid); pp.queryAdd("fpe_trap_zero", divbyzero); pp.queryAdd("fpe_trap_overflow", overflow); @@ -604,7 +605,7 @@ amrex::Initialize (int& argc, char**& argv, bool build_parm_parse, #if defined(__APPLE__) && defined(__aarch64__) if (system::handle_sigill) { - int invalid = 0, divbyzero=0, overflow=0; + bool invalid = false, divbyzero=false, overflow=false; pp.queryAdd("fpe_trap_invalid", invalid); pp.queryAdd("fpe_trap_zero", divbyzero); pp.queryAdd("fpe_trap_overflow", overflow); diff --git a/Src/Base/AMReX_AsyncOut.cpp b/Src/Base/AMReX_AsyncOut.cpp index b235baa6580..3835c0b137e 100644 --- a/Src/Base/AMReX_AsyncOut.cpp +++ b/Src/Base/AMReX_AsyncOut.cpp @@ -10,7 +10,7 @@ namespace amrex::AsyncOut { namespace { -int s_asyncout = false; +bool s_asyncout = false; int s_noutfiles = 64; MPI_Comm s_comm = MPI_COMM_NULL; diff --git a/Src/Base/AMReX_DistributionMapping.cpp b/Src/Base/AMReX_DistributionMapping.cpp index 958f7ef9ec6..cfe16b346a1 100644 --- a/Src/Base/AMReX_DistributionMapping.cpp +++ b/Src/Base/AMReX_DistributionMapping.cpp @@ -118,14 +118,15 @@ DistributionMapping::Initialize () ParmParse pp("DistributionMapping"); - pp.queryAdd("v" , verbose); - pp.queryAdd("verbose", verbose); - pp.queryAdd("efficiency", max_efficiency); - pp.queryAdd("sfc_threshold", sfc_threshold); - pp.queryAdd("node_size", node_size); - pp.queryAdd("verbose_mapper", flag_verbose_mapper); - - std::string theStrategy; + if (! pp.query("verbose", "v", verbose)) { + pp.add("verbose", verbose); + } + pp.query("efficiency", max_efficiency); + pp.query("sfc_threshold", sfc_threshold); + pp.query("node_size", node_size); + pp.query("verbose_mapper", flag_verbose_mapper); + + std::string theStrategy("SFC"); if (pp.query("strategy", theStrategy)) { diff --git a/Src/Base/AMReX_FArrayBox.cpp b/Src/Base/AMReX_FArrayBox.cpp index 023cfff2738..3341c3da5dd 100644 --- a/Src/Base/AMReX_FArrayBox.cpp +++ b/Src/Base/AMReX_FArrayBox.cpp @@ -24,10 +24,8 @@ bool FArrayBox::initialized = false; #if defined(AMREX_DEBUG) || defined(AMREX_TESTING) bool FArrayBox::do_initval = true; -bool FArrayBox::init_snan = true; #else bool FArrayBox::do_initval = false; -bool FArrayBox::init_snan = false; #endif Real FArrayBox::initval; @@ -161,22 +159,7 @@ FArrayBox::initVal () noexcept runon = RunOn::Cpu; #endif - if (init_snan) { -#if defined(AMREX_USE_GPU) - if (runon == RunOn::Gpu) - { - amrex::ParallelFor(s, [=] AMREX_GPU_DEVICE (Long i) noexcept - { - p[i] = std::numeric_limits::signaling_NaN(); - }); - Gpu::streamSynchronize(); - } - else -#endif - { - amrex_array_init_snan(p, s); - } - } else if (do_initval) { + if (do_initval) { const Real x = initval; AMREX_HOST_DEVICE_PARALLEL_FOR_1D_FLAG (runon, s, i, { @@ -438,9 +421,8 @@ FArrayBox::Initialize () ? std::numeric_limits::quiet_NaN() : std::numeric_limits::max(); - pp.queryAdd("initval", initval); - pp.queryAdd("do_initval", do_initval); - pp.queryAdd("init_snan", init_snan); + pp.query("initval", initval); + pp.query("do_initval", do_initval); amrex::ExecOnFinalize(FArrayBox::Finalize); } diff --git a/Src/Base/AMReX_FabArrayBase.cpp b/Src/Base/AMReX_FabArrayBase.cpp index d8820e97e6f..00a0778cd43 100644 --- a/Src/Base/AMReX_FabArrayBase.cpp +++ b/Src/Base/AMReX_FabArrayBase.cpp @@ -27,10 +27,7 @@ namespace amrex { -// -// Set default values in Initialize()!!! -// -int FabArrayBase::MaxComp; +int FabArrayBase::MaxComp = 25; #if defined(AMREX_USE_GPU) @@ -99,11 +96,6 @@ FabArrayBase::Initialize () if (initialized) { return; } initialized = true; - // - // Set default values here!!! - // - FabArrayBase::MaxComp = 25; - ParmParse pp("fabarray"); Vector tilesize(AMREX_SPACEDIM); @@ -112,13 +104,25 @@ FabArrayBase::Initialize () { for (int i=0; i{AMREX_D_DECL(FabArrayBase::mfiter_tile_size[0], + FabArrayBase::mfiter_tile_size[1], + FabArrayBase::mfiter_tile_size[2])}); + } if (pp.queryarr("comm_tile_size", tilesize, 0, AMREX_SPACEDIM)) { for (int i=0; i{AMREX_D_DECL(FabArrayBase::comm_tile_size[0], + FabArrayBase::comm_tile_size[1], + FabArrayBase::comm_tile_size[2])}); + } - pp.queryAdd("maxcomp", FabArrayBase::MaxComp); + pp.query("maxcomp", FabArrayBase::MaxComp); if (MaxComp < 1) { MaxComp = 1; diff --git a/Src/Base/AMReX_ForkJoin.cpp b/Src/Base/AMReX_ForkJoin.cpp index f0cc03ae04b..ce51203ab35 100644 --- a/Src/Base/AMReX_ForkJoin.cpp +++ b/Src/Base/AMReX_ForkJoin.cpp @@ -68,8 +68,8 @@ ForkJoin::ForkJoin (const Vector &task_rank_pct) void ForkJoin::init(const Vector &task_rank_n) { - ParmParse pp("forkjoin"); - pp.queryAdd("verbose", flag_verbose); + ParmParse pp("amrex.forkjoin"); + pp.query("verbose", flag_verbose); const auto task_n = task_rank_n.size(); AMREX_ALWAYS_ASSERT_WITH_MESSAGE(task_n > 0, diff --git a/Src/Base/AMReX_Geometry.cpp b/Src/Base/AMReX_Geometry.cpp index 4cc374d9c3d..05b9bd1f528 100644 --- a/Src/Base/AMReX_Geometry.cpp +++ b/Src/Base/AMReX_Geometry.cpp @@ -15,16 +15,14 @@ namespace amrex { std::ostream& -operator<< (std::ostream& os, - const Geometry& g) +operator<< (std::ostream& os, const Geometry& g) { os << (CoordSys&) g << g.ProbDomain() << g.Domain() << 'P' << IntVect(g.isPeriodic()); return os; } std::istream& -operator>> (std::istream& is, - Geometry& g) +operator>> (std::istream& is, Geometry& g) { is >> (CoordSys&) g >> g.prob_domain >> g.domain; @@ -149,6 +147,11 @@ Geometry::Setup (const RealBox* rb, int coord, int const* isper) noexcept for (int i = 0; i < AMREX_SPACEDIM; i++) { prob_hi[i] = prob_lo[i] + prob_extent[i]; } + pp.addarr("prob_extent", prob_extent); + } + else + { + pp.addarr("prob_hi", prob_hi); } gg->prob_domain.setLo(prob_lo); diff --git a/Src/Base/AMReX_GpuDevice.cpp b/Src/Base/AMReX_GpuDevice.cpp index fa190a22c1c..842ccdd123e 100644 --- a/Src/Base/AMReX_GpuDevice.cpp +++ b/Src/Base/AMReX_GpuDevice.cpp @@ -155,8 +155,6 @@ Device::Initialize () max_gpu_streams = std::max(max_gpu_streams, 1); ParmParse pp("device"); - - pp.queryAdd("v", verbose); pp.queryAdd("verbose", verbose); if (amrex::Verbose()) { @@ -519,9 +517,9 @@ Device::initialize_gpu () int ny = 0; int nz = 0; - pp.queryAdd("numThreads.x", nx); - pp.queryAdd("numThreads.y", ny); - pp.queryAdd("numThreads.z", nz); + pp.query("numThreads.x", nx); + pp.query("numThreads.y", ny); + pp.query("numThreads.z", nz); numThreadsOverride.x = (int) nx; numThreadsOverride.y = (int) ny; @@ -531,9 +529,9 @@ Device::initialize_gpu () ny = 0; nz = 0; - pp.queryAdd("numBlocks.x", nx); - pp.queryAdd("numBlocks.y", ny); - pp.queryAdd("numBlocks.z", nz); + pp.query("numBlocks.x", nx); + pp.query("numBlocks.y", ny); + pp.query("numBlocks.z", nz); numBlocksOverride.x = (int) nx; numBlocksOverride.y = (int) ny; @@ -542,8 +540,8 @@ Device::initialize_gpu () // Graph initialization int graph_init = 0; int graph_size = 10000; - pp.queryAdd("graph_init", graph_init); - pp.queryAdd("graph_init_nodes", graph_size); + pp.query("graph_init", graph_init); + pp.query("graph_init_nodes", graph_size); if (graph_init) { diff --git a/Src/Base/AMReX_IArrayBox.H b/Src/Base/AMReX_IArrayBox.H index db0f26d5080..b070f5c1f96 100644 --- a/Src/Base/AMReX_IArrayBox.H +++ b/Src/Base/AMReX_IArrayBox.H @@ -94,7 +94,6 @@ public: void readFrom (std::istream& is); - //! Initialize from ParmParse with "fab" prefix. static void Initialize (); static void Finalize (); diff --git a/Src/Base/AMReX_IArrayBox.cpp b/Src/Base/AMReX_IArrayBox.cpp index 40b2762729d..1b9eea50658 100644 --- a/Src/Base/AMReX_IArrayBox.cpp +++ b/Src/Base/AMReX_IArrayBox.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include #include @@ -32,7 +31,6 @@ void IArrayBox::Initialize () { if (initialized) { return; } -// ParmParse pp("iab"); ifabio = std::make_unique(); diff --git a/Src/Base/AMReX_Machine.cpp b/Src/Base/AMReX_Machine.cpp index 97de84f30c8..a7cc0d3993e 100644 --- a/Src/Base/AMReX_Machine.cpp +++ b/Src/Base/AMReX_Machine.cpp @@ -327,9 +327,9 @@ class Machine void get_params () { - ParmParse pp("machine"); - pp.queryAdd("verbose", flag_verbose); - pp.queryAdd("very_verbose", flag_very_verbose); + ParmParse pp("amrex.machine"); + pp.query("verbose", flag_verbose); + pp.query("very_verbose", flag_very_verbose); } static std::string get_env_str (const std::string& env_key) diff --git a/Src/Base/AMReX_MemPool.cpp b/Src/Base/AMReX_MemPool.cpp index 9b03e6eca4a..3d4bfde5247 100644 --- a/Src/Base/AMReX_MemPool.cpp +++ b/Src/Base/AMReX_MemPool.cpp @@ -23,11 +23,6 @@ using namespace amrex; namespace { Vector > the_memory_pool; -#if defined(AMREX_TESTING) || defined(AMREX_DEBUG) - int init_snan = 1; -#else - int init_snan = 0; -#endif bool initialized = false; } @@ -41,9 +36,6 @@ void amrex_mempool_init () initialized = true; - ParmParse pp("fab"); - pp.queryAdd("init_snan", init_snan); - int nthreads = OpenMP::get_max_threads(); the_memory_pool.resize(nthreads); @@ -109,7 +101,7 @@ void amrex_mempool_get_stats (int& mp_min, int& mp_max, int& mp_tot) // min, max void amrex_real_array_init (Real* p, size_t nelems) { - if (init_snan) { amrex_array_init_snan(p, nelems); } + if (amrex::InitSNaN()) { amrex_array_init_snan(p, nelems); } } void amrex_array_init_snan (Real* p, size_t nelems) diff --git a/Src/Base/AMReX_OpenMP.cpp b/Src/Base/AMReX_OpenMP.cpp index 53782c8c347..56225253fa7 100644 --- a/Src/Base/AMReX_OpenMP.cpp +++ b/Src/Base/AMReX_OpenMP.cpp @@ -175,7 +175,7 @@ namespace amrex::OpenMP } } else { std::optional num_omp_threads = to_int(omp_threads); - if (num_omp_threads.has_value()) { + if (num_omp_threads.has_value() && num_omp_threads.value() > 0) { omp_set_num_threads(num_omp_threads.value()); } else { diff --git a/Src/Base/AMReX_ParallelDescriptor.H b/Src/Base/AMReX_ParallelDescriptor.H index f949ae6f45c..a41d393833d 100644 --- a/Src/Base/AMReX_ParallelDescriptor.H +++ b/Src/Base/AMReX_ParallelDescriptor.H @@ -107,7 +107,7 @@ while ( false ) void Initialize (); void Finalize (); - extern AMREX_EXPORT int use_gpu_aware_mpi; + extern AMREX_EXPORT bool use_gpu_aware_mpi; inline bool UseGpuAwareMpi () { return use_gpu_aware_mpi; } //! Split the process pool into teams diff --git a/Src/Base/AMReX_ParallelDescriptor.cpp b/Src/Base/AMReX_ParallelDescriptor.cpp index 60f08d4ca35..f6ac26e7984 100644 --- a/Src/Base/AMReX_ParallelDescriptor.cpp +++ b/Src/Base/AMReX_ParallelDescriptor.cpp @@ -57,9 +57,9 @@ namespace amrex::ParallelDescriptor { #endif #ifdef AMREX_USE_GPU - int use_gpu_aware_mpi = false; + bool use_gpu_aware_mpi = false; #else - int use_gpu_aware_mpi = false; + bool use_gpu_aware_mpi = false; #endif ProcessTeam m_Team; @@ -1537,9 +1537,9 @@ StartTeams () int do_team_reduce = 0; #if defined(BL_USE_MPI3) - ParmParse pp("team"); - pp.queryAdd("size", team_size); - pp.queryAdd("reduce", do_team_reduce); + ParmParse pp("amrex.team"); + pp.query("size", team_size); + pp.query("reduce", do_team_reduce); if (nprocs % team_size != 0) { amrex::Abort("Number of processes not divisible by team size"); } diff --git a/Src/Base/AMReX_ParmParse.H b/Src/Base/AMReX_ParmParse.H index d39a60d0bba..286bed71660 100644 --- a/Src/Base/AMReX_ParmParse.H +++ b/Src/Base/AMReX_ParmParse.H @@ -1084,6 +1084,38 @@ public: } } + /* + * \brief Query two names. + * + * This function queries with `new_name` first. If it's not found, it + * will try again with `old_name`. + */ + template + int query (const char* new_name, const char* old_name, T& ref) + { + return (this->query(new_name, ref) || + this->query(old_name, ref)); + } + + /** + * \brief Get using two names. + * + * This function queries with `new_name` first, If it's not found, it + * will try again with `old_name`. It's an error if neither name is + * found. + */ + template + void get (const char* new_name, const char* old_name, T& ref) + { + auto exist = this->query(new_name, old_name, ref); + if (!exist) { + amrex::ErrorStream() << "ParmParse::get failed to find " + << new_name << " and " << old_name << '\n'; + ParmParse::dumpTable(amrex::ErrorStream()); + amrex::Abort(); + } + } + //! Remove given name from the table. int remove (const char* name); diff --git a/Src/Base/AMReX_ParmParse.cpp b/Src/Base/AMReX_ParmParse.cpp index 7a1eae245d4..a56b1d14cdf 100644 --- a/Src/Base/AMReX_ParmParse.cpp +++ b/Src/Base/AMReX_ParmParse.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -139,12 +140,13 @@ template <> bool is (const std::string& str, bool& val) { - if ( str == "true" || str == "t" ) + auto const lo_str = amrex::toLower(str); + if ( lo_str == "true" || lo_str == "t" ) { val = true; return true; } - if ( str == "false" || str == "f" ) + if ( lo_str == "false" || lo_str == "f" ) { val = false; return true; @@ -1117,9 +1119,10 @@ ParmParse::Verbose () { if (pp_detail::verbose < 0) { pp_detail::verbose = std::max(amrex::Verbose(),0); - ParmParse pp("parmparse"); - pp.queryAdd("v", pp_detail::verbose); - pp.queryAdd("verbose", pp_detail::verbose); + ParmParse pp("amrex.parmparse"); + if (! pp.query("verbose", "v", pp_detail::verbose)) { + pp.add("verbose", pp_detail::verbose); + } } return pp_detail::verbose; } diff --git a/Src/Base/AMReX_TinyProfiler.H b/Src/Base/AMReX_TinyProfiler.H index 4ddbb05ea7e..4ffc5bdef22 100644 --- a/Src/Base/AMReX_TinyProfiler.H +++ b/Src/Base/AMReX_TinyProfiler.H @@ -143,7 +143,7 @@ private: static std::deque > ttstack; static std::map > statsmap; static double t_init; - static int device_synchronize_around_region; + static bool device_synchronize_around_region; static int n_print_tabs; static int verbose; static double print_threshold; diff --git a/Src/Base/AMReX_TinyProfiler.cpp b/Src/Base/AMReX_TinyProfiler.cpp index 1cffe78e75a..7e84b457e75 100644 --- a/Src/Base/AMReX_TinyProfiler.cpp +++ b/Src/Base/AMReX_TinyProfiler.cpp @@ -34,7 +34,7 @@ std::vector TinyProfiler::regionstack; std::deque > TinyProfiler::ttstack; std::map > TinyProfiler::statsmap; double TinyProfiler::t_init = std::numeric_limits::max(); -int TinyProfiler::device_synchronize_around_region = 0; +bool TinyProfiler::device_synchronize_around_region = false; int TinyProfiler::n_print_tabs = 0; int TinyProfiler::verbose = 0; double TinyProfiler::print_threshold = 1.; @@ -277,8 +277,9 @@ TinyProfiler::Initialize () noexcept { amrex::ParmParse pp("tiny_profiler"); pp.queryAdd("device_synchronize_around_region", device_synchronize_around_region); - pp.queryAdd("verbose", verbose); - pp.queryAdd("v", verbose); + if (! pp.query("verbose", "v", verbose)) { + pp.add("verbose", verbose); + } // Specify the maximum percentage of inclusive time // that the "Other" section in the output can have (defaultĀ 1%) pp.queryAdd("print_threshold", print_threshold); diff --git a/Src/Base/AMReX_VisMF.cpp b/Src/Base/AMReX_VisMF.cpp index 4c8b4b43fb2..2b0ac6716d0 100644 --- a/Src/Base/AMReX_VisMF.cpp +++ b/Src/Base/AMReX_VisMF.cpp @@ -77,24 +77,24 @@ VisMF::Initialize () amrex::ExecOnFinalize(VisMF::Finalize); ParmParse pp("vismf"); - pp.queryAdd("v",verbose); + pp.query("verbose", "v",verbose); int headerVersion(currentVersion); - pp.queryAdd("headerversion", headerVersion); + pp.query("headerversion", headerVersion); if(headerVersion != currentVersion) { currentVersion = static_cast (headerVersion); } - pp.queryAdd("groupsets", groupSets); - pp.queryAdd("setbuf", setBuf); - pp.queryAdd("usesingleread", useSingleRead); - pp.queryAdd("usesinglewrite", useSingleWrite); - pp.queryAdd("checkfilepositions", checkFilePositions); - pp.queryAdd("usepersistentifstreams", usePersistentIFStreams); - pp.queryAdd("usesynchronousreads", useSynchronousReads); - pp.queryAdd("usedynamicsetselection", useDynamicSetSelection); - pp.queryAdd("iobuffersize", ioBufferSize); - pp.queryAdd("allowsparsewrites", allowSparseWrites); + pp.query("groupsets", groupSets); + pp.query("setbuf", setBuf); + pp.query("usesingleread", useSingleRead); + pp.query("usesinglewrite", useSingleWrite); + pp.query("checkfilepositions", checkFilePositions); + pp.query("usepersistentifstreams", usePersistentIFStreams); + pp.query("usesynchronousreads", useSynchronousReads); + pp.query("usedynamicsetselection", useDynamicSetSelection); + pp.query("iobuffersize", ioBufferSize); + pp.query("allowsparsewrites", allowSparseWrites); initialized = true; } diff --git a/Src/Base/AMReX_iMultiFab.cpp b/Src/Base/AMReX_iMultiFab.cpp index d79e1d71444..090f1ca96d6 100644 --- a/Src/Base/AMReX_iMultiFab.cpp +++ b/Src/Base/AMReX_iMultiFab.cpp @@ -4,7 +4,6 @@ #include #include #include -#include #include #include diff --git a/Src/EB/AMReX_EB2_MultiGFab.cpp b/Src/EB/AMReX_EB2_MultiGFab.cpp index 8d09ca7c069..8461b5618d4 100644 --- a/Src/EB/AMReX_EB2_MultiGFab.cpp +++ b/Src/EB/AMReX_EB2_MultiGFab.cpp @@ -1,7 +1,6 @@ #include #include -#include namespace amrex::EB2 { diff --git a/Src/EB/AMReX_WriteEBSurface.cpp b/Src/EB/AMReX_WriteEBSurface.cpp index f26420cdcc7..2e94ccb7ffb 100644 --- a/Src/EB/AMReX_WriteEBSurface.cpp +++ b/Src/EB/AMReX_WriteEBSurface.cpp @@ -1,5 +1,4 @@ #include -#include #include #include #include diff --git a/Src/Extern/HYPRE/AMReX_HypreABecLap.H b/Src/Extern/HYPRE/AMReX_HypreABecLap.H index 1d57d942a14..9b0685de434 100644 --- a/Src/Extern/HYPRE/AMReX_HypreABecLap.H +++ b/Src/Extern/HYPRE/AMReX_HypreABecLap.H @@ -7,7 +7,6 @@ #include #include #include -#include #include #include