Skip to content

Commit

Permalink
add windows extended build and test
Browse files Browse the repository at this point in the history
  • Loading branch information
mjreno authored and mjreno committed Oct 19, 2024
1 parent 3dea793 commit dfc4743
Show file tree
Hide file tree
Showing 10 changed files with 212 additions and 36 deletions.
23 changes: 23 additions & 0 deletions .github/actions/build-extended-win/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build Extended MF6 (Windows)
description: Build Extended MODFLOW 6 on Windows
runs:
using: "composite"
steps:

- name: Setup PETSc
uses: ./modflow6/.github/actions/build-petsc-win

- name: Setup NetCDF
uses: ./modflow6/.github/actions/build-netcdf-win

- name: Build modflow6
shell: cmd
run: |
unix2dos -n "%GITHUB_WORKSPACE%\modflow6\.github\common\compile_modflow6_extended.bat" "%TEMP%\compile_modflow6_extended.bat"
"%ONEAPI_ROOT%\setvars.bat" intel64 vs2022 && "%TEMP%\compile_modflow6_extended.bat"
- name: Show Meson logs
if: failure()
shell: bash
working-directory: modflow6
run: cat builddir/meson-logs/meson-log.txt
4 changes: 1 addition & 3 deletions .github/actions/build-netcdf-mf6/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ runs:
- name: Build modflow6
shell: cmd
run: |
echo "%PKG_CONFIG_PATH%"
echo "%PATH%"
unix2dos -n "%GITHUB_WORKSPACE%\modflow6\.github\common\compile_modflow6_netcdf.bat" "%TEMP%\compile_modflow6_netcdf.bat"
"%ONEAPI_ROOT%\setvars.bat" intel64 ninja && "%TEMP%\compile_modflow6_netcdf.bat"
"%ONEAPI_ROOT%\setvars.bat" intel64 vs2022 && "%TEMP%\compile_modflow6_netcdf.bat"
- name: Show Meson logs
if: failure()
Expand Down
23 changes: 4 additions & 19 deletions .github/actions/build-netcdf-win/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,7 @@ runs:
run: |
unix2dos -n "%GITHUB_WORKSPACE%\modflow6\.github\common\compile_netcdf.bat" "%TEMP%\compile_netcdf.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: Get specific version CMake, 3.28.0-msvc1
- name: Install latest cmake and ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: latest
Expand All @@ -37,8 +24,7 @@ runs:
- name: Download NetCDF-C
shell: bash
run: |
mkdir netcdf
mkdir netcdf/netCDF4.9.2-NC4-64
mkdir -p netcdf/netCDF4.9.2-NC4-64
cd netcdf/netCDF4.9.2-NC4-64
curl https://downloads.unidata.ucar.edu/netcdf-c/4.9.2/netCDF4.9.2-NC4-64.exe -O -J
7z x netCDF4.9.2-NC4-64.exe -aou
Expand All @@ -47,11 +33,10 @@ runs:
shell: bash
run: |
cd netcdf
mkdir netcdf-fortran-4.6.1_build
cd netcdf-fortran-4.6.1_build
mkdir -p netcdf-fortran-4.6.1/build
cd netcdf-fortran-4.6.1
curl https://downloads.unidata.ucar.edu/netcdf-fortran/4.6.1/netcdf-fortran-4.6.1.zip -O -J
unzip netcdf-fortran-4.6.1.zip
mkdir build
- name: Build NetCDF
shell: cmd
Expand Down
117 changes: 117 additions & 0 deletions .github/actions/test-extended-win/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Test extended MF6 (Windows)
description: Build and test extended MODFLOW 6 on Windows
runs:
using: "composite"
steps:

- name: Build MF6 parallel
uses: ./modflow6/.github/actions/build-extended-win

- name: Update flopy
working-directory: modflow6
shell: cmd
run: pixi run update-flopy

- name: Get executables
working-directory: modflow6/autotest
shell: cmd
env:
GITHUB_TOKEN: ${{ github.token }}
run: pixi run get-exes

