File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Docs/sphinx_documentation/source Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -560,8 +560,12 @@ to :cpp:`The_Arena()` to reduce memory fragmentation.
560560In :cpp: `amrex::Initialize `, a large amount of GPU device memory is
561561allocated and is kept in :cpp: `The_Arena() `. The default is 3/4 of the
562562total device memory, and it can be changed with a :cpp: `ParmParse `
563- parameter, ``amrex.the_arena_init_size ``, in the unit of bytes. The default
564- initial size for other arenas is 8388608 (i.e., 8 MB). For
563+ parameter, ``amrex.the_arena_init_size ``, in the unit of bytes. The default
564+ can also be changed with an environment variable
565+ ``AMREX_THE_ARENA_INIT_SIZE=X ``, where ``X `` is the number of bytes. When
566+ both the :cpp: `ParmParse ` parameter and the environment variable are
567+ present, the former will override the latter.
568+ The default initial size for other arenas is 8388608 (i.e., 8 MB). For
565569:cpp: `The_Managed_Arena() ` and :cpp: `The_Device_Arena() `, it can be changed
566570with ``amrex.the_managed_arena_init_size `` and
567571``amrex.the_device_arena_init_size ``, respectively, if they are not an alias
Original file line number Diff line number Diff line change @@ -362,6 +362,11 @@ Arena::Initialize (bool minimal)
362362 the_pinned_arena_release_threshold = Gpu::Device::totalGlobalMem () / Gpu::Device::numDevicePartners () / 2L ;
363363#endif
364364
365+ // Overwrite the initial size with environment variables
366+ if (char const * init_size_p = std::getenv (" AMREX_THE_ARENA_INIT_SIZE" )) {
367+ the_arena_init_size = std::stoi (init_size_p);
368+ }
369+
365370 ParmParse pp (" amrex" );
366371 pp.queryAdd ( " the_arena_init_size" , the_arena_init_size);
367372 pp.queryAdd ( " the_device_arena_init_size" , the_device_arena_init_size);
You can’t perform that action at this time.
0 commit comments