Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set amrex.omp_threads = "nosmt" #4393

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Docs/source/usage/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ Overall simulation parameters
For all regular WarpX operations, we therefore do explicit memory transfers without the need for managed memory and thus changed the AMReX default to false.
`Please also see the documentation in AMReX <https://amrex-codes.github.io/amrex/docs_html/GPU.html#inputs-parameters>`__.

* ``amrex.omp_threads`` (``system``, ``nosmt`` or positive integer; default is ``nosmt``)
An integer number can be set in lieu of the ``OMP_NUM_THREADS`` environment variable to control the number of OpenMP threads to use for the ``OMP`` compute backend on CPUs.
By default, we use the ``nosmt`` option, which overwrites the OpenMP default of spawning one thread per logical CPU core, and instead only spawns a number of threads equal to the number of physical CPU cores on the machine.
If set, the environment variable ``OMP_NUM_THREADS`` takes precedence over ``system`` and ``nosmt``, but not over integer numbers set in this option.


Signal Handling
^^^^^^^^^^^^^^^

Expand Down
4 changes: 4 additions & 0 deletions Source/Initialization/WarpXAMReXInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ namespace {
bool the_arena_is_managed = false; // AMReX' default: true
pp_amrex.queryAdd("the_arena_is_managed", the_arena_is_managed);

// https://amrex-codes.github.io/amrex/docs_html/InputsComputeBackends.html
std::string omp_threads = "nosmt"; // AMReX' default: system
pp_amrex.queryAdd("omp_threads", omp_threads);

// Work-around:
// If warpx.numprocs is used for the domain decomposition, we will not use blocking factor
// to generate grids. Nonetheless, AMReX has asserts in place that validate that the
Expand Down