Skip to content

Commit 6592d2b

Browse files
authored
Merge pull request #191 from jtwhite79/feat_partial
Feat partial
2 parents f9f8a06 + 0cb1d75 commit 6592d2b

17 files changed

Lines changed: 9439 additions & 9316 deletions

File tree

.github/workflows/ci.yml

Lines changed: 72 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
pestppCI:
1111
name: benchmarks
12-
runs-on: ubuntu-latest #${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
1313
strategy:
1414
fail-fast: false
1515
matrix:
@@ -34,11 +34,14 @@ jobs:
3434
- { test_dir: "pestpp-ies_benchmarks", test_repo: "https://github.com/pestpp/pestpp-ies_benchmarks", test_script: "ies_test_part4.py"}
3535
- { test_dir: "pestpp-glm_benchmarks", test_repo: "https://github.com/pestpp/pestpp-glm_benchmarks", test_script: "glm_test_base.py"}
3636
- { test_dir: "pestpp-mou_benchmarks", test_repo: "https://github.com/pestpp/pestpp-mou_benchmarks", test_script: "mou_tests.py"}
37-
- { test_dir: "pestpp-mou_benchmarks", test_repo: "https://github.com/pestpp/pestpp-mou_benchmarks", test_script: "mou_tests_2.py"}
37+
#- { test_dir: "pestpp-mou_benchmarks", test_repo: "https://github.com/pestpp/pestpp-mou_benchmarks", test_script: "mou_tests_2.py"}
3838
- { test_dir: "pestpp-mou_benchmarks", test_repo: "https://github.com/pestpp/pestpp-mou_benchmarks", test_script: "henry_test.py"}
3939
- { test_dir: "pestpp-da_benchmarks", test_repo: "https://github.com/pestpp/pestpp-da_benchmarks", test_script: "da_tests.py"}
4040
- { test_dir: "pestpp-da_benchmarks", test_repo: "https://github.com/pestpp/pestpp-da_benchmarks", test_script: "lorenz96_tests.py"}
4141
- { test_dir: "pestpp-sqp_benchmarks", test_repo: "https://github.com/pestpp/pestpp-sqp_benchmarks", test_script: "sqp_tests.py"}
42+
include:
43+
- os: ubuntu-latest
44+
env: { test_dir: "pestpp-mou_benchmarks", test_repo: "https://github.com/pestpp/pestpp-mou_benchmarks", test_script: "mou_tests_2.py"}
4245
env: ${{ matrix.env }}
4346

4447
steps:
@@ -61,49 +64,53 @@ jobs:
6164
if: runner.os == 'Windows'
6265
uses: ilammy/msvc-dev-cmd@v1
6366

64-
# - name: Get specific version CMake, v3.19
65-
# if: ${{ runner.os == 'Windows' }}
66-
# uses: lukka/get-cmake@latest
67-
68-
- name: clone test repo ${{ env.test_repo }}
69-
shell: bash -l {0}
70-
run: |
71-
git clone ${{ env.test_repo }}
72-
73-
- name: PESTPP exe install
74-
shell: bash -l {0}
75-
run: |
76-
mkdir build && cd build
77-
if [[ "$RUNNER_OS" == "Windows" ]]; then
78-
cmake -GNinja -DCMAKE_CXX_COMPILER=cl -DCMAKE_C_COMPILER=cl -DCMAKE_BUILD_TYPE=Release ..
79-
ninja
80-
else
81-
cmake -DCMAKE_BUILD_TYPE=Release ..
82-
make -j2
83-
fi
84-
cd ..
67+
8568

