From f27933cdbe37a983d6715dcb8104b380fffa9038 Mon Sep 17 00:00:00 2001 From: Matteo Cusini Date: Mon, 11 Sep 2023 17:08:07 -0700 Subject: [PATCH] Performancecheck seems to work. Added 1 test. --- .../geos_ats/helpers/performance_check.py | 21 +++++++++--------- .../geos_ats_package/geos_ats/test_steps.py | 4 +--- .../extracted_performance_data.h5 | Bin 0 -> 7848 bytes 3 files changed, 11 insertions(+), 14 deletions(-) create mode 100644 tests/allTests/embeddedFractures/baselines/Sneddon_embeddedFrac_benchmark_01/extracted_performance_data.h5 diff --git a/scripts/geos_ats_package/geos_ats/helpers/performance_check.py b/scripts/geos_ats_package/geos_ats/helpers/performance_check.py index 5a0a3bf6e..120cad846 100644 --- a/scripts/geos_ats_package/geos_ats/helpers/performance_check.py +++ b/scripts/geos_ats_package/geos_ats/helpers/performance_check.py @@ -61,7 +61,7 @@ def parse_log_file( fname ): config_iter_data['NewtonIters'][newton_iter] = num_iterations # Create an HDF5 file for storing the data - output_fileName = 'extracted_performance_data.h5' + output_fileName = os.path.join(os.path.dirname(fname), 'extracted_performance_data.h5') with h5py.File(output_fileName, 'w') as hdf5_file: for cycle, cycle_data in data.items(): cycle_group = hdf5_file.create_group(f'Cycle_{cycle}') @@ -84,7 +84,7 @@ def parse_log_file( fname ): return output_fileName, errors -def load_data(fname, errors): +def load_data(fname): """ Args: fname (str): @@ -97,14 +97,12 @@ def load_data(fname, errors): if os.path.isfile(fname): data = hdf5_wrapper.hdf5_wrapper(fname).get_copy() else: - errors.append(f'File {fname} not found.') - - return data, errors + raise Exception(f'file {fname} not found. If baselines do not exist you may simply need to rebaseline this case.') + return data # def plot_performance_curves(): # """ # """ - def compare_performance_curves( fname, baseline, tolerances, output ): """ @@ -125,8 +123,8 @@ def compare_performance_curves( fname, baseline, tolerances, output ): newton_iterations_tolerance, linear_iterations_tolerance = tolerances # Load data - target_data, errors = load_data(fname, errors) - baseline_data, errors = load_data(baseline, errors) + target_data = load_data( fname ) + baseline_data = load_data( baseline ) # Check if the number of cycles is the same target_cycles = set(target_data.keys()) @@ -177,11 +175,12 @@ def performance_check_parser(): parser = argparse.ArgumentParser() parser.add_argument("filename", help="Path to the log file") parser.add_argument("baseline", help="Path to the baseline file") - parser.add_argument("-t", "--tolerance", - help="The tolerances for nonlinear and linear iterations", - default=[0.1, 0.2]) + nargs='+', + action='append', + help=f"The tolerance for nonlinear and linear iterations", + default=[]) parser.add_argument("-o", "--output", help="Output figures to this directory", diff --git a/scripts/geos_ats_package/geos_ats/test_steps.py b/scripts/geos_ats_package/geos_ats/test_steps.py index 1aaf71d32..ab4fca823 100644 --- a/scripts/geos_ats_package/geos_ats/test_steps.py +++ b/scripts/geos_ats_package/geos_ats/test_steps.py @@ -814,9 +814,7 @@ def makeArgs(self): if self.p.tolerance is not None: for t in self.p.tolerance.split(','): args += ["-t", t] - if self.p.warnings_are_errors: - args += ["-w"] - + args += ['-o', self.figure_root] args += [self.target_file, self.baseline_file] return list(map(str, args)) diff --git a/tests/allTests/embeddedFractures/baselines/Sneddon_embeddedFrac_benchmark_01/extracted_performance_data.h5 b/tests/allTests/embeddedFractures/baselines/Sneddon_embeddedFrac_benchmark_01/extracted_performance_data.h5 new file mode 100644 index 0000000000000000000000000000000000000000..8c2e85e1e6901e17cb1357118c4593cacb301e47 GIT binary patch literal 7848 zcmeHKJx{_=6n!lcD+ZO#?>I8z<_G~yO$-usU=yNMNwg4bqHd13F*-W(6Z{GO1V=|l zM>p;3y~miB6arBR^p%AB-tFz}yQk-!_TJlt?POv(A>?6MVoEFoL;QX6(OoAG<~U#F zfx))TwrkSB5b`I)BKuREUyVE5FBXL#iTtp9nRt!U$bv)LNFiVsb7fg@g{uZjpP6R> zBY%5*;T&ZG&Pkt*6GPfC{@O80c+R}+$KSUZir4%d@qj9^*aLS)v;v?uq9wD_Ci?tRdp0!3>BYNXZS89KZ?fi8_z@eX#T`_yRy0kPQHg z`!ne`O-f{O=NvOSsUSe<&xN=n_lW=1_siD&h!-@bw+Bz=c>U^pOv}>C)(B_>Gy)m{ zjetg=2LfUJrTV?yufMFW(M@!J*#qneJ{8tqeklFgZ}*q~-xocORbNzIonX@aVQF7U C#k7