Skip to content

Commit

Permalink
ci(parallel): add mf6 parallel test on windows (#1672)
Browse files Browse the repository at this point in the history
* build petsc with ifort/cl from cygwin
* factor out scripts for cygwin build steps
* factor out actions for mf6 parallel testing
* meson test serially to avoid errors on windows
  • Loading branch information
wpbonelli authored Mar 15, 2024
1 parent 2a34c3b commit c99aa8b
Show file tree
Hide file tree
Showing 11 changed files with 297 additions and 133 deletions.
152 changes: 152 additions & 0 deletions .github/actions/test-par-win/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
name: Test parallel MF6 (Windows)
description: Build and test parallel MODFLOW 6 on Windows
runs:
using: "composite"
steps:

- name: Convert line endings
shell: cmd
run: |
unix2dos -n "modflow6\.github\common\configure_petsc.sh" "%TEMP%\configure_petsc.sh"
unix2dos -n "modflow6\.github\common\compile_petsc.sh" "%TEMP%\compile_petsc.sh"
unix2dos -n "modflow6\.github\common\compile_modflow6.bat" "%TEMP%\compile_modflow6.bat"
unix2dos -n "modflow6\.github\common\test_modflow6.bat" "%TEMP%\test_modflow6.bat"
- name: Hide Strawberry programs
shell: bash
run: |
mkdir "$RUNNER_TEMP/strawberry"
mv /c/Strawberry/c/bin/gmake "$RUNNER_TEMP/strawberry/gmake"
mv /c/Strawberry/perl/bin/pkg-config "$RUNNER_TEMP/strawberry/pkg-config"
mv /c/Strawberry/perl/bin/pkg-config.bat "$RUNNER_TEMP/strawberry/pkg-config.bat"
- name: Get date
id: get-date
shell: bash
run: echo "date=$(/bin/date -u "+%Y%m%d")" >> "$GITHUB_OUTPUT"

- name: Set oneAPI install dir
id: oneapi-root
shell: bash
run: echo "ONEAPI_ROOT=C:\Program Files (x86)\Intel\oneAPI" >> "$GITHUB_ENV"

- name: Restore oneAPI cache
id: oneapi-cache
uses: actions/cache/restore@v3
with:
path: ${{ env.ONEAPI_ROOT }}
key: oneapi-${{ runner.os }}-${{ steps.get-date.outputs.date }}

- name: Install oneAPI BaseKit
shell: bash
if: steps.oneapi-cache.outputs.cache-hit != 'true'
run: |
url="https://registrationcenter-download.intel.com/akdlm/IRC_NAS/5cb30fb9-21e9-47e8-82da-a91e00191670/w_BaseKit_p_2024.0.1.45_offline.exe"
cmp="intel.oneapi.win.mkl.devel"
"modflow6/.github/common/install_intel_windows.bat" $url $cmp
rm -rf $TEMP/webimage.exe
rm -rf $TEMP/webimage_extracted
- name: Install oneAPI HPCKit
shell: bash
if: steps.oneapi-cache.outputs.cache-hit != 'true'
run: |
url="https://registrationcenter-download.intel.com/akdlm/IRC_NAS/7a6db8a1-a8b9-4043-8e8e-ca54b56c34e4/w_HPCKit_p_2024.0.1.35_offline.exe"
cmp="intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.ifort-compiler:intel.oneapi.win.mpi.devel"
"modflow6/.github/common/install_intel_windows.bat" $url $cmp
rm -rf $TEMP/webimage.exe
rm -rf $TEMP/webimage_extracted
- name: Save oneAPI cache
if: steps.oneapi-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: ${{ env.ONEAPI_ROOT }}
key: oneapi-${{ runner.os }}-${{ steps.get-date.outputs.date }}

- name: Restore PETSc cache
id: petsc-cache
uses: actions/cache/restore@v3
with:
path: petsc
key: petsc-${{ runner.os }}-${{ steps.get-date.outputs.date }}

- name: Configure environment
shell: bash
run: |
PETSC_DIR=$GITHUB_WORKSPACE/petsc
PETSC_ARCH=arch-mswin-c-opt
echo "PETSC_DIR=$PETSC_DIR" >> $GITHUB_ENV
echo "PETSC_ARCH=$PETSC_ARCH" >> $GITHUB_ENV
echo "$PETSC_DIR/$PETSC_ARCH/lib" >> $GITHUB_PATH
- name: Download PETSc
if: steps.petsc-cache.outputs.cache-hit != 'true'
shell: bash
run: |
curl https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-3.20.5.tar.gz -O -J
mkdir petsc
tar -xzf petsc-3.20.5.tar.gz -C petsc --strip-components=1
- name: Setup Cygwin
if: steps.petsc-cache.outputs.cache-hit != 'true'
uses: egor-tensin/setup-cygwin@v4
with:
packages: python3 make gcc-core gcc-g++ pkg-config

- name: Hide Cygwin linker
if: steps.petsc-cache.outputs.cache-hit != 'true'
shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'
run: |
mv /usr/bin/link.exe /usr/bin/link-cygwin.exe
which link
- name: Configure PETSc
if: steps.petsc-cache.outputs.cache-hit != 'true'
shell: cmd
run: |
"${{ env.ONEAPI_ROOT }}\setvars.bat" intel64 vs2022 && "C:\tools\cygwin\bin\bash.exe" --login --norc -eo pipefail -o igncr "%TEMP%\configure_petsc.sh"
- name: Build PETSc
if: steps.petsc-cache.outputs.cache-hit != 'true'
shell: cmd
run: |
"${{ env.ONEAPI_ROOT }}\setvars.bat" intel64 vs2022 && "C:\tools\cygwin\bin\bash.exe" --login --norc -eo pipefail -o igncr "%TEMP%\compile_petsc.sh"
- name: Save PETSc cache
if: steps.petsc-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: petsc
key: petsc-${{ runner.os }}-${{ steps.get-date.outputs.date }}

- name: Build modflow6
shell: cmd
run: |
"${{ env.ONEAPI_ROOT }}\setvars.bat" intel64 vs2022 && "%TEMP%\compile_modflow6.bat"
- name: Show Meson logs
if: failure()
shell: bash
working-directory: modflow6
run: cat builddir/meson-logs/meson-log.txt

- name: Update flopy
working-directory: modflow6/autotest
shell: cmd
run: micromamba run -r "C:\Users\runneradmin\micromamba" -n modflow6 python update_flopy.py

- name: Get executables
working-directory: modflow6/autotest
shell: cmd
env:
GITHUB_TOKEN: ${{ github.token }}
run: micromamba run -r "C:\Users\runneradmin\micromamba" -n modflow6 pytest -v --durations 0 get_exes.py

- name: Test programs
working-directory: modflow6/autotest
shell: cmd
env:
REPOS_PATH: ${{ github.workspace }}
run: |
"${{ env.ONEAPI_ROOT }}\setvars.bat" intel64 vs2022 && "%TEMP%\test_modflow6.bat"
81 changes: 81 additions & 0 deletions .github/actions/test-par/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Test parallel MF6
description: Build and test parallel MODFLOW 6
runs:
using: "composite"
steps:

- name: Setup GNU Fortran
uses: fortran-lang/setup-fortran@v1
with:
compiler: gcc
version: 13

- name: Checkout PETSc
uses: actions/checkout@v4
with:
repository: petsc/petsc
path: petsc
ref: release

- name: Configure environment
if: runner.os == 'Linux'
shell: bash
run: |
echo "PKG_CONFIG_PATH=$GITHUB_WORKSPACE/petsc/linux-gnu/lib/pkgconfig" >> $GITHUB_ENV
echo "$GITHUB_WORKSPACE/petsc/linux-gnu/bin" >> $GITHUB_PATH
- name: Configure environment
if: runner.os == 'macOS'
shell: bash
run: |
echo "PKG_CONFIG_PATH=$GITHUB_WORKSPACE/petsc/arch-darwin-gcc-debug/lib/pkgconfig" >> $GITHUB_ENV
echo "$GITHUB_WORKSPACE/petsc/arch-darwin-gcc-debug/bin" >> $GITHUB_PATH
- name: Configure PETSc
if: runner.os == 'Linux'
shell: bash
working-directory: petsc
run: |
sudo ./configure PETSC_ARCH=linux-gnu --download-fblaslapack --download-openmpi
sudo make all
- name: Configure PETSc
if: runner.os == 'macOS'
shell: bash
working-directory: petsc
run: |
sudo ./configure PETSC_DIR="$GITHUB_WORKSPACE/petsc" PETSC_ARCH=arch-darwin-gcc-debug --download-fblaslapack --download-openmpi
sudo make all
- name: Build modflow6
shell: bash -l {0}
working-directory: modflow6
run: |
meson setup builddir -Ddebug=false -Dparallel=true --prefix=$(pwd) --libdir=bin
meson install -C builddir
meson test --verbose --no-rebuild -C builddir
- name: Show Meson logs
if: failure()
shell: bash
working-directory: modflow6
run: cat builddir/meson-logs/meson-log.txt

- name: Update flopy
shell: bash -l {0}
working-directory: modflow6/autotest
run: python update_flopy.py

- name: Get executables
shell: bash -l {0}
working-directory: modflow6/autotest
env:
GITHUB_TOKEN: ${{ github.token }}
run: pytest -v --durations 0 get_exes.py

- name: Test programs
shell: bash -l {0}
working-directory: modflow6/autotest
env:
REPOS_PATH: ${{ github.workspace }}
run: pytest -v -n auto --parallel --durations 0 -k "test_par" --keep-failed .failed
5 changes: 5 additions & 0 deletions .github/common/compile_modflow6.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
set FC=ifort
cd "%GITHUB_WORKSPACE%\modflow6"
micromamba run -r "C:\Users\runneradmin\micromamba" -n modflow6 meson setup builddir -Ddebug=false -Dparallel=true --prefix=%CD% --libdir=bin
micromamba run -r "C:\Users\runneradmin\micromamba" -n modflow6 meson install -C builddir
micromamba run -r "C:\Users\runneradmin\micromamba" -n modflow6 meson test --verbose --no-rebuild -C builddir
3 changes: 3 additions & 0 deletions .github/common/compile_petsc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cd "$GITHUB_WORKSPACE/petsc"
make all
make check
12 changes: 12 additions & 0 deletions .github/common/configure_petsc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cd "$GITHUB_WORKSPACE/petsc"
./configure \
--with-debugging=0 \
--with-shared-libraries=1 \
--with-cc='cl' \
--with-fc='ifort' \
--with-cxx='cl' \
--with-blaslapack-lib='-L/cygdrive/c/PROGRA~2/Intel/oneAPI/mkl/latest/lib mkl_intel_lp64_dll.lib mkl_sequential_dll.lib mkl_core_dll.lib' \
--with-mpi-include='/cygdrive/c/PROGRA~2/Intel/oneAPI/mpi/latest/include' \
--with-mpi-lib='/cygdrive/c/PROGRA~2/Intel/oneAPI/mpi/latest/lib/impi.lib' \
--with-mpiexec='/cygdrive/c/PROGRA~2/Intel/oneAPI/mpi/latest/bin/mpiexec -localonly' \
--with-python-exec='/usr/bin/PYTHON~1.EXE'
8 changes: 8 additions & 0 deletions .github/common/install_intel_windows.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@echo off

:: download and unpack installer
curl.exe --output %TEMP%\webimage.exe --url %1 --retry 5 --retry-delay 5
start /b /wait %TEMP%\webimage.exe -s -x -f %TEMP%\webimage_extracted --log %TEMP%\extract.log

:: run installer
%TEMP%\webimage_extracted\bootstrapper.exe -s --action install --components=%2 --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=1 --log-dir=%TEMP%
3 changes: 3 additions & 0 deletions .github/common/test_modflow6.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cd "%GITHUB_WORKSPACE%\modflow6\autotest"
ldd ..\bin\mf6
micromamba run -r "C:\Users\runneradmin\micromamba" -n modflow6 pytest -v -n auto --parallel -k "test_par" --durations 0 --keep-failed .failed
Loading

0 comments on commit c99aa8b

Please sign in to comment.