86-
8769
# Standard python fails on windows without GDAL installation
8870
# Using custom bash shell ("shell: bash -l {0}") with Miniconda
8971
- name: Setup Miniconda
90-
uses: conda-incubator/setup-miniconda@v2.0.0
72+
uses: conda-incubator/setup-miniconda@v2
9173
with:
74+
# python-version: ${{ matrix.python-version }}
75+
# #mamba-version: "0.20.0"
76+
# channels: conda-forge
77+
# auto-update-conda: true
78+
# activate-environment: pyemu
79+
# use-only-tar-bz2: true
80+
miniforge-version: latest
81+
# miniconda-version: "latest"
9282
python-version: ${{ matrix.python-version }}
93-
mamba-version: "0.20.0"
94-
channels: conda-forge
95-
auto-update-conda: true
83+
# mamba-version: "*"
84+
# channels: conda-forge
85+
miniforge-variant: Mambaforge
86+
# auto-update-conda: true
9687
activate-environment: pyemu
97-
use-only-tar-bz2: true
88+
use-mamba: true
89+
# environment-file: etc/environment.yml
90+
# use-only-tar-bz2: true
91+
92+
# - name: Add packages to pyemu environment using mamba or conda
93+
# shell: bash -l {0}
94+
# run: |
95+
# if [ "$RUNNER_OS" == "Windows" ]; then
96+
# conda env update --name pyemu --file etc/environment.yml
97+
# else
98+
# conda env update --name pyemu --file etc/environment.yml
99+
# fi
98100

99-
- name: Add packages to pyemu environment using mamba or conda
101+
- name: Add packages to pyemu environment using conda
102+
if: ${{ matrix.python-version < 3.8 }}
103+
# if: ${{ runner.os == 'Windows' || matrix.python-version < 3.8 }}
100104
shell: bash -l {0}
101105
run: |
102-
if [ "$RUNNER_OS" == "Windows" ]; then
103-
conda env update --name pyemu --file etc/environment.yml
104-
else
105106
conda env update --name pyemu --file etc/environment.yml
106-
fi
107+
108+
- name: Add packages to pyemu environment using mamba
109+
# if: ${{ runner.os != 'Windows' && matrix.python-version >= 3.8 }}
110+
if: ${{ matrix.python-version >= 3.8 }}
111+
shell: bash -l {0}
112+
run: |
113+
mamba env update --name pyemu --file etc/environment.yml
107114
108115
- name: Install Flopy & pyemu?
109116
shell: bash -l {0}
@@ -117,24 +124,53 @@ jobs:
117124
cd pyemu
118125
python setup.py install
119126
cd ..
127+
128+
# - name: Get specific version CMake, v3.19
129+
# if: ${{ runner.os == 'Windows' }}
130+
# uses: lukka/get-cmake@latest
131+
132+
- name: clone test repo ${{ env.test_repo }}
133+
shell: bash -l {0}
134+
run: |
135+
git clone ${{ env.test_repo }}
136+
137+
- name: PESTPP exe install
138+
shell: bash -l {0}
139+
run: |
140+
mkdir build && cd build
141+
if [[ "$RUNNER_OS" == "Windows" ]]; then
142+
cmake -GNinja -DCMAKE_CXX_COMPILER=cl -DCMAKE_C_COMPILER=cl -DCMAKE_BUILD_TYPE=Release ..
143+
ninja
144+
else
145+
cmake -DCMAKE_BUILD_TYPE=Release ..
146+
make -j2
147+
fi
148+
cd ..
149+
120150
121151
- name: aux bin path hackery
122152
shell: bash -l {0}
123153
run: |
154+
cp -r benchmarks/test_bin/win $HOME/bin
155+
echo "../../test_bin/win" >> $GITHUB_PATH
124156
if [[ "$RUNNER_OS" == "Windows" ]]; then
125-
echo "..\..\test_bin\win" >> $GITHUB_PATH
157+
cp -r benchmarks/test_bin/win $HOME/bin
158+
echo "../../test_bin/win" >> $GITHUB_PATH
126159
else
127160
echo "../../test_bin/linux" >> $GITHUB_PATH
161+
cp -r benchmarks/test_bin/win $HOME/bin
128162
fi
163+
echo "$HOME/.local/bin" >> $GITHUB_PATH
129164
130165
- name: run test script ${{ env.test_script }} in ${{ env.test_dir }}
131166
shell: bash -l {0}
132167
run: |
168+
133169
ls -l
134170
cd ${{ env.test_dir }}
135171
nosetests -v ${{ env.test_script }}
136172
cd
137-
173+
138174

139175

140176

benchmarks/basic_tests.py

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,10 @@ def tplins1_test():
733733
jco = pyemu.Jco.from_binary(os.path.join(t_d,"pest.jcb")).to_dataframe().apply(np.abs)
734734
assert jco.sum().sum() == 0, jco.sum()
735735

