Skip to content

Commit

Permalink
Merge branch 'devitocodes:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ZoeLeibowitz authored Apr 26, 2024
2 parents d28f3af + 6ac1c2c commit 3a7133a
Show file tree
Hide file tree
Showing 49 changed files with 1,710 additions and 499 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/docker-bases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
run: docker system prune -a -f

- name: GCC image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
file: './docker/Dockerfile.cpu'
Expand All @@ -61,6 +61,7 @@ jobs:
build-args: 'arch=gcc'
tags: 'devitocodes/bases:cpu-gcc'


#######################################################
############## Intel OneApi CPU #######################
#######################################################
Expand Down Expand Up @@ -93,7 +94,7 @@ jobs:
run: docker system prune -a -f

- name: ICX image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
file: './docker/Dockerfile.intel'
Expand All @@ -103,7 +104,7 @@ jobs:
tags: 'devitocodes/bases:cpu-icx'

- name: SYCL CPU image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
file: './docker/Dockerfile.intel'
Expand All @@ -113,7 +114,7 @@ jobs:
tags: 'devitocodes/bases:cpu-sycl'

- name: SYCL GPU image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
file: './docker/Dockerfile.intel'
Expand Down Expand Up @@ -154,7 +155,7 @@ jobs:
run: docker system prune -a -f

- name: NVC image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
file: './docker/Dockerfile.nvidia'
Expand All @@ -164,7 +165,7 @@ jobs:
tags: 'devitocodes/bases:nvidia-nvc'

- name: NVCC image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
file: './docker/Dockerfile.nvidia'
Expand All @@ -174,7 +175,7 @@ jobs:
tags: 'devitocodes/bases:nvidia-nvcc'

- name: NVC host image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
file: './docker/Dockerfile.nvidia'
Expand Down Expand Up @@ -215,7 +216,7 @@ jobs:
run: docker system prune -a -f

- name: AMD image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
file: './docker/Dockerfile.amd'
Expand All @@ -224,7 +225,7 @@ jobs:
tags: devitocodes/bases:amd

- name: AMD HIP image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
file: './docker/Dockerfile.amd'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-devito.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ jobs:

- name: Run tests
run: |
docker run ${{ matrix.flag }} --rm --name testrun 'devitocodes/devito:${{ matrix.tag }}-dev' pytest ${{ matrix.test }}
docker run ${{ matrix.flag }} --rm -t --name testrun 'devitocodes/devito:${{ matrix.tag }}-dev' pytest ${{ matrix.test }}
16 changes: 15 additions & 1 deletion .github/workflows/pytest-core-mpi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ jobs:
python3 scripts/clear_devito_cache.py
python3 -m pytest --cov --cov-config=.coveragerc --cov-report=xml -m parallel tests/
- name: Test examples with MPI
run: |
python3 scripts/clear_devito_cache.py
DEVITO_MPI=1 mpirun -n 2 python3 -m pytest examples/seismic/acoustic
DEVITO_MPI=1 mpirun -n 2 python3 -m pytest examples/seismic/tti
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
Expand All @@ -64,9 +70,12 @@ jobs:
- name: gcc
arch: gcc
os: ubuntu-latest
mpiflag: ""
- name: icx
arch: icx
os: ubuntu-latest
# Need safe math for icx due to inaccuracy with mpi+sinc interpolation
mpiflag: "-e DEVITO_SAFE_MATH=1"

steps:
- name: Checkout devito
Expand All @@ -78,4 +87,9 @@ jobs:
- name: Test with pytest
run: |
docker run --rm -e CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} -e OMP_NUM_THREADS=1 --name testrun devito_img pytest tests/test_mpi.py
docker run --rm -t -e CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} -e OMP_NUM_THREADS=1 --name testrun devito_img pytest tests/test_mpi.py
- name: Test examples with MPI
run: |
docker run --rm -t ${{ matrix.mpiflag }} -e DEVITO_MPI=1 -e OMP_NUM_THREADS=1 --name examplerun devito_img mpiexec -n 2 pytest examples/seismic/acoustic
docker run --rm -t -e DEVITO_MPI=1 -e OMP_NUM_THREADS=1 --name examplerun devito_img mpiexec -n 2 pytest examples/seismic/tti
10 changes: 5 additions & 5 deletions .github/workflows/pytest-core-nompi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
pytest-ubuntu-py310-gcc10-noomp,
pytest-ubuntu-py312-gcc13-omp,
pytest-ubuntu-py39-gcc9-omp,
pytest-osx-py37-clang-omp,
pytest-osx-py312-clang-omp,
pytest-docker-py39-gcc-omp,
pytest-docker-py39-icx-omp
]
Expand Down Expand Up @@ -84,8 +84,8 @@ jobs:
language: "openmp"
sympy: "1.9"

- name: pytest-osx-py37-clang-omp
python-version: '3.7'
- name: pytest-osx-py312-clang-omp
python-version: '3.12'
os: macos-latest
arch: "clang"
language: "C"
Expand All @@ -112,7 +112,7 @@ jobs:
test-set: 'adjoint'

exclude:
- name: pytest-osx-py37-clang-omp
- name: pytest-osx-py312-clang-omp
set: adjoint