- name: Convert unix2dos
shell: cmd
run: |
unix2dos -n "%GITHUB_WORKSPACE%\modflow6\.github\common\test_modflow6_parallel.bat" "%TEMP%\test_modflow6_parallel.bat"
unix2dos -n "%GITHUB_WORKSPACE%\modflow6\.github\common\test_modflow6_serial.bat" "%TEMP%\test_modflow6_serial.bat"
unix2dos -n "%GITHUB_WORKSPACE%\modflow6\.github\common\test_modflow6_netcdf.bat" "%TEMP%\test_modflow6_netcdf.bat"
- name: Test programs (parallel)
if: github.ref_name != 'master'
shell: cmd
env:
REPOS_PATH: ${{ github.workspace }}
run: |
"%ONEAPI_ROOT%\setvars.bat" intel64 vs2022 && "%TEMP%\test_modflow6_parallel.bat"
- name: Test programs (parallel)
if: github.ref_name == 'master'
shell: cmd
env:
REPOS_PATH: ${{ github.workspace }}
MARKERS: not developmode
run: |
"%ONEAPI_ROOT%\setvars.bat" intel64 vs2022 && "%TEMP%\test_modflow6_parallel.bat"
- name: Test programs (netcdf)
if: github.ref_name != 'master'
shell: cmd
env:
REPOS_PATH: ${{ github.workspace }}
run: |
"%ONEAPI_ROOT%\setvars.bat" intel64 vs2022 && "%TEMP%\test_modflow6_netcdf.bat"
- name: Test programs (netcdf)
if: github.ref_name == 'master'
shell: cmd
env:
REPOS_PATH: ${{ github.workspace }}
MARKERS: not developmode
run: |
"%ONEAPI_ROOT%\setvars.bat" intel64 vs2022 && "%TEMP%\test_modflow6_netcdf.bat"
- name: Test programs (serial)
if: github.ref_name != 'master'
shell: cmd
env:
REPOS_PATH: ${{ github.workspace }}
run: |
"%ONEAPI_ROOT%\setvars.bat" intel64 vs2022 && "%TEMP%\test_modflow6_serial.bat"
- name: Test programs (serial)
if: github.ref_name == 'master'
shell: cmd
env:
REPOS_PATH: ${{ github.workspace }}
MARKERS: not developmode
run: |
"%ONEAPI_ROOT%\setvars.bat" intel64 vs2022 && "%TEMP%\test_modflow6_serial.bat"
- name: Copy deps to bin dir
working-directory: modflow6/bin
shell: cmd
run: |
:: copy dependencies
copy "C:\Windows\System32\ucrtbase.dll" .
copy "C:\Windows\System32\msvcrt.dll" .
copy "C:\Windows\System32\msvcp_win.dll" .
copy "C:\Windows\SYSTEM32\MSVCP140.dll" .
copy "C:\Windows\SYSTEM32\VCRUNTIME140.dll" .
copy "C:\Windows\SYSTEM32\VCRUNTIME140_1.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\compiler\latest\bin\libifcoremd.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\compiler\latest\bin\libmmd.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mkl\latest\bin\mkl_sequential.2.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mkl\latest\bin\mkl_core.2.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mkl\latest\bin\mkl_def.2.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mkl\latest\bin\mkl_avx2.2.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mkl\latest\bin\mkl_avx512.2.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mkl\latest\bin\mkl_mc3.2.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mpi\latest\bin\impi.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mpi\latest\opt\mpi\libfabric\bin\libfabric.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mpi\latest\bin\mpiexec.exe" .
copy "C:\Program Files (x86)\Intel\oneAPI\mpi\latest\bin\hydra_bstrap_proxy.exe" .
copy "C:\Program Files (x86)\Intel\oneAPI\mpi\latest\bin\hydra_pmi_proxy.exe" .
copy "C:\Program Files (x86)\Intel\oneAPI\mpi\latest\bin\hydra_service.exe" .
copy "%GITHUB_WORKSPACE%\petsc\arch-mswin-c-opt\lib\libpetsc.dll" .
copy "%GITHUB_WORKSPACE%\netcdf\netCDF4.9.2-NC4-64\bin\hdf5.dll" .
copy "%GITHUB_WORKSPACE%\netcdf\netCDF4.9.2-NC4-64\bin\hdf5_hl.dll" .
copy "%GITHUB_WORKSPACE%\netcdf\netCDF4.9.2-NC4-64\bin\libcurl.dll" .
copy "%GITHUB_WORKSPACE%\netcdf\netCDF4.9.2-NC4-64\bin\netcdf.dll" .
copy "%GITHUB_WORKSPACE%\netcdf\netCDF4.9.2-NC4-64\bin\zlib1.dll" .
copy "%GITHUB_WORKSPACE%\netcdf\netcdf-fortran-4.6.1\build\fortran\netcdff.dll" .
- name: Upload binaries
uses: actions/upload-artifact@v3
with:
name: bin-ext
path: modflow6/bin
42 changes: 40 additions & 2 deletions .github/actions/test-netcdf-win/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ runs:
env:
REPOS_PATH: ${{ github.workspace }}
run: |
"%ONEAPI_ROOT%\setvars.bat" intel64 ninja && "%TEMP%\test_modflow6_netcdf.bat"
"%ONEAPI_ROOT%\setvars.bat" intel64 vs2022 && "%TEMP%\test_modflow6_netcdf.bat"
- name: Test programs
if: github.ref_name == 'master'
Expand All @@ -42,4 +42,42 @@ runs:
REPOS_PATH: ${{ github.workspace }}
MARKERS: not developmode
run: |
"%ONEAPI_ROOT%\setvars.bat" intel64 ninja && "%TEMP%\test_modflow6_netcdf.bat"
"%ONEAPI_ROOT%\setvars.bat" intel64 vs2022 && "%TEMP%\test_modflow6_netcdf.bat"
- name: Copy deps to bin dir
working-directory: modflow6/bin
shell: cmd
run: |
:: copy dependencies
copy "C:\Windows\System32\ucrtbase.dll" .
copy "C:\Windows\System32\msvcrt.dll" .
copy "C:\Windows\System32\msvcp_win.dll" .
copy "C:\Windows\SYSTEM32\MSVCP140.dll" .
copy "C:\Windows\SYSTEM32\VCRUNTIME140.dll" .
copy "C:\Windows\SYSTEM32\VCRUNTIME140_1.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\compiler\latest\bin\libifcoremd.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\compiler\latest\bin\libmmd.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mkl\latest\bin\mkl_sequential.2.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mkl\latest\bin\mkl_core.2.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mkl\latest\bin\mkl_def.2.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mkl\latest\bin\mkl_avx2.2.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mkl\latest\bin\mkl_avx512.2.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mkl\latest\bin\mkl_mc3.2.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mpi\latest\bin\impi.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mpi\latest\opt\mpi\libfabric\bin\libfabric.dll" .
copy "C:\Program Files (x86)\Intel\oneAPI\mpi\latest\bin\mpiexec.exe" .
copy "C:\Program Files (x86)\Intel\oneAPI\mpi\latest\bin\hydra_bstrap_proxy.exe" .
copy "C:\Program Files (x86)\Intel\oneAPI\mpi\latest\bin\hydra_pmi_proxy.exe" .
copy "C:\Program Files (x86)\Intel\oneAPI\mpi\latest\bin\hydra_service.exe" .
copy "%GITHUB_WORKSPACE%\netcdf\netCDF4.9.2-NC4-64\bin\hdf5.dll" .
copy "%GITHUB_WORKSPACE%\netcdf\netCDF4.9.2-NC4-64\bin\hdf5_hl.dll" .
copy "%GITHUB_WORKSPACE%\netcdf\netCDF4.9.2-NC4-64\bin\libcurl.dll" .
copy "%GITHUB_WORKSPACE%\netcdf\netCDF4.9.2-NC4-64\bin\netcdf.dll" .
copy "%GITHUB_WORKSPACE%\netcdf\netCDF4.9.2-NC4-64\bin\zlib1.dll" .
copy "%GITHUB_WORKSPACE%\netcdf\netcdf-fortran-4.6.1\build\fortran\netcdff.dll" .
- name: Upload binaries
uses: actions/upload-artifact@v3
with:
name: bin-netcdf
path: modflow6/bin
5 changes: 5 additions & 0 deletions .github/common/compile_modflow6_extended.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
set FC=ifort
cd "%GITHUB_WORKSPACE%\modflow6"
pixi run setup -Dextended=true builddir
pixi run build builddir
pixi run test builddir
10 changes: 5 additions & 5 deletions .github/common/compile_netcdf.bat
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
cd "%GITHUB_WORKSPACE%\netcdf\netcdf-fortran-4.6.1_build\build"
cd "%GITHUB_WORKSPACE%\netcdf\netcdf-fortran-4.6.1\build"

