-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathInitParser.cpp
More file actions
50 lines (43 loc) · 1.93 KB
/
InitParser.cpp
File metadata and controls
50 lines (43 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* Copyright 2022-2023 The Regents of the University of California, through Lawrence
* Berkeley National Laboratory (subject to receipt of any required
* approvals from the U.S. Dept. of Energy). All rights reserved.
*
* This file is part of ImpactX.
*
* Authors: Axel Huebl, Chad Mitchell, Ji Qiang
* License: BSD-3-Clause-LBNL
*/
#include "InitParser.H"
#include <AMReX_ParmParse.H>
namespace impactx::initialization
{
void
overwrite_amrex_parser_defaults ()
{
amrex::ParmParse pp_amrex("amrex");
// throw exceptions in asserts, to enable optional error handling, especially in Python
// https://amrex-codes.github.io/amrex/docs_html/RuntimeParameters.html#amrex.throw_exception
bool throw_exception = true; // AMReX' default: false
pp_amrex.queryAdd("throw_exception", throw_exception);
// https://amrex-codes.github.io/amrex/docs_html/GPU.html#inputs-parameters
bool abort_on_out_of_gpu_memory = true; // AMReX' default: false
pp_amrex.queryAdd("abort_on_out_of_gpu_memory", abort_on_out_of_gpu_memory);
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);
// Here we override the default tiling option for particles, which is always
// "false" in AMReX, to "false" if compiling for GPU execution and "true"
// if compiling for CPU.
{
amrex::ParmParse pp_particles("particles");
#ifdef AMREX_USE_GPU
bool do_tiling = false; // By default, tiling is off on GPU
#else
bool do_tiling = true;
#endif
pp_particles.queryAdd("do_tiling", do_tiling);
}
}
} // namespace impactx