From 6ad3a6e404a6b017cf927227e83c6614f088a8d5 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Sun, 16 Nov 2025 14:41:11 -0800 Subject: [PATCH 1/8] CI: Initial overhaul * Add matrix config * Add Version Info step * Use FPM latest * split out OC build and expand cache key * parameterize OC version and upgrade to 2.10.3 --- .github/workflows/CI.yml | 94 ++++++++++++++++++++++++++++++++-------- 1 file changed, 76 insertions(+), 18 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 841a3cbe..c109bba0 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -4,44 +4,102 @@ on: [push, pull_request] jobs: Build: - runs-on: [ubuntu-latest] + name: ${{ matrix.compiler }}-${{ matrix.version }} (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + strategy: + fail-fast: false + matrix: + os: [ ubuntu-24.04 ] + compiler: [ gfortran ] + version: [ 14 ] + extra_flags: [ -g ] + oc_version: [ 2.10.3 ] env: - FC: gfortran - GCC_V: 14 + COMPILER_VERSION: ${{ matrix.version }} + OC_VERSION: ${{ matrix.oc_version }} + FC: ${{ matrix.compiler }} + FFLAGS: ${{ matrix.extra_flags }} + FPM_FLAGS: --profile release --verbose steps: - name: Checkout code uses: actions/checkout@v4 - name: Install fpm - uses: fortran-lang/setup-fpm@v7 + uses: fortran-lang/setup-fpm@main with: github-token: ${{ secrets.GITHUB_TOKEN }} + fpm-version: latest - name: Get Time id: time - uses: nanzm/get-time-action@v1.1 + uses: nanzm/get-time-action@master with: format: 'YYYY-MM' - - name: Setup cache for opencoarrays + - name: Install Ubuntu Native Dependencies + if: ${{ contains(matrix.os, 'ubuntu') && matrix.container == '' && matrix.compiler == 'gfortran' }} + run: | + set -x + sudo apt update + sudo apt install -y build-essential pkg-config make + sudo apt install -y gfortran-${COMPILER_VERSION} g++-${COMPILER_VERSION} + + - name: OpenCoarrays/MPICH Cache id: cache-opencoarrays - uses: actions/cache@v3 + uses: actions/cache@v4 with: - path: "OpenCoarrays-2.10.2/" - key: ${{ steps.time.outputs.time }} + path: OpenCoarrays-${{ matrix.oc_version }} + key: OpenCoarrays-${{ matrix.oc_version }}-${{ matrix.compiler }}-${{ matrix.version }}-${{ matrix.os }}-${{ steps.time.outputs.time }} - - name: Install GFortran, OpenCoarrays + - name: OpenCoarrays/MPICH Build + if: ${{ steps.cache-opencoarrays.outputs.cache-hit != 'true' }} run: | - sudo apt update - sudo apt install -y build-essential gfortran-${GCC_V} g++-${GCC_V} pkg-config make - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \ - --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \ - --slave /usr/bin/g++ g++ /usr/bin/g++-${GCC_V} - if [ ! -d OpenCoarrays-2.10.2 ] ; then wget -P . https://github.com/sourceryinstitute/OpenCoarrays/releases/download/2.10.2/OpenCoarrays-2.10.2.tar.gz && tar -xf OpenCoarrays-2.10.2.tar.gz && cd OpenCoarrays-2.10.2 && TERM=xterm ./install.sh -y; fi + set -x + rm -Rf OpenCoarrays-${OC_VERSION} + #OC_URL=https://github.com/sourceryinstitute/OpenCoarrays/releases/download/${OC_VERSION}/OpenCoarrays-${OC_VERSION}.tar.gz + OC_URL=https://github.com/sourceryinstitute/OpenCoarrays/archive/refs/tags/${OC_VERSION}.tar.gz + wget -P . ${OC_URL} + tar -xf ${OC_VERSION}.tar.gz + cd OpenCoarrays-${OC_VERSION} + TERM=xterm ./install.sh --yes-to-all \ + --with-fortran gfortran-${COMPILER_VERSION} \ + --with-cxx g++-${COMPILER_VERSION} \ + --with-c gcc-${COMPILER_VERSION} + + - name: Setup Compilers + run: | + set -x + PREFIX="$PWD/OpenCoarrays-${OC_VERSION}/prerequisites/installations" + OC_PATH="$PREFIX/opencoarrays/${OC_VERSION}" + MPI_PATH=$(ls -d $PREFIX/mpich/*) + #ls -alR ${PREFIX} + cat ${OC_PATH}/setup.sh + echo "PATH=${OC_PATH}/bin:${MPI_PATH}/bin:$PATH" >> "$GITHUB_ENV" + echo "FC=gfortran-${COMPILER_VERSION}" >> "$GITHUB_ENV" + echo "FPM_FFLAGS=${FFLAGS}" >> "$GITHUB_ENV" + echo "FPM_CFLAGS=${CFLAGS}" >> "$GITHUB_ENV" + echo "FPM_CXXFLAGS=${CXXFLAGS}" >> "$GITHUB_ENV" + echo "FPM_LDFLAGS=${LDFLAGS}" >> "$GITHUB_ENV" + + - name: Version info + run: | + echo == TOOL VERSIONS == + echo Platform version info: + uname -a + if test -r /etc/os-release ; then grep -e NAME -e VERSION /etc/os-release ; fi + if test -x /usr/bin/sw_vers ; then /usr/bin/sw_vers ; fi + echo + echo PATH="$PATH" + for tool in ${FC} caf mpicc mpif90 fpm ; do + ( echo ; set -x ; w=$(which $tool) ; ls -al $w ; ls -alhL $w ; $tool --version ) + done - name: Build, run, and test run: | - source OpenCoarrays-2.10.2/prerequisites/installations/opencoarrays/2.10.2/setup.sh - fpm test --compiler caf --runner "cafrun -n 2" + #source OpenCoarrays-${OC_VERSION}/prerequisites/installations/opencoarrays/${OC_VERSION}/setup.sh + fpm test --compiler caf --runner "cafrun -n 2" ${FPM_FLAGS} From 133be952954f34eda4c81114c373a7229a72d044 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Mon, 17 Nov 2025 17:48:02 -0800 Subject: [PATCH 2/8] test/subdomain_test_m: Workaround a defect in gfortran-13 --- test/subdomain_test_m.F90 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/subdomain_test_m.F90 b/test/subdomain_test_m.F90 index b6e53f5e..fe1fa432 100644 --- a/test/subdomain_test_m.F90 +++ b/test/subdomain_test_m.F90 @@ -97,9 +97,13 @@ function concave_laplacian() result(test_diagnosis) block real, parameter :: tolerance = 1.0E-06 + integer :: nx, ny, nz logical internally_zero, concave_at_faces, doubly_concave_at_edges, triply_concave_in_corners, constant_away_from_edges - associate(me=>this_image(), n_subdomains=>num_images(), nx=>size(lap_f_vals,1), ny=>size(lap_f_vals,2),nz=>size(lap_f_vals,3)) + nx = size(lap_f_vals,1) + ny = size(lap_f_vals,2) + nz = size(lap_f_vals,3) + associate(me=>this_image(), n_subdomains=>num_images()) associate(first_zero_in_x => merge(3, 1, me==1), last_zero_in_x => merge(nx-2, nx, me==n_subdomains)) internally_zero = all(abs(lap_f_vals(first_zero_in_x:last_zero_in_x, 3:ny-2, 3:nz-2)) < tolerance) end associate @@ -249,4 +253,4 @@ function T_procedural() end function end function -end module subdomain_test_m \ No newline at end of file +end module subdomain_test_m From 7c5c38bf3418d565b21053cb29d92fd7c358e86b Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Mon, 17 Nov 2025 17:23:04 -0800 Subject: [PATCH 3/8] CI: Add Gfortran 13 on Linux --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c109bba0..bb8e2405 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -14,8 +14,8 @@ jobs: matrix: os: [ ubuntu-24.04 ] compiler: [ gfortran ] - version: [ 14 ] - extra_flags: [ -g ] + version: [ 13, 14 ] + extra_flags: [ -g -ffree-line-length-0 ] oc_version: [ 2.10.3 ] env: From a337a12600f0f396b5b487b11f66597c51952390 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Tue, 18 Nov 2025 10:42:29 -0800 Subject: [PATCH 4/8] CI: Add macos support --- .github/workflows/CI.yml | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index bb8e2405..fbf4dd89 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -12,12 +12,19 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-24.04 ] + os: [ macos-14, macos-15, macos-15-intel, ubuntu-24.04 ] compiler: [ gfortran ] - version: [ 13, 14 ] - extra_flags: [ -g -ffree-line-length-0 ] + version: [ 14 ] + extra_flags: [ -g ] oc_version: [ 2.10.3 ] + include: + - os: ubuntu-24.04 + compiler: gfortran + version: 13 + extra_flags: -g -ffree-line-length-0 + oc_version: 2.10.3 + env: COMPILER_VERSION: ${{ matrix.version }} OC_VERSION: ${{ matrix.oc_version }} @@ -41,6 +48,18 @@ jobs: with: format: 'YYYY-MM' + - name: Install macOS Dependencies + if: ${{ contains(matrix.os, 'macos') && matrix.compiler == 'gfortran' && matrix.version == 14 }} + run: | + set -x + brew update + # fpm binary distribution for macOS requires gfortran shared libraries from gcc@12 + brew install -v gcc@12 + brew install -v opencoarrays gcc@14 open-mpi + #brew --prefix + #ls -alR $(brew --prefix)/bin + echo "FC=gfortran-${COMPILER_VERSION}" >> "$GITHUB_ENV" + - name: Install Ubuntu Native Dependencies if: ${{ contains(matrix.os, 'ubuntu') && matrix.container == '' && matrix.compiler == 'gfortran' }} run: | @@ -50,6 +69,7 @@ jobs: sudo apt install -y gfortran-${COMPILER_VERSION} g++-${COMPILER_VERSION} - name: OpenCoarrays/MPICH Cache + if: ${{ contains(matrix.os, 'ubuntu') && matrix.container == '' }} id: cache-opencoarrays uses: actions/cache@v4 with: @@ -57,7 +77,7 @@ jobs: key: OpenCoarrays-${{ matrix.oc_version }}-${{ matrix.compiler }}-${{ matrix.version }}-${{ matrix.os }}-${{ steps.time.outputs.time }} - name: OpenCoarrays/MPICH Build - if: ${{ steps.cache-opencoarrays.outputs.cache-hit != 'true' }} + if: ${{ steps.cache-opencoarrays.outputs.cache-hit != 'true' && contains(matrix.os, 'ubuntu') && matrix.container == '' }} run: | set -x rm -Rf OpenCoarrays-${OC_VERSION} @@ -71,7 +91,8 @@ jobs: --with-cxx g++-${COMPILER_VERSION} \ --with-c gcc-${COMPILER_VERSION} - - name: Setup Compilers + - name: Setup Ubuntu Compilers + if: ${{ contains(matrix.os, 'ubuntu') && matrix.container == '' && matrix.compiler == 'gfortran' }} run: | set -x PREFIX="$PWD/OpenCoarrays-${OC_VERSION}/prerequisites/installations" @@ -96,7 +117,10 @@ jobs: echo echo PATH="$PATH" for tool in ${FC} caf mpicc mpif90 fpm ; do - ( echo ; set -x ; w=$(which $tool) ; ls -al $w ; ls -alhL $w ; $tool --version ) + ( echo ; set -x ; w=$(which $tool) ; \ + if test -n "$w" ; then \ + ls -al $w ; ls -alhL $w ; $tool --version || echo ERROR=$? ; \ + fi ) done - name: Build, run, and test From db0901063c0f3ad8a7725ec4f60f96d8f1637ab8 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Tue, 18 Nov 2025 12:29:37 -0800 Subject: [PATCH 5/8] test/subdomain_test_m: Loosen tolerance in functional_matches_procedural test On macOS AARCH64 with gfortran 14.3.0, the max difference is about 1.E-05 --- test/subdomain_test_m.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/subdomain_test_m.F90 b/test/subdomain_test_m.F90 index fe1fa432..10c7d30d 100644 --- a/test/subdomain_test_m.F90 +++ b/test/subdomain_test_m.F90 @@ -207,7 +207,7 @@ function correct_steady_state() result(test_diagnosis) function functional_matches_procedural() result(test_diagnosis) type(test_diagnosis_t) test_diagnosis - real, parameter :: tolerance = 1.E-06 + real, parameter :: tolerance = 1.E-05 integer, parameter :: steps = 1000, n=21 real, parameter :: alpha = 1. real, parameter :: side=1., boundary_val=1., internal_val=2. From 539e421b91a04996d0c0fb9c6741b53f8fd42cdd Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Tue, 18 Nov 2025 14:16:29 -0800 Subject: [PATCH 6/8] test/subdomain_test_m: Workaround an ifx defect --- test/subdomain_test_m.F90 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/subdomain_test_m.F90 b/test/subdomain_test_m.F90 index 10c7d30d..062f1a17 100644 --- a/test/subdomain_test_m.F90 +++ b/test/subdomain_test_m.F90 @@ -201,7 +201,12 @@ function correct_steady_state() result(test_diagnosis) end associate associate(residual => T%values() - T_steady) +#ifdef __INTEL_COMPILER + ! workaround a typecheck defect observed in ifx 2025.2.1 + test_diagnosis = .all. [(residual .isAtLeast. 0.) .and. (residual .isAtMost. tolerance)] +#else test_diagnosis = .all. ((residual .isAtLeast. 0.) .and. (residual .isAtMost. tolerance)) +#endif end associate end function @@ -214,7 +219,12 @@ function functional_matches_procedural() result(test_diagnosis) associate( T_f => T_functional(), T_p => T_procedural()) associate(L_infinity_norm => maxval(abs(T_f - T_p))) +#ifdef __INTEL_COMPILER + ! workaround a typecheck defect observed in ifx 2025.2.1 + test_diagnosis = .all. [T_f .approximates. T_p .within. tolerance] +#else test_diagnosis = .all. (T_f .approximates. T_p .within. tolerance) +#endif end associate end associate From 3f46b19b42743b0580174decb19e4381688a2541 Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Tue, 18 Nov 2025 14:18:04 -0800 Subject: [PATCH 7/8] README: Update documentation to reflect true compiler feature requirements --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2a12b6fe..ddaf5e60 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Despite advances in microscopy, imaging techniques only capture a very small spa Prerequisites ------------- -1. A Fortran 2018 compiler (`gfortran` + [OpenCoarrays]) +1. A Fortran 2018 compiler with multi-image/coarray support (e.g. `gfortran` + [OpenCoarrays]) 2. The Fortran Package Manager Downloading, Building, and Testing @@ -44,8 +44,11 @@ export FOR_COARRAY_NUM_IMAGES=4 fpm test --compiler ifx --profile release --flag "-heap-arrays -coarray" ``` +Note this requires a working install of Intel MPI. + #### Single-image (serial) execution Same as multi-image execution except `FOR_COARRAY_NUM_IMAGES=1`. +Also requires a working install of Intel MPI. #### Automatic GPU-based acceleration: _Experimental_ The following command is listed here for reference while we investigate what appear to be platform-specific compiler issues causing a crashe when automatic GPU-based acceleration is enabled with the required coarray features: From 3b75af12d31c45edd7792c423edae6676c13633c Mon Sep 17 00:00:00 2001 From: Dan Bonachea Date: Tue, 18 Nov 2025 18:58:12 -0800 Subject: [PATCH 8/8] CI: Add macos-26 --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index fbf4dd89..7ed83905 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ macos-14, macos-15, macos-15-intel, ubuntu-24.04 ] + os: [ macos-14, macos-15, macos-15-intel, macos-26, ubuntu-24.04 ] compiler: [ gfortran ] version: [ 14 ] extra_flags: [ -g ]