:: BUILD/INSTALL STATIC LIBS
cmake --fresh -G Ninja -DCMAKE_Fortran_COMPILER="C:/Program Files (x86)/Intel/oneAPI/compiler/latest/bin/ifort.exe" -DNETCDF_C_LIBRARY="%GITHUB_WORKSPACE%/netcdf/netCDF4.9.2-NC4-64/lib/netcdf.lib" -DNETCDF_C_INCLUDE_DIR="%GITHUB_WORKSPACE%/netcdf/netCDF4.9.2-NC4-64/include" -DBUILD_SHARED_LIBS=0 -DCMAKE_INSTALL_PREFIX="%GITHUB_WORKSPACE%/netcdf/netcdf-fortran-4.6.1_build/build" ../netcdf-fortran-4.6.1
:: build/install static libs
cmake --fresh -G Ninja -DCMAKE_Fortran_COMPILER="C:/Program Files (x86)/Intel/oneAPI/compiler/latest/bin/ifort.exe" -DNETCDF_C_LIBRARY="%GITHUB_WORKSPACE%/netcdf/netCDF4.9.2-NC4-64/lib/netcdf.lib" -DNETCDF_C_INCLUDE_DIR="%GITHUB_WORKSPACE%/netcdf/netCDF4.9.2-NC4-64/include" -DBUILD_SHARED_LIBS=0 -DCMAKE_INSTALL_PREFIX="%GITHUB_WORKSPACE%/netcdf/netcdf-fortran-4.6.1/build" ../netcdf-fortran-4.6.1
cmake --build .
cmake –install .

