Skip to content

Commit bcfeeea

Browse files
committed
Merge branch 'main' into enable_semicoarsening
2 parents d96c69a + 5f5f268 commit bcfeeea

File tree

7 files changed

+33
-195
lines changed

7 files changed

+33
-195
lines changed

Docs/source/GPU_Tutorial.rst

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -9,59 +9,10 @@
99
GPU
1010
==========================
1111

12-
The tutorials in ``amrex-tutorials/ExampleCodes/GPU`` demonstrate the implementation
13-
of AMReX's GPU toolkit as well as provide GPU ported versions of CPU
14-
tutorials to help applications convert to GPUs.
15-
16-
**Your first AMReX GPU application**
17-
------------------------------------
18-
19-
This is a step-by-step guide to preparing, compiling and running your first
20-
AMReX GPU program. This guide will use ``Tutorials/GPU/Launch``,
21-
and instructions will focus on ORNL's systems:
22-
23-
1. Before compiling, the ``pgi`` and ``cuda`` software must be available.
24-
On ORNL systems, the modules can be loaded directly by typing:
25-
26-
.. highlight:: console
27-
28-
::
29-
30-
module load pgi cuda
31-
32-
2. Go to ``Tutorials/GPU/Launch`` to compile the executable. Compile with
33-
``make USE_CUDA=TRUE COMP=pgi USE_MPI=TRUE USE_OMP=FALSE``, or edit the
34-
``GNUmakefile`` to match this configuration and run ``make``. This
35-
should result in an executable: ``main3d.pgi.MPI.CUDA.ex``.
36-
37-
3. On Summit systems, this executable can be submitted by using one of the run
38-
scripts found in ``Tutorials/GPU``. ``run.script`` can be used to run on
39-
Summitdev, and ``run.summit`` can be used for Summit. To change the number
40-
of ranks and GPUs used in the simulation, change the number of resource sets,
41-
``n`` in the ``jsrun`` line. For the first ``Launch`` tutorial, use ``n=1``
42-
and set ``INPUTS=""`` because no input file is used in this example.
43-
44-
When ready, submit the job script (on Summit: ``bsub run.script``).
45-
Congratulations! You've accelerated AMReX using GPUs!
46-
47-
**Launch**
48-
----------
49-
50-
Launch shows multiple examples of how GPU work can be offloaded using the tools
51-
available in AMReX. It includes examples of multiple AMReX macro launch methods,
52-
launching a Fortran function using CUDA and launching work using OpenACC and
53-
OpenMP offloading. This tutorial will be regularly updated with AMReX's
54-
preferred GPU launch methodologies.
12+
The tutorial in ``amrex-tutorials/ExampleCodes/GPU`` demonstrates how to implement a
13+
performance-portable application using AMReX's GPU offloading capabilities.
5514

5615
**CNS**
5716
-------
5817

59-
CNS is a direct GPU port of the ``ExampleCodes/EB/CNS`` example.
60-
61-
**AmrCore**
62-
-----------
63-
64-
AmrCore is a direct GPU port of the ``ExampleCodes/Amr/Advection_AmrCore`` tutorial
65-
that advects a single scalar field with a velocity field specified on faces, using
66-
strategies similar to HeatEquation and CNS.
67-
18+
CNS solves the compressible Navier-Stokes equations on GPUs.

Docs/source/Python_Tutorial.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ Python
77
These examples show how to use AMReX from Python.
88
AMReX applications can also be interfaced to Python with the same logic.
99

10-
In order to build the Python tutorials, add ``-DTUTORIAL_PYTHON=ON`` to the CMake configuration options.
11-
Then install with ``cmake --build build --target pyamrex_pip_install``.
10+
In order to run the Python tutorials, you need to have pyAMReX installed.
11+
Please see `pyAMReX <https://github.com/AMReX-Codes/pyamrex/>`__ for more details.
12+
13+
Alternatively, you can build the ExampleCodes in this repository with ``-DTUTORIAL_PYTHON=ON`` added to the CMake configuration options,
14+
then install with ``cmake --build build --target pyamrex_pip_install``, and pyamrex will be installed for you.
1215

13-
Guided Tutorial Examples:
16+
Once pyAMReX is installed, you can run the following Guided Tutorial Examples:
1417

1518
- :download:`MultiFab <../../GuidedTutorials/MultiFab/main.py>`
1619
- :download:`Heat Equation <../../GuidedTutorials/HeatEquation/Source/main.py>`
1720

