diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index 8ba3dbbe57..54c1411d7f 100644 --- a/.github/actions/install/action.yml +++ b/.github/actions/install/action.yml @@ -17,6 +17,10 @@ inputs: description: Scalar type ('default' or 'complex') type: string default: default + int_type: + description: Integer type ('int32' or 'int64') + type: string + default: int32 gpu: description: Target GPU platform type: string @@ -53,6 +57,7 @@ runs: apt-get -y install \ $(python3 ./firedrake-repo/scripts/firedrake-configure \ --scalar-type ${{ inputs.scalar_type }} \ + --int-type ${{ inputs.int_type }} \ --gpu-arch ${{ inputs.gpu }} \ --show-system-packages) : # Dependencies needed to run the test suite @@ -66,6 +71,7 @@ runs: brew install \ $(python3 ./firedrake-repo/scripts/firedrake-configure \ --scalar-type ${{ inputs.scalar_type }} \ + --int-type ${{ inputs.int_type }} \ --show-system-packages) else echo "Unrecognised 'os' input: '${{ inputs.os }}" @@ -101,6 +107,7 @@ runs: cd petsc python3 ../firedrake-repo/scripts/firedrake-configure \ --scalar-type ${{ inputs.scalar_type }} \ + --int-type ${{ inputs.int_type }} \ --gpu-arch ${{ inputs.gpu }} \ --show-petsc-configure-options | \ xargs -L1 ./configure \ @@ -114,6 +121,7 @@ runs: run: | export $(python3 ./firedrake-repo/scripts/firedrake-configure \ --scalar-type ${{ inputs.scalar_type }} \ + --int-type ${{ inputs.int_type }} \ --gpu-arch ${{ inputs.gpu }} \ --show-env) export SLEPC_DIR=$PETSC_DIR/$PETSC_ARCH diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index b7db61e65e..b648bf2715 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -23,6 +23,10 @@ on: description: Whether to test a complex build type: boolean required: true + test_int64: + description: Whether to test a 64-bit integer build + type: boolean + required: true test_cuda: description: Whether to test using CUDA-enabled PETSc type: boolean @@ -54,6 +58,10 @@ on: description: Whether to test a complex build type: boolean required: true + test_int64: + description: Whether to test a 64-bit integer build + type: boolean + required: true test_cuda: description: Whether to test using CUDA-enabled PETSc type: boolean @@ -262,10 +270,18 @@ jobs: id: generate run: | if [ ${{ inputs.test_complex }} == 'true' ]; then - matrix='{"scalar_type": "complex", "gpu": "none"}' + matrix='{"scalar_type": "complex", "int_type": "int32", "gpu": "none"}' + fi + if [ ${{ inputs.test_int64 }} == 'true' ]; then + arch='{"scalar_type": "default", "int_type": "int64", "gpu": "none"}' + if [ "$matrix" ]; then + matrix="$matrix, $arch" + else + matrix="$arch" + fi fi if [ ${{ inputs.test_cuda }} == 'true' ]; then - arch='{"scalar_type": "default", "gpu": "cuda"}' + arch='{"scalar_type": "default", "int_type": "int32", "gpu": "cuda"}' if [ "$matrix" ]; then matrix="$matrix, $arch" else @@ -319,6 +335,7 @@ jobs: source_ref: ${{ inputs.source_ref }} base_ref: ${{ inputs.base_ref }} scalar_type: ${{ matrix.scalar_type }} + int_type: ${{ matrix.int_type }} gpu: ${{ matrix.gpu }} deps: ci diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 8f250c86f7..ad2665061d 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -23,6 +23,7 @@ jobs: # Run all tests of a specific configuration (e.g. complex) if the right label # is on the PR, otherwise do nothing. test_complex: ${{ contains(github.event.pull_request.labels.*.name, 'ci:complex') }} + test_int64: ${{ contains(github.event.pull_request.labels.*.name, 'ci:int64') }} test_cuda: ${{ contains(github.event.pull_request.labels.*.name, 'ci:cuda') }} test_macos: ${{ contains(github.event.pull_request.labels.*.name, 'ci:macos') }} secrets: inherit diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 5719c624ff..f55da62a99 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -14,6 +14,7 @@ jobs: source_ref: ${{ github.ref_name }} base_ref: ${{ github.ref_name }} test_complex: true + test_int64: true test_cuda: true test_macos: true deploy_website: true diff --git a/docs/source/install.rst b/docs/source/install.rst index 01e58dc6d8..a9a94b47a5 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -413,16 +413,16 @@ Prepared configurations ----------------------- ``firedrake-configure`` provides a number of different possible configurations -(termed 'ARCHs') that specify how PETSc is configured and which external -packages are built. The currently supported ARCHs are: +that specify how PETSc is configured and which external packages are built. To +select a non-default configuration you can pass extra flags to +``firedrake-configure``. For example, to build Firedrake in complex mode you +should pass ``--scalar-type complex``:: -* ``default``: the default installation, suitable for most users -* ``complex``: an installation where PETSc is configured using complex numbers + $ python3 firedrake-configure --show-petsc-configure-options --scalar-type complex -The different configurations can be selected by passing the flag ``--arch`` to -``firedrake-configure``. For example:: +To see the full list of available options you should run:: - $ python3 firedrake-configure --show-petsc-configure-options --arch complex + $ python3 firedrake-configure --help Optional dependencies @@ -499,9 +499,9 @@ Since ``firedrake-configure`` only outputs a string of options it is straightfor to customise the options that are passed to PETSc ``configure``. You can either: * Append additional options when ``configure`` is invoked. For example, to - build PETSc with support for 64-bit indices you should run:: + build PETSc with HPDDM you should run:: - $ python3 ../firedrake-configure --show-petsc-configure-options | xargs -L1 ./configure --with-64-bit-indices + $ python3 ../firedrake-configure --show-petsc-configure-options | xargs -L1 ./configure --download-hpddm * Write the output of ``firedrake-configure`` to a file than can be modified. For example:: diff --git a/scripts/firedrake-configure b/scripts/firedrake-configure index 4bcafad20e..9e2f45db55 100755 --- a/scripts/firedrake-configure +++ b/scripts/firedrake-configure @@ -72,9 +72,10 @@ def main(): os_ = OS(args.os) if args.os else detect_os() scalar_type = ScalarType(args.scalar_type) + int_type = IntType(args.int_type) gpu_arch = GPUPlatform(args.gpu_arch) - arch_key = (os_, scalar_type, gpu_arch) + arch_key = (os_, scalar_type, int_type, gpu_arch) arch_key_str = f"{{{', '.join(f'{k.__class__.__name__}: {k.value}' for k in arch_key)}}}" if arch_key in OFFICIAL_ARCHS: arch = OFFICIAL_ARCHS[arch_key] @@ -162,6 +163,12 @@ Please see https://firedrakeproject.org/install for more information.""" default=ScalarType.DEFAULT.value, help="PETSc scalar type.", ) + parser.add_argument( + "--int-type", + choices=[it.value for it in IntType], + default=IntType.INT32.value, + help="PETSc integer type.", + ) parser.add_argument( "--gpu-arch", choices=[gpu_opt.value for gpu_opt in GPUPlatform], @@ -250,6 +257,11 @@ class ScalarType(enum.Enum): COMPLEX = "complex" +class IntType(enum.Enum): + INT32 = "int32" + INT64 = "int64" + + class GPUPlatform(enum.Enum): NO_GPU = "none" CUDA = "cuda" @@ -401,14 +413,14 @@ class CommunityArch(Arch): """ -ArchKey = tuple[OS, ScalarType, GPUPlatform] +ArchKey = tuple[OS, ScalarType, IntType, GPUPlatform] # Configurations with official support that are tested in CI OFFICIAL_ARCHS: Mapping[ArchKey, Arch] = { # Ubuntu 26.04 x86 - (OS.UBUNTU_2604_X86_64, ScalarType.DEFAULT, GPUPlatform.NO_GPU): Arch( + (OS.UBUNTU_2604_X86_64, ScalarType.DEFAULT, IntType.INT32, GPUPlatform.NO_GPU): Arch( name="default", system_packages=[ "bison", @@ -470,7 +482,7 @@ OFFICIAL_ARCHS: Mapping[ArchKey, Arch] = { ], ), - (OS.UBUNTU_2604_X86_64, ScalarType.COMPLEX, GPUPlatform.NO_GPU): Arch( + (OS.UBUNTU_2604_X86_64, ScalarType.COMPLEX, IntType.INT32, GPUPlatform.NO_GPU): Arch( name="complex", system_packages=[ "bison", @@ -530,9 +542,65 @@ OFFICIAL_ARCHS: Mapping[ArchKey, Arch] = { ], ), + (OS.UBUNTU_2604_X86_64, ScalarType.DEFAULT, IntType.INT64, GPUPlatform.NO_GPU): Arch( + name="int64", + system_packages=[ + "bison", + "build-essential", + "cmake", + "flex", + "gfortran", + "git", + "ninja-build", + "pkg-config", + "python3-dev", + "python3-pip", + + # PETSc external packages + "libfftw3-dev", + "libfftw3-mpi-dev", + "libhdf5-mpi-dev", + "libhwloc-dev", + "libnetcdf-dev", + "libopenblas-dev", + "libopenmpi-dev", + "libpnetcdf-dev", + "libscalapack-openmpi-dev", + "libsuitesparse-dev", + "libsuperlu-dev", + ], + extra_petsc_configure_options=[ + "--with-64-bit-indices", + "--with-bison", + "--with-fftw", + "--with-hdf5", + "--with-hwloc", + "--download-hypre", + "--download-metis", + "--download-mumps", + "--with-netcdf", + "--with-pnetcdf", + "--download-ptscotch", + "--with-scalapack-lib=-lscalapack-openmpi", + "--with-suitesparse", + "--download-superlu_dist", + "--with-zlib", + ], + cflags=["-O3", "-march=native", "-mtune=native"], + cxxflags=["-O3", "-march=native", "-mtune=native"], + fflags=["-O3", "-march=native", "-mtune=native"], + include_dirs=[ + "/usr/include/hdf5/openmpi", + "/usr/include/superlu", + ], + library_dirs=[ + "/usr/lib/x86_64-linux-gnu/hdf5/openmpi", + ], + ), + # Ubuntu 26.04 aarch64 - (OS.UBUNTU_2604_AARCH64, ScalarType.DEFAULT, GPUPlatform.NO_GPU): Arch( + (OS.UBUNTU_2604_AARCH64, ScalarType.DEFAULT, IntType.INT32, GPUPlatform.NO_GPU): Arch( name="default", system_packages=[ "bison", @@ -594,7 +662,7 @@ OFFICIAL_ARCHS: Mapping[ArchKey, Arch] = { ], ), - (OS.UBUNTU_2604_AARCH64, ScalarType.COMPLEX, GPUPlatform.NO_GPU): Arch( + (OS.UBUNTU_2604_AARCH64, ScalarType.COMPLEX, IntType.INT32, GPUPlatform.NO_GPU): Arch( name="complex", system_packages=[ "bison", @@ -656,7 +724,7 @@ OFFICIAL_ARCHS: Mapping[ArchKey, Arch] = { # Ubuntu 26.04 x86 CUDA - (OS.UBUNTU_2404_X86_64, ScalarType.DEFAULT, GPUPlatform.CUDA): Arch( + (OS.UBUNTU_2404_X86_64, ScalarType.DEFAULT, IntType.INT32, GPUPlatform.CUDA): Arch( name="default-cuda", system_packages=[ "bison", @@ -736,7 +804,7 @@ OFFICIAL_ARCHS: Mapping[ArchKey, Arch] = { # macOS arm64 - (OS.MACOS_ARM64, ScalarType.DEFAULT, GPUPlatform.NO_GPU): Arch( + (OS.MACOS_ARM64, ScalarType.DEFAULT, IntType.INT32, GPUPlatform.NO_GPU): Arch( name="default", system_packages=[ "autoconf", @@ -789,7 +857,7 @@ OFFICIAL_ARCHS: Mapping[ArchKey, Arch] = { extra_env_vars={"HDF5_DIR": "/opt/homebrew"}, ), - (OS.MACOS_ARM64, ScalarType.COMPLEX, GPUPlatform.NO_GPU): Arch( + (OS.MACOS_ARM64, ScalarType.COMPLEX, IntType.INT32, GPUPlatform.NO_GPU): Arch( name="complex", system_packages=[ "autoconf", @@ -845,7 +913,7 @@ OFFICIAL_ARCHS: Mapping[ArchKey, Arch] = { # Sane default configurations for unknown platforms - (OS.UNKNOWN, ScalarType.DEFAULT, GPUPlatform.NO_GPU): Arch( + (OS.UNKNOWN, ScalarType.DEFAULT, IntType.INT32, GPUPlatform.NO_GPU): Arch( name="default", extra_petsc_configure_options=[ "--download-bison", @@ -872,7 +940,7 @@ OFFICIAL_ARCHS: Mapping[ArchKey, Arch] = { }, ), - (OS.UNKNOWN, ScalarType.COMPLEX, GPUPlatform.NO_GPU): Arch( + (OS.UNKNOWN, ScalarType.COMPLEX, IntType.INT32, GPUPlatform.NO_GPU): Arch( name="complex", extra_petsc_configure_options=[ "--with-scalar-type=complex", @@ -899,6 +967,34 @@ OFFICIAL_ARCHS: Mapping[ArchKey, Arch] = { "CC": "mpicc", }, ), + + (OS.UNKNOWN, ScalarType.DEFAULT, IntType.INT64, GPUPlatform.NO_GPU): Arch( + name="int64", + extra_petsc_configure_options=[ + "--with-64-bit-indices", + "--download-bison", + "--download-fftw", + "--download-hdf5", + "--download-hwloc", + "--download-hypre", + "--download-metis", + "--download-mumps", + "--download-netcdf", + "--download-pnetcdf", + "--download-ptscotch", + "--download-scalapack", + "--download-suitesparse", + "--download-superlu_dist", + "--download-zlib", + ], + cflags=["-O3", "-march=native", "-mtune=native"], + cxxflags=["-O3", "-march=native", "-mtune=native"], + fflags=["-O3", "-march=native", "-mtune=native"], + extra_env_vars={ + "HDF5_DIR": "$PETSC_DIR/$PETSC_ARCH", + "CC": "mpicc", + }, + ), } @@ -908,7 +1004,7 @@ RETIRED_ARCHS: Mapping[ArchKey, RetiredArch] = { # Ubuntu 24.04 x86 - (OS.UBUNTU_2404_X86_64, ScalarType.DEFAULT, GPUPlatform.NO_GPU): RetiredArch( + (OS.UBUNTU_2404_X86_64, ScalarType.DEFAULT, IntType.INT32, GPUPlatform.NO_GPU): RetiredArch( name="default", last_modified="2026-05-13", system_packages=[ @@ -970,7 +1066,7 @@ RETIRED_ARCHS: Mapping[ArchKey, RetiredArch] = { ], ), - (OS.UBUNTU_2404_X86_64, ScalarType.COMPLEX, GPUPlatform.NO_GPU): RetiredArch( + (OS.UBUNTU_2404_X86_64, ScalarType.COMPLEX, IntType.INT32, GPUPlatform.NO_GPU): RetiredArch( name="complex", last_modified="2026-05-13", system_packages=[ @@ -1034,7 +1130,7 @@ RETIRED_ARCHS: Mapping[ArchKey, RetiredArch] = { # Ubuntu 24.04 aarch64 - (OS.UBUNTU_2404_AARCH64, ScalarType.DEFAULT, GPUPlatform.NO_GPU): RetiredArch( + (OS.UBUNTU_2404_AARCH64, ScalarType.DEFAULT, IntType.INT32, GPUPlatform.NO_GPU): RetiredArch( name="default", last_modified="2026-05-13", system_packages=[ @@ -1096,7 +1192,7 @@ RETIRED_ARCHS: Mapping[ArchKey, RetiredArch] = { ], ), - (OS.UBUNTU_2404_AARCH64, ScalarType.COMPLEX, GPUPlatform.NO_GPU): RetiredArch( + (OS.UBUNTU_2404_AARCH64, ScalarType.COMPLEX, IntType.INT32, GPUPlatform.NO_GPU): RetiredArch( name="complex", last_modified="2026-05-13", system_packages=[