:: BUILD/INSTALL SHARED LIBS
cmake --fresh -G Ninja -DCMAKE_Fortran_COMPILER="C:/Program Files (x86)/Intel/oneAPI/compiler/latest/bin/ifort.exe" -DNETCDF_C_LIBRARY="%GITHUB_WORKSPACE%/netcdf/netCDF4.9.2-NC4-64/lib/netcdf.lib" -DNETCDF_C_INCLUDE_DIR="%GITHUB_WORKSPACE%/netcdf/netCDF4.9.2-NC4-64/include" -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX="%GITHUB_WORKSPACE%/netcdf/netcdf-fortran-4.6.1_build/build" ../netcdf-fortran-4.6.1
:: build/install shared libs
cmake --fresh -G Ninja -DCMAKE_Fortran_COMPILER="C:/Program Files (x86)/Intel/oneAPI/compiler/latest/bin/ifort.exe" -DNETCDF_C_LIBRARY="%GITHUB_WORKSPACE%/netcdf/netCDF4.9.2-NC4-64/lib/netcdf.lib" -DNETCDF_C_INCLUDE_DIR="%GITHUB_WORKSPACE%/netcdf/netCDF4.9.2-NC4-64/include" -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX="%GITHUB_WORKSPACE%/netcdf/netcdf-fortran-4.6.1/build" ../netcdf-fortran-4.6.1
cmake --build .
cmake –install .
11 changes: 8 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ jobs:
path: modflow6/autotest/.failed

