Skip to content

Commit 1181f14

Browse files
committed
Merge remote-tracking branch 'origin/main' into connorjward/fix-zenodo-ratelimit
2 parents a6d254c + 547aca2 commit 1181f14

339 files changed

Lines changed: 22623 additions & 8263 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actionlint.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
self-hosted-runner:
2+
labels:
3+
# Custom label for GPU-enabled self-hosted runners
4+
- gpu

.github/workflows/core.yml

Lines changed: 177 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ on:
2323
description: Whether to test using macOS
2424
type: boolean
2525
default: false
26+
test_gpu:
27+
description: Whether to test using CUDA-enabled PETSc
28+
type: boolean
29+
default: false
2630
deploy_website:
2731
description: Whether to deploy the website
2832
type: boolean
@@ -54,6 +58,10 @@ on:
5458
description: Whether to test using macOS
5559
type: boolean
5660
default: false
61+
test_gpu:
62+
description: Whether to test using CUDA-enabled PETSc
63+
type: boolean
64+
default: false
5765
deploy_website:
5866
description: Whether to deploy the website
5967
type: boolean
@@ -319,7 +327,12 @@ jobs:
319327
matrix.arch == 'default'
320328
run: |
321329
. venv/bin/activate
322-
git clone --depth 1 https://github.com/firedrakeproject/gusto.git gusto-repo
330+
if [ ${{ inputs.target_branch }} = 'release' ]; then
331+
GUSTO_BRANCH='main'
332+
else
333+
GUSTO_BRANCH='future'
334+
fi
335+
git clone --depth 1 https://github.com/firedrakeproject/gusto.git gusto-repo --branch $GUSTO_BRANCH
323336
pip install --verbose ./gusto-repo
324337
python -m pytest -n 8 --verbose \
325338
gusto-repo/integration-tests/balance/test_saturated_balance.py \
@@ -460,6 +473,161 @@ jobs:
460473
run: |
461474
find . -delete
462475
476+
test_gpu:
477+
name: Build and test Firedrake (Linux CUDA)
478+
runs-on: [self-hosted, Linux, gpu]
479+
container:
480+
image: ubuntu:latest
481+
options: --gpus all
482+
if: inputs.test_gpu
483+
env:
484+
OMPI_ALLOW_RUN_AS_ROOT: 1
485+
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
486+
OMP_NUM_THREADS: 1
487+
OPENBLAS_NUM_THREADS: 1
488+
FIREDRAKE_CI: 1
489+
PYOP2_SPMD_STRICT: 1
490+
# Disable fast math as it exposes compiler bugs
491+
PYOP2_CFLAGS: -fno-fast-math
492+
# NOTE: One should occasionally update test_durations.json by running
493+
# 'make test_durations' inside a 'firedrake:latest' Docker image.
494+
EXTRA_PYTEST_ARGS: --splitting-algorithm least_duration --timeout=600 --timeout-method=thread -o faulthandler_timeout=660 --durations-path=./firedrake-repo/tests/test_durations.json --durations=50
495+
PYTEST_MPI_MAX_NPROCS: 8
496+
# Prevent PETSc from exiting with an error due to using non-GPU aware system MPI
497+
PETSC_OPTIONS: -use_gpu_aware_mpi 0
498+
steps:
499+
- name: Confirm Nvidia GPUs are enabled
500+
# The presence of the nvidia-smi command indicates that the Nvidia drivers have
501+
# successfully been imported into the container, there is no point continuing
502+
# if nvidia-smi is not present
503+
run: nvidia-smi
504+
505+
- name: Fix HOME
506+
# For unknown reasons GitHub actions overwrite HOME to /github/home
507+
# which will break everything unless fixed
508+
# (https://github.com/actions/runner/issues/863)
509+
run: echo "HOME=/root" >> "$GITHUB_ENV"
510+
511+
512+
# Git is needed for actions/checkout and Python for firedrake-configure
513+
# curl needed for adding new deb repositories to ubuntu
514+
- name: Install system dependencies (1)
515+
run: |
516+
apt-get update
517+
apt-get -y install git python3 curl
518+
519+
520+
- name: Pre-run cleanup
521+
# Make sure the current directory is empty
522+
run: find . -delete
523+
524+
- uses: actions/checkout@v5
525+
with:
526+
path: firedrake-repo
527+
ref: ${{ inputs.source_ref }}
528+
529+
- name: Add Nvidia CUDA deb repositories
530+
run: |
531+
deburl=$( python3 ./firedrake-repo/scripts/firedrake-configure --show-extra-repo-pkg-url --gpu-arch cuda )
532+
debfile=$( basename "${deburl}" )
533+
curl -fsSLO "${deburl}"
534+
dpkg -i "${debfile}"
535+
apt-get update
536+
537+
- name: Install system dependencies (2)
538+
run: |
539+
apt-get -y install \
540+
$(python3 ./firedrake-repo/scripts/firedrake-configure --arch default --gpu-arch cuda --show-system-packages)
541+
apt-get -y install python3-venv
542+
: # Dependencies needed to run the test suite
543+
apt-get -y install fonts-dejavu graphviz graphviz-dev parallel poppler-utils
544+
545+
- name: Install PETSc
546+
env:
547+
EXTRA_OPTIONS: -use_gpu_aware_mpi 0
548+
run: |
549+
if [ ${{ inputs.target_branch }} = 'release' ]; then
550+
git clone --depth 1 \
551+
--branch $(python3 ./firedrake-repo/scripts/firedrake-configure --gpu-arch cuda --show-petsc-version) \
552+
https://gitlab.com/petsc/petsc.git
553+
else
554+
git clone --depth 1 https://gitlab.com/petsc/petsc.git
555+
fi
556+
cd petsc
557+
python3 ../firedrake-repo/scripts/firedrake-configure \
558+
--arch default --gpu-arch cuda --show-petsc-configure-options | \
559+
xargs -L1 ./configure --with-make-np=4
560+
make
561+
make check
562+
{
563+
echo "PETSC_DIR=/__w/firedrake/firedrake/petsc"
564+
echo "PETSC_ARCH=arch-firedrake-default-cuda"
565+
echo "SLEPC_DIR=/__w/firedrake/firedrake/petsc/arch-firedrake-default-cuda"
566+
} >> "$GITHUB_ENV"
567+
568+
- name: Install Firedrake
569+
id: install
570+
run: |
571+
export $(python3 ./firedrake-repo/scripts/firedrake-configure --arch default --gpu-arch cuda --show-env)
572+
python3 -m venv venv
573+
. venv/bin/activate
574+
575+
: # Empty the pip cache to ensure that everything is compiled from scratch
576+
pip cache purge
577+
578+
if [ ${{ inputs.target_branch }} = 'release' ]; then
579+
EXTRA_PIP_FLAGS=''
580+
else
581+
: # Install build dependencies
582+
pip install "$PETSC_DIR"/src/binding/petsc4py
583+
pip install -r ./firedrake-repo/requirements-build.txt
584+
585+
: # We have to pass '--no-build-isolation' to use a custom petsc4py
586+
EXTRA_PIP_FLAGS='--no-build-isolation'
587+
fi
588+
589+
pip install --verbose $EXTRA_PIP_FLAGS \
590+
--no-binary h5py \
591+
--extra-index-url https://download.pytorch.org/whl/cu130 \
592+
'./firedrake-repo[ci]'
593+
594+
firedrake-clean
595+
pip list
596+
597+
- name: Run smoke tests
598+
run: |
599+
. venv/bin/activate
600+
firedrake-check
601+
timeout-minutes: 10
602+
603+
- name: Confirm GPU usage in OffloadPC test
604+
shell: bash
605+
run: |
606+
. venv/bin/activate
607+
# We expect >80% of compute in SNESSolve to be performed on the GPU with GAMG pc and CG ksp. When
608+
# -log_view -log_view_gpu_time is enabled, the final column of the PETSc profiling output is the
609+
# percentage of FLOPs performed on the GPU. This test extracts the line beginning with SNESSolve (example below)
610+
# into an array and tests if the final element of that array is above 80.
611+
# -----
612+
# SNESSolve 1 1.0 8.6306e-01 1.0 2.50e+05 1.0 0.0e+00 0.0e+00 0.0e+00 22 89 0 0 0 22 89 0 0 0 0 7 27 4.99e-02 21 2.63e-02 87
613+
#
614+
while read -r line; do
615+
if [[ "${line}" =~ ^SNESSolve ]]; then
616+
readarray -d' ' arr <<<"${line}"
617+
echo "SNESSolve PETSc log_view line"
618+
echo "============================="
619+
echo "${line}"
620+
[[ "${arr[-1]}" -gt 80 ]] && exit 0 || exit 1
621+
fi
622+
done < <( python firedrake-repo/tests/firedrake/offload/test_poisson_offloading_pc.py -log_view -log_view_gpu_time )
623+
echo "SNESSolve not found in PETSc log_view output!"
624+
exit 1
625+
626+
- name: Post-run cleanup
627+
if: always()
628+
run: |
629+
find . -delete
630+
463631
lint:
464632
name: Lint codebase
465633
runs-on: ubuntu-latest
@@ -505,15 +673,7 @@ jobs:
505673
firedrake-clean
506674
pip list
507675
508-
- name: Check bibtex
509-
run: make -C firedrake-repo/docs validate-bibtex
510-
511-
- name: Check documentation links
512-
if: success() || steps.install.conclusion == 'success'
513-
run: make -C firedrake-repo/docs linkcheck
514-
515676
- name: Build documentation
516-
if: success() || steps.install.conclusion == 'success'
517677
id: build_docs
518678
working-directory: firedrake-repo/docs
519679
run: |
@@ -523,6 +683,14 @@ jobs:
523683
# : Copy manual to HTML tree
524684
cp build/latex/Firedrake.pdf build/html/_static/manual.pdf
525685
686+
- name: Check bibtex
687+
if: success() || steps.install.conclusion == 'success'
688+
run: make -C firedrake-repo/docs validate-bibtex
689+
690+
- name: Check documentation links
691+
if: success() || steps.install.conclusion == 'success'
692+
run: make -C firedrake-repo/docs linkcheck
693+
526694
- name: Upload documentation
527695
uses: actions/upload-pages-artifact@v3
528696
id: upload_docs