736+
pst.control_data.noptmax = 0
737+
pst.write(os.path.join(t_d,"pest.pst"))
738+
pyemu.os_utils.run("{0} pest.pst".format(exe_path.replace("-ies","-glm")),cwd=t_d)
739+
736740
# check the input file - the last two number should be the same
737741
arr = np.loadtxt(os.path.join(t_d,"hk_Layer_1.ref"))
738742
assert arr[-2] == arr[-1],arr[-2] - arr[-1]
@@ -742,6 +746,7 @@ def tplins1_test():
742746
assert len(lines_tpl) - 1 == len(lines_in)
743747

744748
pst = pyemu.Pst(os.path.join(t_d,"pest.pst"))
749+
pst.control_data.noptmax = -1
745750
pst.pestpp_options["fill_tpl_zeros"] = True
746751
pst.write(os.path.join(t_d,"pest_fill.pst"))
747752
pyemu.os_utils.run("{0} pest_fill.pst".format(exe_path.replace("-ies","-glm")),cwd=t_d)
@@ -758,6 +763,10 @@ def tplins1_test():
758763
jco = pyemu.Jco.from_binary(os.path.join(t_d,"pest_fill.jcb")).to_dataframe().apply(np.abs)
759764
assert jco.sum().sum() == 0, jco.sum()
760765