netcdf_test:
name: NetCDF executable testing
name: NetCDF testing
needs:
- lint
- build
Expand Down Expand Up @@ -615,7 +615,7 @@ jobs:
path: modflow6/autotest/.failed

extended_test:
name: Extended executable testing
name: Extended testing
needs:
- lint
- build
Expand All @@ -624,7 +624,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04, macos-13 ]
os: [ ubuntu-22.04, macos-13, windows-2022 ]
defaults:
run:
shell: bash
Expand Down Expand Up @@ -660,8 +660,13 @@ jobs:
fi
- name: Test extended MF6
if: runner.os != 'Windows'
uses: ./modflow6/.github/actions/test-extended

- name: Test extended MF6
if: runner.os == 'Windows'
uses: ./modflow6/.github/actions/test-extended-win

- name: Upload failed test output
if: failure()
uses: actions/upload-artifact@v4
Expand Down
11 changes: 8 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,8 @@ petsc_compiled_abs = petsc_dir_abs / petsc_arch
# windows options for netcdf
netcdf_dir_rel = '..' /'netcdf'
netcdf_dir_abs = meson.project_source_root() / '..' / 'netcdf'
message('NetCDF dir abs: ', netcdf_dir_abs)
netcdfc_build = 'netCDF4.9.2-NC4-64'
netcdff_build = 'netcdf-fortran-4.6.1_build' / 'build'
netcdff_build = 'netcdf-fortran-4.6.1' / 'build'
netcdfc_compiled_rel = netcdf_dir_rel / netcdfc_build
netcdfc_compiled_abs = netcdf_dir_abs / netcdfc_build
netcdff_compiled_rel = netcdf_dir_rel / netcdff_build
Expand All @@ -156,6 +155,7 @@ endif
# lists for parallel dependencies and compiler arguments
dependencies = [ ]
extra_cmp_args = [ ]
extended_incdir = [ ]

# load petsc, mpi, and netcdf dependencies/libraries
if is_parallel_build or is_extended_build
Expand Down Expand Up @@ -198,8 +198,12 @@ if is_netcdf_build
netcdfc_compiled_rel / 'include',
netcdff_compiled_rel / 'fortran'
])
extended_incdir += [
'..' / netcdfc_compiled_rel / 'include',
'..' / netcdff_compiled_rel / 'fortran'
]
netcdff_libdir = netcdff_compiled_abs / 'fortran'
lnetcdff = fc.find_library('netcdff', dirs: netcdff_libdir, required : true)
lnetcdff = fc.find_library('netcdff', dirs: netcdff_libdir, static: false, required : true)
dependencies += [ lnetcdff ]
endif
endif
Expand Down Expand Up @@ -231,6 +235,7 @@ add_project_link_arguments(fc.get_supported_arguments(link_args), language: 'for
if is_parallel_build and build_machine.system() == 'windows'
message('Compiling PETSc Fortran modules')
petsc_incdir = include_directories([petsc_dir_rel / 'include', petsc_compiled_rel / 'include'])
extended_incdir += ['..' / petsc_dir_rel / 'include', '..' / petsc_compiled_rel / 'include']
petsc_src = petsc_dir_abs / 'src'
sources_petsc = [petsc_src / 'dm/f90-mod/petscdmdamod.F90',
petsc_src / 'dm/f90-mod/petscdmmod.F90',
Expand Down
2 changes: 1 addition & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ message('MODFLOW 6 executable name: ' + buildname)

if build_machine.system() == 'windows' and (with_petsc or with_netcdf)
if is_extended_build
incdir = petsc_incdir + netcdf_incdir
incdir = include_directories(extended_incdir)
elif with_petsc
incdir = petsc_incdir
elif with_netcdf
Expand Down

0 comments on commit dfc4743

Please sign in to comment.