.github/workflows/pr.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ jobs:
1212
target_branch: ${{ github.base_ref }}
1313
# Only run macOS tests if the PR is labelled 'macOS'
1414
test_macos: ${{ contains(github.event.pull_request.labels.*.name, 'macOS') }}
15+
# Only run GPU tests if the PR is labelled 'gpu'
16+
test_gpu: ${{ contains(github.event.pull_request.labels.*.name, 'gpu') }}
1517
secrets: inherit

.github/workflows/push.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
source_ref: ${{ github.ref_name }}
1414
target_branch: ${{ github.ref_name }}
1515
test_macos: true
16+
test_gpu: true
1617
deploy_website: true
1718
secrets: inherit
1819

.github/workflows/release.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ on:
1111
description: The version number to release
1212
type: string
1313
required: true
14+
prev_version:
15+
description: The previously most up-to-date version number
16+
type: string
17+
required: true
1418

1519
jobs:
1620
check:
@@ -62,7 +66,7 @@ jobs:
6266
- name: Create release
6367
env:
6468
GH_TOKEN: ${{ github.token }}
65-
run: gh release create --title ${{ inputs.version }} --target ${{ inputs.branch }} --generate-notes ${{ inputs.version }}
69+
run: gh release create --title ${{ inputs.version }} --target ${{ inputs.branch }} --generate-notes ${{ inputs.version }} --notes-start-tag ${{ inputs.prev_version }}
6670

