|
23 | 23 | description: Whether to test using macOS |
24 | 24 | type: boolean |
25 | 25 | default: false |
| 26 | + test_gpu: |
| 27 | + description: Whether to test using CUDA-enabled PETSc |
| 28 | + type: boolean |
| 29 | + default: false |
26 | 30 | deploy_website: |
27 | 31 | description: Whether to deploy the website |
28 | 32 | type: boolean |
|
54 | 58 | description: Whether to test using macOS |
55 | 59 | type: boolean |
56 | 60 | default: false |
| 61 | + test_gpu: |
| 62 | + description: Whether to test using CUDA-enabled PETSc |
| 63 | + type: boolean |
| 64 | + default: false |
57 | 65 | deploy_website: |
58 | 66 | description: Whether to deploy the website |
59 | 67 | type: boolean |
@@ -465,6 +473,137 @@ jobs: |
465 | 473 | run: | |
466 | 474 | find . -delete |
467 | 475 |
|
| 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 | +
|
468 | 607 | lint: |
469 | 608 | name: Lint codebase |
470 | 609 | runs-on: ubuntu-latest |
|
0 commit comments