Skip to content

Commit a2e9500

Browse files
authored
Merge branch 'development' into doc_burn_cell_sdc
2 parents bbf078d + d90e290 commit a2e9500

File tree

10 files changed

+54
-59
lines changed

10 files changed

+54
-59
lines changed

Docs/source/design.rst

+33-4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ and the generic solvers:
4141

4242
* ``util/``: linear algebra solvers and other routines.
4343

44-
Design Philosophy
44+
45+
.. note::
46+
47+
All quantities are assumed to be in CGS units, unless otherwise
48+
specified.
49+
50+
Design philosophy
4551
=================
4652

4753
Any application that uses Microphysics will at minimum need to
@@ -67,7 +73,30 @@ solvers (ODE integration for the network and Newton-Raphson root
6773
finding for the EOS) are separated from the specific implementations of
6874
the microphysics.
6975

70-
.. note::
7176

72-
All quantities are assumed to be in CGS units, unless otherwise
73-
specified.
77+
78+
GPU considerations
79+
==================
80+
81+
.. index:: GPUs
82+
83+
All of the Microphysics routines are written to run on GPUs. This is
84+
enabled in application codes by using the AMReX lambda-capturing
85+
mechanism (see the [AMReX GPU
86+
documentation](https://amrex-codes.github.io/amrex/docs_html/GPU.html)
87+
for more information).
88+
89+
This means leveraging the AMReX data-structures, macros, and
90+
functions. The unit tests (see :ref:`sec:unit_tests`) provide a good
91+
reference for how to interface the Microphysics solvers and physics
92+
terms with an AMReX-based code.
93+
94+
There are a few places where Microphysics behaves slightly differently
95+
when running on a CPU vs. a GPU:
96+
97+
* In the VODE integrator, we disable Jacobian-caching to save memory.
98+
See :ref:`ch:networks:integrators`.
99+
100+
* In general we disable printing from GPU kernels, due to register
101+
pressure. Some output can be enabled by compiling with
102+
``USE_GPU_PRINTF=TRUE``.

Docs/source/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ system.
4646
getting_started
4747
design
4848
data_structures
49-
autodiff
5049
rp_intro
5150

5251
.. toctree::
@@ -85,6 +84,7 @@ system.
8584
:hidden:
8685

8786
util
87+
autodiff
8888

8989
.. toctree::
9090
:maxdepth: 1

Docs/source/unit_tests.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _sec:unit_tests:
2+
13
**********************
24
Overview of Unit Tests
35
**********************

Make.Microphysics

+4-47
Original file line numberDiff line numberDiff line change
@@ -43,50 +43,18 @@ include $(AMREX_HOME)/Tools/GNUMake/Make.defs
4343

4444
MICROPHYSICS_AUTO_SOURCE_DIR := $(TmpBuildDir)/microphysics_sources/$(optionsSuffix).EXE
4545

46-
all: build_status $(executable) starkiller_library
46+
all: build_status $(executable)
4747
@echo SUCCESS
4848

4949
build_status:
5050
$(AMREX_HOME)/Tools/C_scripts/describe_sources.py \
5151
--git_names "Microphysics AMReX" \
5252
--git_dirs "$(TOP) $(AMREX_HOME)"
5353

54-
starkiller_library: $(executable)
55-
ifeq ($(USE_COMPILE_WITH_F2PY), TRUE)
56-
@echo Wrapping sources with f90wrap ...
57-
sh dowrap.sh
58-
@echo Linking objects with f2py ...
59-
sh dof2py.sh
60-
endif
61-
62-
# Use a coarse grained OMP approach
63-
DEFINES += -DCRSEGRNDOMP
64-
65-
66-
# OpenACC support
67-
ifeq ($(USE_ACC), TRUE)
68-
DEFINES += -DACC
69-
endif
70-
7154
ifeq ($(USE_REACT), TRUE)
7255
DEFINES += -DREACTIONS
7356
endif
7457

75-
ifeq ($(USE_REACT_SPARSE_JACOBIAN), TRUE)
76-
DEFINES += -DREACT_SPARSE_JACOBIAN
77-
78-
# The following is sometimes useful to turn on for debugging sparse J indices
79-
# (if a get/set/scale is called with (row, col) not in the sparse J, stop)
80-
# Otherwise, set/scale do nothing, and get returns 0.
81-
ifeq ($(USE_SPARSE_STOP_ON_OOB), TRUE)
82-
DEFINES += -DSPARSE_STOP_ON_OOB
83-
endif
84-
endif
85-
86-
ifeq ($(USE_COMPILE_WITH_F2PY), TRUE)
87-
DEFINES += -DCOMPILE_WITH_F2PY
88-
endif
89-
9058

9159
#------------------------------------------------------------------------------
9260
# AMReX
@@ -213,20 +181,9 @@ $(objEXETempDir)/AMReX_buildInfo.o: .FORCE
213181
include $(AMREX_HOME)/Tools/GNUMake/Make.rules
214182

215183
clean::
216-
$(SILENT) $(RM) extern.F90
217-
$(SILENT) $(RM) network_properties.F90 network_properties.H
218-
$(SILENT) $(RM) $(MICROPHYSICS_AUTO_SOURCE_DIR)/*.H $(MICROPHYSICS_AUTO_SOURCE_DIR)/*.[fF]90
219-
$(SILENT) $(RM) extern_parameters.cpp extern_parameters_F.H extern_parameters.H
220-
221-
# Older versions of CASTRO generated a "network.f90" file when using
222-
# the general_null network, which conflicts with our generalized
223-
# network.f90 file. So we should delete the local copy if we are
224-
# trying to rebuild from an old directory.
225-
# The same is true for "extern.f90".
226-
227-
clean::
228-
$(RM) network.f90
229-
$(RM) extern.f90
184+
$(SILENT) $(RM) network_properties.H
185+
$(SILENT) $(RM) $(MICROPHYSICS_AUTO_SOURCE_DIR)/*.H
186+
$(SILENT) $(RM) extern_parameters.cpp extern_parameters.H
230187

231188

232189
# for debugging. To see the value of a Makefile variable,

unit_test/test_aprox_rates/aprox_rates_util.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ void aprox_rates_test(const Box& bx,
2424

2525
const int ini56 = network_spec_index("nickel-56");
2626

27-
AMREX_PARALLEL_FOR_3D(bx, i, j, k,
27+
amrex::ParallelFor(bx,
28+
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k)
2829
{
2930

3031
eos_extra_t eos_state;
@@ -444,7 +445,8 @@ void aprox_rates_extra_c12ag(const Box& bx,
444445

445446
const int ini56 = network_spec_index("nickel-56");
446447

447-
AMREX_PARALLEL_FOR_3D(bx, i, j, k,
448+
amrex::ParallelFor(bx,
449+
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k)
448450
{
449451

450452
eos_extra_t eos_state;

unit_test/test_conductivity/conductivity_util.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ void cond_test_C(const amrex::Box& bx,
2222
const int ih1 = network_spec_index("hydrogen-1");
2323
const int ihe4 = network_spec_index("helium-4");
2424

25-
AMREX_PARALLEL_FOR_3D(bx, i, j, k,
25+
amrex::ParallelFor(bx,
26+
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k)
2627
{
2728

2829
// set the composition -- approximately solar

unit_test/test_eos/eos_util.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ void eos_test_C(const Box& bx,
2626
const int ihe4 = network_spec_index("helium-4");
2727

2828

29-
AMREX_PARALLEL_FOR_3D(bx, i, j, k,
29+
amrex::ParallelFor(bx,
30+
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k)
3031
{
3132

3233
// set the composition -- approximately solar

unit_test/test_jac/main.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ void main_main ()
172172

173173
auto s = state.array(mfi);
174174

175-
AMREX_PARALLEL_FOR_3D(bx, i, j, k,
175+
amrex::ParallelFor(bx,
176+
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k)
176177
{
177178
do_jac(i, j, k, s, vars);
178179
});

unit_test/test_rhs/main.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ void main_main ()
180180

181181
auto s = state.array(mfi);
182182

183-
AMREX_PARALLEL_FOR_3D(bx, i, j, k,
183+
amrex::ParallelFor(bx,
184+
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k)
184185
{
185186
do_rhs(i, j, k, s, vars);
186187
});

unit_test/test_sdc/main.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ void main_main ()
197197
auto s = state.array(mfi);
198198
auto n_rhs = integrator_n_rhs.array(mfi);
199199

200-
AMREX_PARALLEL_FOR_3D(bx, i, j, k,
200+
amrex::ParallelFor(bx,
201+
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k)
201202
{
202203
bool success = do_react(vars, i, j, k, s, n_rhs);
203204

0 commit comments

Comments
 (0)