6771
docker:
6872
name: Build Docker containers

MANIFEST.in

Lines changed: 0 additions & 5 deletions
This file was deleted.

Makefile

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
.PHONY: all
2-
all: modules
3-
4-
.PHONY: modules
5-
modules:
1+
.PHONY: ext
2+
ext:
63
@echo " Building extension modules"
7-
@python setup.py build_ext --inplace > build.log 2>&1 || cat build.log
4+
@python setup.py build_ext --inplace 2>&1 | tee cat build.log
5+
6+
.PHONY: extforce
7+
extforce:
8+
@echo " Force building all extension modules"
9+
@python setup.py build_ext --inplace --force 2>&1 | tee cat build.log
810

911
.PHONY: lint
1012
lint: srclint actionlint dockerlint
@@ -55,39 +57,6 @@ dockerlint:
5557
|| exit 1; \
5658
done
5759

58-
.PHONY: clean
59-
clean:
60-
@echo " Cleaning extension modules"
61-
@python setup.py clean > /dev/null 2>&1
62-
@echo " RM firedrake/cython/dmplex.*.so"
63-
-@rm -f firedrake/cython/dmplex.so > /dev/null 2>&1
64-
@echo " RM firedrake/cython/dmplex.c"
65-
-@rm -f firedrake/cython/dmplex.c > /dev/null 2>&1
66-
@echo " RM firedrake/cython/extrusion_numbering.*.so"
67-
-@rm -f firedrake/cython/extrusion_numbering.so > /dev/null 2>&1
68-
@echo " RM firedrake/cython/extrusion_numbering.c"
69-
-@rm -f firedrake/cython/extrusion_numbering.c > /dev/null 2>&1
70-
@echo " RM firedrake/cython/hdf5interface.*.so"
71-
-@rm -f firedrake/cython/hdf5interface.so > /dev/null 2>&1
72-
@echo " RM firedrake/cython/hdf5interface.c"
73-
-@rm -f firedrake/cython/hdf5interface.c > /dev/null 2>&1
74-
@echo " RM firedrake/cython/spatialindex.*.so"
75-
-@rm -f firedrake/cython/spatialindex.so > /dev/null 2>&1
76-
@echo " RM firedrake/cython/spatialindex.c"
77-
-@rm -f firedrake/cython/spatialindex.c > /dev/null 2>&1
78-
@echo " RM firedrake/cython/supermeshimpl.*.so"
79-
-@rm -f firedrake/cython/supermeshimpl.so > /dev/null 2>&1
80-
@echo " RM firedrake/cython/supermeshimpl.c"
81-
-@rm -f firedrake/cython/supermeshimpl.c > /dev/null 2>&1
82-
@echo " RM firedrake/cython/mg/impl.*.so"
83-
-@rm -f firedrake/cython/mg/impl.so > /dev/null 2>&1
84-
@echo " RM firedrake/cython/mg/impl.c"
85-
-@rm -f firedrake/cython/mg/impl.c > /dev/null 2>&1
86-
@echo " RM pyop2/*.so"
87-
-@rm -f pyop2/*.so > /dev/null 2>&1
88-
@echo " RM tinyasm/*.so"
89-
-@rm -f tinyasm/*.so > /dev/null 2>&1
90-
9160
# NOTE: It is recommended to run this command from inside the 'firedrake'
9261
# Docker image to reduce the likelihood of test failures.
9362
.PHONY: test_durations
33.3 KB
Loading

0 commit comments

Comments
 (0)