blob: 396fe67e32598855f42541ae97ac57369bafcd08 (
plain) (
blame)
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
51
52
|
/* Copyright 2020 Axel Huebl
*
* This file is part of WarpX.
*
* License: BSD-3-Clause-LBNL
*/
#include "Initialization/WarpXAMReXInit.H"
#include <AMReX.H>
#include <AMReX_ParmParse.H>
namespace {
/** Overwrite defaults in AMReX Inputs
*
* This overwrites defaults in amrex::ParamParse for inputs.
*/
void
overwrite_amrex_parser_defaults()
{
amrex::ParmParse pp_amrex("amrex");
// 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.query("abort_on_out_of_gpu_memory", abort_on_out_of_gpu_memory);
pp_amrex.add("abort_on_out_of_gpu_memory", abort_on_out_of_gpu_memory);
// 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
// number of cells is a multiple of blocking factor. We set the blocking factor to 1 so those
// AMReX asserts will always pass.
amrex::ParmParse pp_warpx("warpx");
if (pp_warpx.contains("numprocs"))
{
amrex::ParmParse pp_amr("amr");
pp_amr.add("blocking_factor", 1);
}
}
}
amrex::AMReX*
warpx_amrex_init(int& argc, char**& argv, bool const build_parm_parse, MPI_Comm const mpi_comm)
{
return amrex::Initialize(
argc,
argv,
build_parm_parse,
mpi_comm,
overwrite_amrex_parser_defaults
);
}
|