766+
pst.control_data.noptmax = 0
767+
pst.write(os.path.join(t_d,"pest.pst"))
768+
pyemu.os_utils.run("{0} pest.pst".format(exe_path.replace("-ies","-glm")),cwd=t_d)
769+
761770
# check the input file - the last two number should be the same
762771
arr = np.loadtxt(os.path.join(t_d,"hk_Layer_1.ref"))
763772
assert arr[-2] == arr[-1]
@@ -773,6 +782,7 @@ def tplins1_test():
773782
pst.model_output_data = pd.DataFrame({"pest_file":"out1dum.dat.ins",
774783
"model_file":'out1.dat'},index=["out1dum.dat.ins"])
775784
#pst.instruction_files = ['out1dum.dat.ins']
785+
pst.control_data.noptmax = -1
776786
pst.write(os.path.join(t_d, "pest_dum.pst"))
777787
pyemu.os_utils.run("{0} pest_dum.pst".format(exe_path.replace("-ies", "-glm")), cwd=t_d)
778788
obf_df = pd.read_csv(os.path.join(t_d, "out1.dat.obf"), delim_whitespace=True, header=None,
@@ -872,6 +882,20 @@ def mf6_v5_ies_test():
872882
pyemu.os_utils.run("{0} freyberg6_run_ies.pst".format(exe_path),cwd=t_d)
873883

874884
pst.control_data.noptmax = 3
885+
886+
m_d = os.path.join(model_d, "master_ies_glm_noloc_standard")
887+
if os.path.exists(m_d):
888+
shutil.rmtree(m_d)
889+
pst = pyemu.Pst(os.path.join(t_d, "freyberg6_run_ies.pst"))
890+
pst.pestpp_options.pop("ies_localizer",None)
891+
pst.pestpp_options.pop("ies_autoadaloc",None)
892+
pst.pestpp_options["ies_bad_phi_sigma"] = 2.5
893+
pst.control_data.noptmax = 3
894+
pst.write(os.path.join(t_d, "freyberg6_run_ies_glm_noloc_standard.pst"))
895+
pyemu.os_utils.start_workers(t_d, exe_path, "freyberg6_run_ies_glm_noloc_standard.pst", num_workers=15,
896+
master_dir=m_d, worker_root=model_d, port=port)
897+
898+
return
875899
pst.write(os.path.join(t_d,"freyberg6_run_ies_glm_loc.pst"))
876900

877901
m_d = os.path.join(model_d, "master_ies_glm_covloc")
@@ -1106,7 +1130,7 @@ def fr_fail_test():
11061130
assert not os.path.exists(oe_file)
11071131
m_d = os.path.join(model_d,"fr_fail_master")
11081132
try:
1109-
pyemu.os_utils.start_workers(new_d,exe_path,"pest.pst",num_workers=1,worker_root=model_d,master_dir=m_d)
1133+
pyemu.os_utils.start_workers(new_d,exe_path,"pest.pst",num_workers=5,worker_root=model_d,master_dir=m_d)
11101134
except:
11111135
pass
11121136
else:
@@ -1175,29 +1199,29 @@ def fr_timeout_test():
11751199
f.write("import os\nimport time\nimport pyemu\npyemu.os_utils.run('mfnwt 10par_xsec.nam')\n")
11761200
f.write("if not os.path.exists('run.info'):\n exit()\n")
11771201
f.write("lines = open('run.info','r').readlines()\nrnum = int(lines[-1].split()[-1].split('=')[-1])\n")
1178-
f.write("if rnum % 2 == 0:\n time.sleep(100000)\n")
1202+
f.write("if rnum % 2 == 0:\n time.sleep(10000000)\n")
11791203
pst.model_command = "python run.py"
11801204
oe_file = os.path.join(new_d, "pest.0.obs.csv")
11811205
if os.path.exists(oe_file):
11821206
os.remove(oe_file)
11831207
pst.control_data.noptmax = -1
11841208
pst.pestpp_options["overdue_giveup_fac"] = 1.0e+10
1185-
pst.pestpp_options["overdue_giveup_minutes"] = 0.1
1209+
pst.pestpp_options["overdue_giveup_minutes"] = 0.25
11861210
pst.pestpp_options["ies_num_reals"] = 10
1211+
pst.pestpp_options["ies_include_base"] = False
1212+
pst.pestpp_options["max_run_fail"] = 1
11871213

11881214
#pst.pestpp_options["panther_transfer_on_fail"] = "10par_xsec.list"
1189-
pst.pestpp_options["panther_agent_freeze_on_fail"] = True
1215+
pst.pestpp_options["panther_agent_freeze_on_fail"] = False
11901216
pst.write(os.path.join(new_d, "pest.pst"))
1191-
pyemu.os_utils.run("{0} pest.pst".format(exe_path),cwd=new_d)
11921217

1193-
assert os.path.exists(oe_file)
11941218
m_d = os.path.join(model_d,"fr_timeout_master")
1195-
pyemu.os_utils.start_workers(new_d,exe_path,"pest.pst",num_workers=1,worker_root=model_d,master_dir=m_d)
1219+
pyemu.os_utils.start_workers(new_d,exe_path,"pest.pst",num_workers=5,worker_root=model_d,master_dir=m_d)
11961220
oe_file = os.path.join(m_d, "pest.0.obs.csv")
11971221
assert os.path.exists(oe_file)
11981222
oe = pd.read_csv(oe_file,index_col=0)
11991223
print(oe.shape)
1200-
assert oe.shape[0] == 4
1224+
assert oe.shape[0] == 5,oe.shape
12011225

12021226
def ins_missing_e_test():
12031227
import os
@@ -1248,7 +1272,7 @@ def ins_missing_e_test():
12481272
#salib_verf()
12491273
#tplins1_test()
12501274
#secondary_marker_test()
1251-
ext_stdcol_test()
1275+
#ext_stdcol_test()
12521276

12531277
# parallel_consist_test()
12541278
# ext_stdcol_test()
@@ -1261,17 +1285,20 @@ def ins_missing_e_test():
12611285

12621286
#da_prep_4_mf6_freyberg_seq_tbl()
12631287
#da_mf6_freyberg_test_2()
1264-
#shutil.copy2(os.path.join("..","exe","windows","x64","Debug","pestpp-ies.exe"),os.path.join("..","bin","win","pestpp-ies.exe"))
1288+
shutil.copy2(os.path.join("..","exe","windows","x64","Debug","pestpp-ies.exe"),os.path.join("..","bin","win","pestpp-ies.exe"))
12651289
#tplins1_test()
12661290
#mf6_v5_ies_test()
12671291
#mf6_v5_sen_test()
12681292

1293+
1294+
12691295
#shutil.copy2(os.path.join("..","exe","windows","x64","Debug","pestpp-opt.exe"),os.path.join("..","bin","win","pestpp-opt.exe"))
12701296
#mf6_v5_opt_stack_test()
12711297
#mf6_v5_glm_test()
12721298
#mf6_v5_ies_test()
12731299
#cmdline_test()
12741300
#basic_sqp_test()
12751301
#mf6_v5_ies_test()
1276-
#fr_timeout_test()
1302+
fr_timeout_test()
12771303
#fr_fail_test()
1304+
#tplins1_test()

0 commit comments

Comments
 (0)