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
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,137 @@ 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+ './firedrake-repo[check]'
592+
593+ firedrake-clean
594+ pip list
595+
596+ - name : Run smoke tests
597+ run : |
598+ . venv/bin/activate
599+ firedrake-check
600+ timeout-minutes : 10
601+
602+ - name : Post-run cleanup
603+ if : always()
604+ run : |
605+ find . -delete
606+
463607 lint :
464608 name : Lint codebase
465609 runs-on : ubuntu-latest
@@ -505,15 +649,7 @@ jobs:
505649 firedrake-clean
506650 pip list
507651
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-
515652 - name : Build documentation
516- if : success() || steps.install.conclusion == 'success'
517653 id : build_docs
518654 working-directory : firedrake-repo/docs
519655 run : |
@@ -523,6 +659,14 @@ jobs:
523659 # : Copy manual to HTML tree
524660 cp build/latex/Firedrake.pdf build/html/_static/manual.pdf
525661
662+ - name : Check bibtex
663+ if : success() || steps.install.conclusion == 'success'
664+ run : make -C firedrake-repo/docs validate-bibtex
665+
666+ - name : Check documentation links
667+ if : success() || steps.install.conclusion == 'success'
668+ run : make -C firedrake-repo/docs linkcheck
669+
526670 - name : Upload documentation
527671 uses : actions/upload-pages-artifact@v3
528672 id : upload_docs
0 commit comments