Skip to content

Commit

Permalink
t1
Browse files Browse the repository at this point in the history
  • Loading branch information
mjreno authored and mjreno committed Oct 8, 2024
1 parent de9b543 commit 80e4268
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 43 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: MODFLOW 6 continuous integration
on:
push:
branches:
- netcdf_ciwin_test
paths-ignore:
- '**.md'
- '**.pdf'
Expand Down Expand Up @@ -545,6 +547,53 @@ jobs:
name: failed-${{ matrix.os }}
path: modflow6/autotest/.failed

netcdf_test:
name: NetCDF executable testing
needs:
- lint
- build
- smoke_test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04, macos-12, windows-2022 ]
defaults:
run:
shell: bash

steps:

- name: Checkout MF6
uses: actions/checkout@v4
with:
path: modflow6

- name: Setup pixi
uses: prefix-dev/[email protected]
with:
pixi-version: v0.24.2
manifest-path: "modflow6/pixi.toml"

- name: Custom pixi install
working-directory: modflow6
run: pixi run install

- name: Install additional netcdf testing packages
working-directory: modflow6
run: pixi run pip install xugrid xarray netcdf4

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

- name: Upload failed test output
if: failure()
uses: actions/upload-artifact@v4
with:
name: failed-${{ matrix.os }}
path: modflow6/autotest/.failed

extended_test:
name: Extended executable testing
needs:
Expand Down
5 changes: 1 addition & 4 deletions autotest/test_netcdf_gwe_cnd.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
# Imports

import os
import subprocess

import numpy as np
import pytest
Expand Down Expand Up @@ -61,9 +60,7 @@ def check_output(idx, test, export, gridded_input):
# re-run the simulation with model netcdf input
input_fname = f"{name}.nc"
nc_fname = f"{name}.{export}.nc"
subprocess.run(
["mv", test.workspace / input_fname, test.workspace / nc_fname]
)
os.rename(test.workspace / input_fname, test.workspace / nc_fname)

