From 80e426895602b560b7888f5f1ab0dcb9b3f1a8dc Mon Sep 17 00:00:00 2001 From: mjreno Date: Tue, 8 Oct 2024 14:44:28 -0400 Subject: [PATCH] t1 --- .github/workflows/ci.yml | 49 ++++++++++++++++++++++++ autotest/test_netcdf_gwe_cnd.py | 5 +-- autotest/test_netcdf_gwf_disv.py | 5 +-- autotest/test_netcdf_gwf_sto01.py | 5 +-- autotest/test_netcdf_gwt_dsp01.py | 5 +-- autotest/test_netcdf_gwt_prudic2004t2.py | 5 +-- meson.build | 39 +++++++++++-------- meson.options | 1 + src/meson.build | 24 ++++++++---- 9 files changed, 95 insertions(+), 43 deletions(-) mode change 100644 => 100755 autotest/test_netcdf_gwe_cnd.py mode change 100644 => 100755 autotest/test_netcdf_gwf_disv.py mode change 100644 => 100755 autotest/test_netcdf_gwf_sto01.py mode change 100644 => 100755 autotest/test_netcdf_gwt_dsp01.py mode change 100644 => 100755 autotest/test_netcdf_gwt_prudic2004t2.py mode change 100644 => 100755 meson.build mode change 100644 => 100755 meson.options diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 012b22c1f4d..0941f2f2de5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,8 @@ name: MODFLOW 6 continuous integration on: push: + branches: + - netcdf_ciwin_test paths-ignore: - '**.md' - '**.pdf' @@ -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/setup-pixi@v0.8.1 + 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: diff --git a/autotest/test_netcdf_gwe_cnd.py b/autotest/test_netcdf_gwe_cnd.py old mode 100644 new mode 100755 index 4bb2f950396..c6b35a3914c --- a/autotest/test_netcdf_gwe_cnd.py +++ b/autotest/test_netcdf_gwe_cnd.py @@ -7,7 +7,6 @@ # Imports import os -import subprocess import numpy as np import pytest @@ -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") diff --git a/autotest/test_netcdf_gwf_disv.py b/autotest/test_netcdf_gwf_disv.py old mode 100644 new mode 100755 index bbbc5ee7989..e66ba24064a --- a/autotest/test_netcdf_gwf_disv.py +++ b/autotest/test_netcdf_gwf_disv.py @@ -5,7 +5,6 @@ """ import os -import subprocess import flopy import numpy as np @@ -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") diff --git a/autotest/test_netcdf_gwf_sto01.py b/autotest/test_netcdf_gwf_sto01.py old mode 100644 new mode 100755 index 8de196a3eef..57440046548 --- a/autotest/test_netcdf_gwf_sto01.py +++ b/autotest/test_netcdf_gwf_sto01.py @@ -3,7 +3,6 @@ """ import os -import subprocess import flopy import numpy as np @@ -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") diff --git a/autotest/test_netcdf_gwt_dsp01.py b/autotest/test_netcdf_gwt_dsp01.py old mode 100644 new mode 100755 index c1ef491d637..ce1a2938675 --- a/autotest/test_netcdf_gwt_dsp01.py +++ b/autotest/test_netcdf_gwt_dsp01.py @@ -3,7 +3,6 @@ """ import os -import subprocess import flopy import numpy as np @@ -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") diff --git a/autotest/test_netcdf_gwt_prudic2004t2.py b/autotest/test_netcdf_gwt_prudic2004t2.py old mode 100644 new mode 100755 index fc9cfee8450..83a4adafce1 --- a/autotest/test_netcdf_gwt_prudic2004t2.py +++ b/autotest/test_netcdf_gwt_prudic2004t2.py @@ -3,7 +3,6 @@ """ import os -import subprocess import flopy import numpy as np @@ -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") diff --git a/meson.build b/meson.build old mode 100644 new mode 100755 index a78ffe06a59..3fc05fc5775 --- a/meson.build +++ b/meson.build @@ -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') @@ -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 @@ -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 @@ -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 diff --git a/meson.options b/meson.options old mode 100644 new mode 100755 index 72fba261951..922aa96213d --- a/meson.options +++ b/meson.options @@ -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') diff --git a/src/meson.build b/src/meson.build index 90e47691f2f..2cf0d5ea42a 100644 --- a/src/meson.build +++ b/src/meson.build @@ -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',