18-
Please see `pyAMReX <https://github.com/AMReX-Codes/pyamrex/>`__ for more details.

Docs/source/SUNDIALS_Tutorial.rst

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,25 @@
44
SUNDIALS and Time Integrators
55
=============================
66

7-
This example code shows how to use the AMReX TimeIntegrator class
8-
with SUNDIALS backend for integration. It also include two example
9-
of AMReX native integrators, Forward Euler, and Explicit Runge Kutta.
10-
Each integration type can be chosen by selecting the corresponding
11-
inputs file:
7+
These example codes demonstrate how to use the AMReX TimeIntegrator class
8+
with SUNDIALS backend for integration.
129

13-
- ``inputs_forward_euler`` -- Native AMReX Forward Euler integrator
10+
The first example code at ``amrex-tutorials/ExampleCodes/SUNDIALS/Single-Rate``
11+
solves the heat equation:
1412

15-
- ``inputs_rk3`` -- Native AMReX Explicit Runge Kutta
13+
.. math:: \frac{\partial\phi}{\partial t} = \nabla^2\phi.
1614

17-
- ``inputs_sundials_erk`` -- SUNDIALS backend
15+
The inputs file contains a template for single process time integration strategies.
1816

19-
Both Runge Kutta and SUNDIALS have additional options which can
20-
be set by modifying the inputs file. Please see each respective inputs
21-
file or `AMReX User Guide:Time Integration`_ for more details.
17+
The second example code at ``amrex-tutorials/ExampleCodes/SUNDIALS/Reaction-Diffusion``
18+
solves the reaction-diffusion equation, where :math:`R` and :math:`D` are
19+
user-supplied reaction and diffusion coefficients:
20+
21+
.. math:: \frac{\partial\phi}{\partial t} = D \nabla^2\phi - R \phi.
22+
23+
The inputs file contains a template for MRI approaches, where the diffusion process
24+
can be treated as a "fast" partition relative to the reaction process.
25+
Please see each respective inputs file or
26+
`AMReX User Guide:Time Integration`_ for more details.
2227

2328
.. _`AMReX User Guide:Time Integration`: https://amrex-codes.github.io/amrex/docs_html/TimeIntegration_Chapter.html#

ExampleCodes/Basic/HeatEquation_EX0_C/Exec/GNUmakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ include $(AMREX_HOME)/Tools/GNUMake/Make.defs
1111

1212
include ../Source/Make.package
1313
VPATH_LOCATIONS += ../Source
14-
INCLUDE_LOCATIONS += ./Source
14+
INCLUDE_LOCATIONS += ../Source
1515

1616
include $(AMREX_HOME)/Src/Base/Make.package
1717