with open(test.workspace / f"{name}.nam", "w") as f:
f.write("BEGIN options\n")
Expand Down
5 changes: 1 addition & 4 deletions autotest/test_netcdf_gwf_disv.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"""

import os
import subprocess

import flopy
import numpy as np
Expand Down Expand Up @@ -79,9 +78,7 @@ def check_output(idx, test, export, gridded_input):
# re-run the simulation with model netcdf input
input_fname = f"{name}.nc"
nc_fname = f"{name}.{export}.nc"
subprocess.run(
["mv", test.workspace / input_fname, test.workspace / nc_fname]
)
os.rename(test.workspace / input_fname, test.workspace / nc_fname)

with open(test.workspace / f"{name}.nam", "w") as f:
f.write("BEGIN options\n")
Expand Down
5 changes: 1 addition & 4 deletions autotest/test_netcdf_gwf_sto01.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""

import os
import subprocess

import flopy
import numpy as np
Expand Down Expand Up @@ -72,9 +71,7 @@ def check_output(idx, test, export, gridded_input):
# re-run the simulation with model netcdf input
input_fname = "gwf_sto01.nc"
nc_fname = f"gwf_sto01.{export}.nc"
subprocess.run(
["mv", test.workspace / input_fname, test.workspace / nc_fname]
)
os.rename(test.workspace / input_fname, test.workspace / nc_fname)

with open(test.workspace / "gwf_sto01.nam", "w") as f:
f.write("BEGIN options\n")
Expand Down
5 changes: 1 addition & 4 deletions autotest/test_netcdf_gwt_dsp01.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""

import os
import subprocess

import flopy
import numpy as np
Expand Down Expand Up @@ -62,9 +61,7 @@ def check_output(idx, test, export, gridded_input):
# re-run the simulation with model netcdf input
input_fname = f"{gwtname}.nc"
nc_fname = f"{gwtname}.{export}.nc"
subprocess.run(
["mv", test.workspace / input_fname, test.workspace / nc_fname]
)
os.rename(test.workspace / input_fname, test.workspace / nc_fname)

with open(test.workspace / f"{gwtname}.nam", "w") as f:
f.write("BEGIN options\n")
Expand Down
5 changes: 1 addition & 4 deletions autotest/test_netcdf_gwt_prudic2004t2.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""

import os
import subprocess

import flopy
import numpy as np
Expand Down Expand Up @@ -51,9 +50,7 @@ def check_output(idx, test, export, gridded_input):
# re-run the simulation with model netcdf input
input_fname = f"{gwtname}.nc"
nc_fname = f"{gwtname}.{export}.nc"
subprocess.run(
["mv", test.workspace / input_fname, test.workspace / nc_fname]
)
os.rename(test.workspace / input_fname, test.workspace / nc_fname)

with open(test.workspace / f"{gwtname}.nam", "w") as f:
f.write("BEGIN options\n")
Expand Down
39 changes: 24 additions & 15 deletions meson.build
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ elif fc_id == 'intel-llvm-cl'
endif

# parallel build options
is_netcdf_build = get_option('netcdf')
is_extended_build = get_option('extended')
is_parallel_build = get_option('parallel') or is_extended_build
is_cray = get_option('cray')
Expand All @@ -123,6 +124,8 @@ if is_extended_build
message('Extended build:', is_extended_build)
elif is_parallel_build
message('Parallel build:', is_parallel_build)
elif is_netcdf_build
message('Netcdf build:', is_netcdf_build)
endif

# windows options for petsc
Expand All @@ -132,8 +135,18 @@ petsc_arch = 'arch-mswin-c-opt'
petsc_compiled_rel = petsc_dir_rel / petsc_arch
petsc_compiled_abs = petsc_dir_abs / petsc_arch

# windows options for netcdf
#netcdf_dir_rel = '..' /'netcdf'
netcdf_dir_abs = meson.project_source_root() / '..' /'netcdf'
netcdfc_build = 'netCDF4.9.2-NC4-64'
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
netcdff_compiled_abs = netcdf_dir_abs / netcdff_build

# on windows only with intel
if build_machine.system() == 'windows' and is_extended_build
if build_machine.system() == 'windows' and (is_extended_build or is_netcdf_build)
if fc_id != 'intel-cl'
error('Parallel build on Windows only with intel compiler. Terminating...')
endif
Expand Down Expand Up @@ -171,25 +184,21 @@ else
with_mpi = false
endif

if is_extended_build
# find netcdf
if build_machine.system() != 'windows'
netcdff = dependency('netcdf', language : 'fortran', required : false)
else
# For CI testing only; Windows not yet supported
nc_dir = meson.project_source_root() / '..' / 'ncf' / 'netcdf-fortran-4.6.1' / 'fortran'
netcdff = fc.find_library('netcdff', dirs: [ nc_dir ], required : false, static : false)
#nc_incdir = include_directories([ nc_dir ])
endif
# find netcdf
with_netcdf = false
if is_netcdf_build or is_extended_build
netcdff = dependency('netcdf', language : 'fortran', required : true)
if netcdff.found()
with_netcdf = true
extra_cmp_args += [ '-D__WITH_NETCDF__' ]
dependencies += [ netcdff ]
else
with_netcdf = false
if build_machine.system() == 'windows'
netcdf_incdir = include_directories([
netcdfc_compiled_abs / 'include',
netcdff_compiled_abs / 'fortran' / 'Release'
])
endif
endif
else
with_netcdf = false
endif

# GCC profile options need to be netcdf aware due to HDF5 issue
Expand Down
1 change: 1 addition & 0 deletions meson.options
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
option('extended', type : 'boolean', value : false, description : 'Extended build with external libraries')
option('parallel', type : 'boolean', value : false, description : 'Extended parallel build')
option('netcdf', type : 'boolean', value : false, description : 'Extended NetCDF build')
option('mpich', type : 'boolean', value : false, description : 'Use MPICH version of MPI')
option('cray', type : 'boolean', value : false, description : 'Extended build on CRAY with MPICH')
option('buildname', type : 'string', value : 'mf6', description : 'Optional build name')
24 changes: 16 additions & 8 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -467,16 +467,24 @@ mf6_external = static_library('mf6_external', external_libraries)

message('MODFLOW 6 executable name: ' + buildname)

if build_machine.system() == 'windows' and with_petsc
mf6core = static_library('mf6core',
modflow_sources,
dependencies: dependencies,
link_with: [mf6_external],
include_directories: petsc_incdir)
if build_machine.system() == 'windows' and
(is_extended_build or with_petsc or with_netcdf)
if is_extended_build
incdir = petsc_incdir + netcdf_incdir
elif with_petsc
incdir = petsc_incdir
elif with_netcdf
incdir = netcdf_incdir
endif
mf6core = static_library('mf6core',
modflow_sources,
dependencies: dependencies,
link_with: [mf6_external],
include_directories: incdir)
mf6exe = executable(buildname,
'mf6.f90',
'mf6.f90',
link_with: [mf6core],
dependencies: dependencies,
dependencies: dependencies,
install: true)
else
mf6core = static_library('mf6core',
Expand Down

0 comments on commit 80e4268

Please sign in to comment.