Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 6 additions & 2 deletions Docs/sphinx_documentation/source/GPU.rst
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,12 @@ to :cpp:`The_Arena()` to reduce memory fragmentation.
In :cpp:`amrex::Initialize`, a large amount of GPU device memory is
allocated and is kept in :cpp:`The_Arena()`. The default is 3/4 of the
total device memory, and it can be changed with a :cpp:`ParmParse`
parameter, ``amrex.the_arena_init_size``, in the unit of bytes. The default
initial size for other arenas is 8388608 (i.e., 8 MB). For
parameter, ``amrex.the_arena_init_size``, in the unit of bytes. The default
can also be changed with an environment variable
``AMREX_THE_ARENA_INIT_SIZE=X``, where ``X`` is the number of bytes. When
both the :cpp:`ParmParse` parameter and the environment variable are
present, the former will override the latter.
The default initial size for other arenas is 8388608 (i.e., 8 MB). For
:cpp:`The_Managed_Arena()` and :cpp:`The_Device_Arena()`, it can be changed
with ``amrex.the_managed_arena_init_size`` and
``amrex.the_device_arena_init_size``, respectively, if they are not an alias
Expand Down
5 changes: 5 additions & 0 deletions Src/Base/AMReX_Arena.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@ Arena::Initialize (bool minimal)
the_pinned_arena_release_threshold = Gpu::Device::totalGlobalMem() / Gpu::Device::numDevicePartners() / 2L;
#endif

// Overwrite the initial size with environment variables
if (char const* init_size_p = std::getenv("AMREX_THE_ARENA_INIT_SIZE")) {
the_arena_init_size = std::stoi(init_size_p);
}

ParmParse pp("amrex");
pp.queryAdd( "the_arena_init_size", the_arena_init_size);
pp.queryAdd( "the_device_arena_init_size", the_device_arena_init_size);
Expand Down
Loading