Skip to content

Commit

Permalink
Merge m-to-n with main
Browse files Browse the repository at this point in the history
  • Loading branch information
MTCam committed Aug 22, 2024
2 parents a4eed52 + 0d680df commit 21a9681
Show file tree
Hide file tree
Showing 113 changed files with 18,786 additions and 2,476 deletions.
36 changes: 21 additions & 15 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
name: Flake8
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
-
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
# matches compat target in setup.py
python-version: '3.8'
Expand All @@ -36,9 +36,9 @@ jobs:
name: Mypy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
-
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install
Expand All @@ -55,9 +55,9 @@ jobs:
name: Pylint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
-
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install
Expand All @@ -73,9 +73,9 @@ jobs:
pydocstyle:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
-
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Run Pydocstyle
Expand All @@ -91,7 +91,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install
run: |
. .ci-support/install.sh
Expand All @@ -112,7 +112,7 @@ jobs:
os: [ubuntu-latest, porter]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install
run: |
. .ci-support/install.sh
Expand All @@ -124,6 +124,9 @@ jobs:
. "$MINIFORGE_INSTALL_DIR/bin/activate" testing
export XDG_CACHE_HOME=/tmp
mamba install vtk # needed for the accuracy comparison
# Temporary workaround for https://github.com/conda-forge/openvino-feedstock/pull/73
[[ $(hostname) == "porter" ]] && export PYOPENCL_TEST="port:nv" && unset XDG_CACHE_HOME
# This is only possible because actions run sequentially on porter
Expand All @@ -136,7 +139,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install
run: |
. .ci-support/install.sh
Expand Down Expand Up @@ -168,11 +171,11 @@ jobs:
os: [ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install emirge
run: |
[[ $(uname) == Linux ]] && sudo apt-get update && sudo apt-get install -y openmpi-bin libopenmpi-dev
[[ $(uname) == Darwin ]] && brew upgrade && brew install mpich
[[ $(uname) == Darwin ]] && ( brew upgrade || true; brew install mpich )
cd ..
git clone https://github.com/illinois-ceesd/emirge
cd emirge
Expand All @@ -194,14 +197,14 @@ jobs:
os: [ubuntu-latest, macos-latest, porter]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Prepare production environment
run: |
set -x
[[ $(uname) == Linux ]] && [[ $(hostname) != "porter" ]] && sudo apt-get update && sudo apt-get install -y openmpi-bin libopenmpi-dev
[[ $(uname) == Darwin ]] && brew upgrade && brew install mpich
[[ $(uname) == Darwin ]] && ( brew upgrade || true; brew install mpich )
# This is only possible because actions run sequentially on porter
[[ $(hostname) == "porter" ]] && rm -rf /tmp/githubrunner/pocl-scratch && rm -rf /tmp/githubrunner/xdg-scratch
Expand All @@ -222,4 +225,7 @@ jobs:
- name: Run production test
run: |
source ../config/activate_env.sh
# Temporary workaround for https://github.com/conda-forge/openvino-feedstock/pull/73
scripts/run-integrated-tests.sh --production
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,9 @@ test/nodal-dg
# Emacs backups
.\#*
\#*


# disk caches
xdg-cache/
pocl-cache/
cuda-cache/
1 change: 1 addition & 0 deletions .rtd-env-py3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies:
- "git+https://github.com/inducer/leap.git#egg=leap"
- "git+https://github.com/inducer/modepy.git#egg=modepy"
- "git+https://github.com/illinois-ceesd/arraycontext.git@production#egg=arraycontext"
- "git+https://github.com/illinois-ceesd/pytato.git@production#egg=pytato"
- "git+https://github.com/illinois-ceesd/meshmode.git@production#egg=meshmode"
- "git+https://github.com/illinois-ceesd/grudge.git@production#egg=grudge"
- "sphinx-math-dollar"
Expand Down
2 changes: 1 addition & 1 deletion conda-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies:
- pytest
- pylint
- pydocstyle
- cantera
- cantera=3.0.0
- h5py * nompi_* # Make sure cantera does not pull in MPI through h5py
- gmsh
- vtk
3 changes: 3 additions & 0 deletions doc/misc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,6 @@ References
`(DOI) <https://doi.org/10.4208/cicp.170712.010313a>`__
.. [Renac_2021] Florent Renac, Entropy stable, robust and high-order DGSEM for the compressible multicomponent \
Euler equations, Journal of Computational Physics, 445 `(DOI) <https://doi.org/10.1016/j.jcp.2021.110584>`__
.. [Ern_2008] Daniele A. Di Pietro, Alexandre Ern, Jean-Luc Guermond, Discontinuous Galerkin Methods for \
Anisotropic Semidefinite Diffusion with Advection, SIAM Journal on Numerical Analysis 46 2 \
`(DOI) <https://www.jstor.org/stable/40233233?seq=12>`__
35 changes: 26 additions & 9 deletions doc/running/caching.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
OpenCL kernel caching
=====================

OpenCL kernels are cached on hard disk on multiple levels during a |mirgecom|
execution. This has the advantage of reducing the compilation time of kernels
when running the same driver multiple times.
OpenCL kernels are cached in memory and on hard disk on multiple levels during
a |mirgecom| execution. This has the advantage of reducing the compilation time
of kernels when running the same driver multiple times.

The following sections discuss |mirgecom|-related packages that use caching.
The following sections discuss |mirgecom|-related packages that use caching,
with a focus on configuring the disk-based caching.

.. note::

Expand All @@ -19,6 +20,21 @@ The following sections discuss |mirgecom|-related packages that use caching.
~/.cache/pyopencl ~/Library/Caches/pyopencl $POCL_CACHE_DIR
$XDG_CACHE_HOME/pocl ~/.cache/pocl ~/.nv/ComputeCache $CUDA_CACHE_PATH``

.. note::

The following bash code can be used to disable all disk caches::

$ export LOOPY_NO_CACHE=1
$ export PYOPENCL_NO_CACHE=1
$ export POCL_KERNEL_CACHE=0
$ export CUDA_CACHE_DISABLE=1

.. note::

Disabling disk caching for a specific package only affects
that particular package. For example, disabling disk caching for :mod:`loopy`
does not affect the caching behavior of :mod:`pyopencl` or *PoCL*.


Loopy
-----
Expand Down Expand Up @@ -64,21 +80,22 @@ for details.
PyOpenCL uses ``clCreateProgramWithSource`` on the first compilation and
caches the OpenCL binary it retrieves. The second time the same source
is compiled, it uses ``clCreateProgramWithBinary`` to hand the binary
to the CL runtime (such as PoCL). This can lead to different caching behaviors on the first three compilations depending on how the CL runtime
to the CL runtime (such as PoCL). This can lead to different caching
behaviors on the first three compilations depending on how the CL runtime
itself performs caching.


PoCL
----

PoCL stores compilation results (LLVM bitcode and shared libraries) in
``$POCL_CACHE_DIR`` or ``$XDG_CACHE_HOME/pocl`` by default. You can export
``POCL_KERNEL_CACHE=0`` to disable caching. See `here
*PoCL* stores compilation results (LLVM bitcode and shared
libraries) in ``$POCL_CACHE_DIR`` or ``$XDG_CACHE_HOME/pocl`` by default. You
can export ``POCL_KERNEL_CACHE=0`` to disable caching. See `here
<http://portablecl.org/docs/html/using.html#tuning-pocl-behavior-with-env-variables>`__ for details.

.. note::

When ``$POCL_CACHE_DIR`` and ``$XDG_CACHE_HOME`` are not set, PoCL's cache
When ``$POCL_CACHE_DIR`` and ``$XDG_CACHE_HOME`` are not set, *PoCL*'s cache
dir defaults to ``~/.cache/pocl`` on Linux and MacOS.


Expand Down
6 changes: 3 additions & 3 deletions doc/running/large-systems.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ In order to avoid these issues, users should direct the packages to create
cache files in directories that are private to each rank by using the ``XDG_CACHE_HOME`` and ``POCL_CACHE_DIR``
environment variables, such as in the following example::

$ export XDG_CACHE_ROOT="/tmp/$USER/xdg-scratch"
$ export POCL_CACHE_ROOT="/tmp/$USER/pocl-scratch"
$ srun -n 512 bash -c 'POCL_CACHE_DIR=$POCL_CACHE_ROOT/$$ XDG_CACHE_HOME=$XDG_CACHE_ROOT/$$ python -m mpi4py examples/wave-mpi.py'
$ export XDG_CACHE_ROOT="/tmp/$USER/xdg-cache"
$ export POCL_CACHE_ROOT="/tmp/$USER/pocl-cache"
$ srun -n 512 bash -c 'POCL_CACHE_DIR=$POCL_CACHE_ROOT/$$ XDG_CACHE_HOME=$XDG_CACHE_ROOT/$$ python -m mpi4py examples/wave.py'


There is also on-disk caching of compiled kernels done by CUDA itself.
Expand Down
17 changes: 9 additions & 8 deletions doc/support/arrays.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,25 @@ To demonstrate the effect of this, first we need some setup:
.. doctest::

>>> import pyopencl as cl
>>> from arraycontext import PyOpenCLArrayContext, thaw
>>> from arraycontext import thaw
>>> from meshmode.array_context import PyOpenCLArrayContext
>>> ctx = cl.create_some_context()
>>> queue = cl.CommandQueue(ctx)
>>> actx = PyOpenCLArrayContext(queue)
>>> from meshmode.mesh.generation import generate_regular_rect_mesh
>>> mesh = generate_regular_rect_mesh(a=(0, 0), b=(1, 1), nelements_per_axis=(10, 10))
>>> from grudge import DiscretizationCollection
>>> dcoll = DiscretizationCollection(actx, mesh, order=5)
>>> from grudge import make_discretization_collection
>>> dcoll = make_discretization_collection(actx, mesh, order=5)

Most quantities that are maintained by the discretization will be frozen. For example,
if one wanted to grab the nodes of the mesh or normals of a named surface in the mesh:

.. doctest::

>>> from grudge.dof_desc import DOFDesc
>>> nodes = thaw(dcoll.nodes(), actx)
>>> dd = DOFDesc("all_faces")
>>> nhat = thaw(dcoll.normal(dd), actx)
>>> from grudge.dof_desc import as_dofdesc
>>> nodes = actx.thaw(dcoll.nodes())
>>> dd = as_dofdesc("all_faces")
>>> nhat = actx.thaw(dcoll.normal(dd))

What can go wrong? Attempts to operate on frozen data will yield errors similar to
the following:
Expand All @@ -76,7 +77,7 @@ Fortunately, recovering from this is straightforward:

.. doctest::

>>> nodes = thaw(dcoll.nodes(), actx)
>>> nodes = actx.thaw(dcoll.nodes())
>>> result = nodes * 5

Array Containers
Expand Down
1 change: 1 addition & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The examples and the unique features they exercise are as follows:
- `sod.py`: Sod's shock case: Fluid test case with strong shock
- `vortex.py`: Isentropic vortex advection: outflow boundaries, verification
- `hotplate.py`: Isothermal BC verification (prescribed exact soln)
- `blasius.py`: Inflow, outflow and no-slip wall BC verification
- `doublemach.py`: AV test case
- `poiseuille.py`: Poiseuille flow verification case
- `poiseuille-multispecies.py`: Poiseuille flow with passive scalars
Expand Down
Loading

0 comments on commit 21a9681

Please sign in to comment.