steps:
Expand All @@ -133,7 +133,7 @@ jobs:
- name: Set run prefix
run: |
if [[ "${{ matrix.name }}" =~ "docker" ]]; then
echo "RUN_CMD=docker run --rm -e CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} --name testrun devito_img" >> $GITHUB_ENV
echo "RUN_CMD=docker run --rm -t -e CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} --name testrun devito_img" >> $GITHUB_ENV
else
echo "RUN_CMD=" >> $GITHUB_ENV
fi
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pytest-gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
base: "devitocodes/bases:nvidia-nvc"
tags: ["self-hosted", "nvidiagpu"]
test_drive_cmd: "nvidia-smi"
flags: '--gpus all --rm --name testrun-nvc'
flags: '--gpus all --rm -t --name testrun-nvc'

- name: pytest-gpu-omp-amd
test_files: "tests/test_adjoint.py tests/test_gpu_common.py tests/test_gpu_openmp.py"
Expand All @@ -66,7 +66,7 @@ jobs:
test_drive_cmd: "rocm-smi"
# Attach the AMD GPU devices `/dev` and add user to video and render (109 on wampa) group
# Options from https://rocmdocs.amd.com/en/latest/ROCm_Virtualization_Containers/ROCm-Virtualization-&-Containers.html
flags: "--network=host --device=/dev/kfd --device=/dev/dri --ipc=host --group-add video --group-add $(getent group render | cut -d: -f3) --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --rm --name testrun-amd"
flags: "--network=host --device=/dev/kfd --device=/dev/dri --ipc=host --group-add video --group-add $(getent group render | cut -d: -f3) --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --rm -t --name testrun-amd"

steps:
- name: Checkout devito
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/tutorials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ jobs:
env:
DEVITO_ARCH: "${{ matrix.compiler }}"
DEVITO_LANGUAGE: ${{ matrix.language }}
PYTHON_VERSION: "3.9"

strategy:
# Prevent all build to stop if a single one fails
fail-fast: false
matrix:
name: [
tutos-ubuntu-gcc-py39,
tutos-osx-clang-py39,
tutos-osx-clang-py311,
tutos-docker-gcc-py39
]

Expand All @@ -39,26 +38,29 @@ jobs:
os: ubuntu-latest
compiler: gcc
language: "openmp"
pyver: "3.9"

- name: tutos-osx-clang-py39
- name: tutos-osx-clang-py311
os: macos-latest
compiler: clang
language: "C"
pyver: "3.11"

- name: tutos-docker-gcc-py39
os: ubuntu-latest
compiler: gcc
language: "openmp"
pyver: "3.9"

steps:
- name: Checkout devito
uses: actions/checkout@v4

- name: Set up Python 3.9
- name: Set up Python ${{ matrix.pyver }}
if: "!contains(matrix.name, 'docker')"
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: ${{ matrix.pyver }}

- uses: maxim-lobanov/setup-xcode@v1
if: runner.os == 'macOS'
Expand All @@ -73,7 +75,7 @@ jobs:
- name: Set run prefix
run: |
if [ "${{ matrix.name }}" == 'tutos-docker-gcc-py39' ]; then
echo "RUN_CMD=docker run --rm --name testrun devito_img" >> $GITHUB_ENV
echo "RUN_CMD=docker run --rm -t --name testrun devito_img" >> $GITHUB_ENV
else
echo "RUN_CMD=" >> $GITHUB_ENV
fi
Expand Down
4 changes: 2 additions & 2 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,9 @@ By default, Devito compiles the generated code using flags that maximize the run

[top](#Frequently-Asked-Questions)

## Can I control the MPI domain decomposition
## Can I control the MPI domain decomposition?

Until Devito v3.5 included, domain decomposition occurs along the fastest axis. As of later versions, domain decomposition occurs along the slowest axis, for performance reasons. And yes, it is possible to control the domain decomposition in user code, but this is not neatly documented. Take a look at `test_custom_topology` in [this file](https://github.com/devitocodes/devito/blob/master/tests/test_mpi.py). In essence, `Grid` accepts the optional argument `topology`, which allows the user to pass a custom topology as an n-tuple, where `n` is the number of distributed dimensions. For example, for a two-dimensional grid, the topology `(4, 1)` will decompose the slowest axis into four partitions, one partition per MPI rank, while the fastest axis will be replicated over all MPI ranks.
Until Devito v3.5 included, domain decomposition occurs along the fastest axis. As of later versions, domain decomposition occurs along the slowest axis, for performance reasons. And yes, it is possible to control the domain decomposition in user code, but this is not neatly documented. Take a look at `class CustomTopology` in [distributed.py](https://github.com/devitocodes/devito/blob/master/devito/mpi/distributed.py) and `test_custom_topology` in [this file](https://github.com/devitocodes/devito/blob/master/tests/test_mpi.py). In essence, `Grid` accepts the optional argument `topology`, which allows the user to pass a custom topology as an n-tuple, where `n` is the number of distributed dimensions. For example, for a two-dimensional grid, the topology `(4, 1)` will decompose the slowest axis into four partitions, one partition per MPI rank, while the fastest axis will be replicated over all MPI ranks.


[top](#Frequently-Asked-Questions)
Expand Down
6 changes: 5 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
include versioneer.py
include devito/_version.py
include requirements.txt requirements-optional.txt
include requirements.txt
include requirements-optional.txt
include requirements-testing.txt
include requirements-mpi.txt
include requirements-nvidia.txt
Loading

0 comments on commit 3a7133a

Please sign in to comment.