From b1195966a3ca4b22a512885054a442fcc28f796d Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Wed, 6 Aug 2025 13:52:08 +1000 Subject: [PATCH 1/3] build-CI data and manifests --- .github/build-ci/data/standard.json | 6 ++++++ .../manifests/gcc-no-access3.spack.yaml.j2 | 10 ++++++++++ .../build-ci/manifests/intel-access3.spack.yaml.j2 | 10 ++++++++++ .../manifests/intel-no-access3.spack.yaml.j2 | 10 ++++++++++ .../manifests/oneapi-access3.spack.yaml.j2 | 14 ++++++++++++++ .../manifests/oneapi-no-access3.spack.yaml.j2 | 14 ++++++++++++++ 6 files changed, 64 insertions(+) create mode 100644 .github/build-ci/data/standard.json create mode 100644 .github/build-ci/manifests/gcc-no-access3.spack.yaml.j2 create mode 100644 .github/build-ci/manifests/intel-access3.spack.yaml.j2 create mode 100644 .github/build-ci/manifests/intel-no-access3.spack.yaml.j2 create mode 100644 .github/build-ci/manifests/oneapi-access3.spack.yaml.j2 create mode 100644 .github/build-ci/manifests/oneapi-no-access3.spack.yaml.j2 diff --git a/.github/build-ci/data/standard.json b/.github/build-ci/data/standard.json new file mode 100644 index 0000000000..3aa9594d95 --- /dev/null +++ b/.github/build-ci/data/standard.json @@ -0,0 +1,6 @@ +{ + "gcc_compiler": "gcc@13.2.0", + "intel_compiler": "intel@2021.10.0", + "oneapi_compiler": "oneapi@2025.2.0", + "target": "x86_64" +} diff --git a/.github/build-ci/manifests/gcc-no-access3.spack.yaml.j2 b/.github/build-ci/manifests/gcc-no-access3.spack.yaml.j2 new file mode 100644 index 0000000000..9124829a9b --- /dev/null +++ b/.github/build-ci/manifests/gcc-no-access3.spack.yaml.j2 @@ -0,0 +1,10 @@ +spack: + specs: + - access-ww3 @git.{{ ref }} ~access3 + packages: + all: + require: + - '%{{ gcc_compiler }} target={{ target}}' + concretizer: + unify: false + view: false diff --git a/.github/build-ci/manifests/intel-access3.spack.yaml.j2 b/.github/build-ci/manifests/intel-access3.spack.yaml.j2 new file mode 100644 index 0000000000..4c488eaf92 --- /dev/null +++ b/.github/build-ci/manifests/intel-access3.spack.yaml.j2 @@ -0,0 +1,10 @@ +spack: + specs: + - access-ww3 @git.{{ ref }} +access3 + packages: + all: + require: + - '%{{ intel_compiler }} target={{ target }}' + concretizer: + unify: false + view: false diff --git a/.github/build-ci/manifests/intel-no-access3.spack.yaml.j2 b/.github/build-ci/manifests/intel-no-access3.spack.yaml.j2 new file mode 100644 index 0000000000..8596347c63 --- /dev/null +++ b/.github/build-ci/manifests/intel-no-access3.spack.yaml.j2 @@ -0,0 +1,10 @@ +spack: + specs: + - access-ww3 @git.{{ ref }} ~access3 + packages: + all: + require: + - '%{{ intel_compiler }} target={{ target }}' + concretizer: + unify: false + view: false diff --git a/.github/build-ci/manifests/oneapi-access3.spack.yaml.j2 b/.github/build-ci/manifests/oneapi-access3.spack.yaml.j2 new file mode 100644 index 0000000000..bfa80ecd56 --- /dev/null +++ b/.github/build-ci/manifests/oneapi-access3.spack.yaml.j2 @@ -0,0 +1,14 @@ +spack: + specs: + - access-ww3 @git.{{ ref }} +access3 build_type=Debug + - access-ww3 @git.{{ ref }} +access3 + packages: + gcc-runtime: + require: + - '%gcc target={{ target }}' + all: + require: + - '%{{ oneapi_compiler }} target={{ target }}' + concretizer: + unify: false + view: false diff --git a/.github/build-ci/manifests/oneapi-no-access3.spack.yaml.j2 b/.github/build-ci/manifests/oneapi-no-access3.spack.yaml.j2 new file mode 100644 index 0000000000..0d5d1e7ef5 --- /dev/null +++ b/.github/build-ci/manifests/oneapi-no-access3.spack.yaml.j2 @@ -0,0 +1,14 @@ +spack: + specs: + - access-ww3 @git.{{ ref }} ~access3 +openmp + - access-ww3 @git.{{ ref }} ~access3 + packages: + gcc-runtime: + require: + - '%gcc target={{ target }}' + all: + require: + - '%{{ oneapi_compiler }} target={{ target }}' + concretizer: + unify: false + view: false From f9d554d098dea4cb061f69c3461179f0d8b8445d Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Wed, 6 Aug 2025 13:53:49 +1000 Subject: [PATCH 2/3] CI workflow --- .github/workflows/ci.yml | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..fddaf66a15 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: Build +on: + pull_request: + push: + branches: + - main + - dev/* +jobs: + pre-ci: + name: Pre-CI + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - uses: actions/checkout@v4 + + - name: Set up matrix + id: set-matrix + # Find all relevant files under .github/build-ci/manifests + # then output them as a JSON array (minus the last comma) + run: | + files=$(find .github/build-ci/manifests/ -iname '*.j2' -printf '"%p",') + echo "matrix=[${files%,}]" >> $GITHUB_OUTPUT + + ci: + name: CI + needs: pre-ci + strategy: + fail-fast: false + max-parallel: 5 + matrix: + file: ${{ fromJson(needs.pre-ci.outputs.matrix) }} + uses: access-nri/build-ci/.github/workflows/ci.yml@v2 + with: + spack-manifest-path: ${{ matrix.file }} + allow-ssh-into-spack-install: false # If true, PR author must ssh into instance to complete job + spack-manifest-data-path: .github/build-ci/data/standard.json + # spack-packages-ref: main + # spack-config-ref: main + # spack-ref: releases/v0.22 From df44b72f2c215374e95333609ba4c7c0bf195d9a Mon Sep 17 00:00:00 2001 From: anton-seaice Date: Wed, 6 Aug 2025 13:59:18 +1000 Subject: [PATCH 3/3] some extra MPI linking --- CMakeLists.txt | 3 ++- cmake/Access3Ww3libConfig.cmake.in | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ed49c0d8b0..197d1c526a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,7 +91,7 @@ set(CMAKE_INSTALL_MODULEDIR ${CMAKE_INSTALL_INCLUDEDIR} # External packages # #]==============================================================================] -find_package(MPI REQUIRED) +find_package(MPI REQUIRED COMPONENTS Fortran) if(WW3_ACCESS3) find_package(Access3Share REQUIRED share) @@ -126,6 +126,7 @@ set_property(SOURCE ${SRC}/w3initmd.F90 "__WW3_SWITCHES__=\'\'" ) target_link_libraries(ww3lib PUBLIC NetCDF::NetCDF_Fortran) +target_link_libraries(ww3lib PUBLIC MPI::MPI_Fortran) if(WW3_ACCESS3) target_link_libraries(ww3lib PRIVATE Access3::share) diff --git a/cmake/Access3Ww3libConfig.cmake.in b/cmake/Access3Ww3libConfig.cmake.in index ce8f22ec95..f7de234c85 100644 --- a/cmake/Access3Ww3libConfig.cmake.in +++ b/cmake/Access3Ww3libConfig.cmake.in @@ -3,9 +3,12 @@ @PACKAGE_INIT@ if(@OPENMP@) - find_package(OpenMP REQUIRED) + find_dependency(OpenMP REQUIRED) endif() +find_dependency(NetCDF 4.7.3 REQUIRED Fortran) +find_dependency(MPI REQUIRED COMPONENTS Fortran) + # Request components set(_required_components ${Ww3lib_FIND_COMPONENTS})