ExampleCodes/Particles/ElectromagneticPIC/Source/EMParticleContainerInit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ InitParticles(const IntVect& a_num_particles_per_cell,
140140
unsigned int uiz = amrex::min(nz-1,amrex::max(0,iz));
141141
unsigned int cellid = (uix * ny + uiy) * nz + uiz;
142142

143-
int pidx = poffset[cellid] - poffset[0];
143+
int pidx = poffset[cellid] + old_size;
144144

145145
for (int i_part=0; i_part<num_ppc;i_part++)
146146
{
Lines changed: 3 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,4 @@
1-
SUNDIALS installation guide:
2-
https://computing.llnl.gov/projects/sundials/faq#inst
1+
Refer to https://amrex-codes.github.io/amrex/docs_html/TimeIntegration_Chapter.html
2+
for SNUDIALS installation, build, and usage instructions.
33

4-
Installation
5-
6-
# You need SUNDIALS v7.1.1 or later.
7-
# Check https://computing.llnl.gov/projects/sundials/sundials-software to see if it's available for download.
8-
# If so, download sundials-x.y.z.tar.gz and extract it at the same level as amrex using
9-
>> tar -xzvf sundials-x.y.z.tar.gz # where x.y.z is the version of sundials
10-
>> mv sundials-x.y.z sundials-src
11-
12-
# If v7.1.1. is not available on the website, clone the git repo directly and use the latest version
13-
# At the same level that amrex is cloned, do:
14-
15-
>> git clone https://github.com/LLNL/sundials.git
16-
>> mv sundials sundials-src
17-
18-
# Next
19-
20-
>> mkdir sundials
21-
>> cd sundials
22-
23-
######################
24-
HOST BUILD
25-
######################
26-
27-
>> mkdir instdir
28-
>> mkdir builddir
29-
>> cd builddir
30-
31-
>> cmake -DCMAKE_INSTALL_PREFIX=/pathto/sundials/instdir -DEXAMPLES_INSTALL_PATH=/pathto/sundials/instdir/examples -DENABLE_MPI=ON ../../sundials-src
32-
33-
######################
34-
NVIDIA/CUDA BUILD
35-
######################
36-
37-
# Navigate back to the 'sundials' directory and do:
38-
39-
>> mkdir instdir_cuda
40-
>> mkdir builddir_cuda
41-
>> cd builddir_cuda
42-
43-
>> cmake -DCMAKE_INSTALL_PREFIX=/pathto/sundials/instdir_cuda -DEXAMPLES_INSTALL_PATH=/pathto/sundials/instdir_cuda/examples -DENABLE_CUDA=ON -DENABLE_MPI=ON ../../sundials-src
44-
45-
######################
46-
47-
>> make -j4
48-
>> make install
49-
50-
# in your .bashrc or preferred configuration file, add the following (and then "source ~/.bashrc")
51-
52-
# If you have a CPU build:
53-
54-
>> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/pathto/sundials/instdir/lib/
55-
56-
# If you have a NVIDIA/CUDA build:
57-
58-
>> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/pathto/sundials/instdir_cuda/lib/
59-
60-
# now you are ready to compile amrex-tutorials/ExampleCodes/SUNDIALS/Exec with:
61-
62-
>> make -j4 # optional to have 'USE_CUDA=TRUE' as well
63-
64-
# Refer to inputs to see how to enable different integrators
4+
Make sure that SUNDIALS_HOME in the GNUmakefile points to the installation directory.
Lines changed: 3 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,4 @@
1-
SUNDIALS installation guide:
2-
https://computing.llnl.gov/projects/sundials/faq#inst
1+
Refer to https://amrex-codes.github.io/amrex/docs_html/TimeIntegration_Chapter.html
2+
for SNUDIALS installation, build, and usage instructions.
33

4-
Installation
5-
6-
# You need SUNDIALS v7.1.1 or later.
7-
# Check https://computing.llnl.gov/projects/sundials/sundials-software to see if it's available for download.
8-
# If so, download sundials-x.y.z.tar.gz and extract it at the same level as amrex using
9-
>> tar -xzvf sundials-x.y.z.tar.gz # where x.y.z is the version of sundials
10-
>> mv sundials-x.y.z sundials-src
11-
12-
# If v7.1.1. is not available on the website, clone the git repo directly and use the latest version
13-
# At the same level that amrex is cloned, do:
14-
15-
>> git clone https://github.com/LLNL/sundials.git
16-
>> mv sundials sundials-src
17-
18-
# Next
19-
20-
>> mkdir sundials
21-
>> cd sundials
22-
23-
######################
24-
HOST BUILD
25-
######################
26-
27-
>> mkdir instdir
28-
>> mkdir builddir
29-
>> cd builddir
30-
31-
>> cmake -DCMAKE_INSTALL_PREFIX=/pathto/sundials/instdir -DEXAMPLES_INSTALL_PATH=/pathto/sundials/instdir/examples -DENABLE_MPI=ON ../../sundials-src
32-
33-
######################
34-
NVIDIA/CUDA BUILD
35-
######################
36-
37-
# Navigate back to the 'sundials' directory and do:
38-
39-
>> mkdir instdir_cuda
40-
>> mkdir builddir_cuda
41-
>> cd builddir_cuda
42-
43-
>> cmake -DCMAKE_INSTALL_PREFIX=/pathto/sundials/instdir_cuda -DEXAMPLES_INSTALL_PATH=/pathto/sundials/instdir_cuda/examples -DENABLE_CUDA=ON -DENABLE_MPI=ON ../../sundials-src
44-
45-
######################
46-
47-
>> make -j4
48-
>> make install
49-
50-
# in your .bashrc or preferred configuration file, add the following (and then "source ~/.bashrc")
51-
52-
# If you have a CPU build:
53-
54-
>> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/pathto/sundials/instdir/lib/
55-
56-
# If you have a NVIDIA/CUDA build:
57-
58-
>> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/pathto/sundials/instdir_cuda/lib/
59-
60-
# now you are ready to compile amrex-tutorials/ExampleCodes/SUNDIALS/Exec with:
61-
62-
>> make -j4 # optional to have 'USE_CUDA=TRUE' as well
63-
64-
# Refer to inputs to see how to enable different integrators
4+
Make sure that SUNDIALS_HOME in the GNUmakefile points to the installation directory.

0 commit comments

Comments
 (0)