From 84c1492ce696cb53b07ff6d33d561dcf8ac3a3d0 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Mon, 7 Oct 2024 12:01:59 -0500 Subject: [PATCH] fix issues with invalid subfolders, with total walltime reference that may be zero, with the output of progress.yaml for easy parsing to dictionaries, modify config_kokkos.yaml for testing with the OpenMP backend --- tools/regression-tests/config_kokkos.yaml | 5 +-- tools/regression-tests/run_tests.py | 39 +++++++++++++++-------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/tools/regression-tests/config_kokkos.yaml b/tools/regression-tests/config_kokkos.yaml index 8c94e04071..dba203605d 100644 --- a/tools/regression-tests/config_kokkos.yaml +++ b/tools/regression-tests/config_kokkos.yaml @@ -1,7 +1,7 @@ --- lmp_binary: "" - nprocs: "4" - args: "-cite none -k on g 1 -sf kk -pk kokkos newton on neigh half" + nprocs: "2" + args: "-cite none -k on t 2 -sf kk -pk kokkos newton on neigh half" mpiexec: "mpirun" mpiexec_numproc_flag: "-np" tolerance: @@ -29,5 +29,6 @@ abs: 1e-2 rel: 1e-4 + timeout: 180 nugget: 1.0 epsilon: 1e-16 diff --git a/tools/regression-tests/run_tests.py b/tools/regression-tests/run_tests.py index 32b89bd27c..dae6b2f22f 100755 --- a/tools/regression-tests/run_tests.py +++ b/tools/regression-tests/run_tests.py @@ -187,7 +187,7 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file msg = " + " + input + f" ({test_id+1}/{num_tests}): skipped as specified in {configFileName}" print(msg) logger.info(msg) - progress.write(f"{input}: {{ folder: {input_folder}, status: \"skipped\", walltime: {walltime} }}\n") + progress.write(f"{{ '{input}': {{ 'folder': '{input_folder}', 'status': 'skipped', 'walltime': '{walltime}' }} }}\n") progress.close() num_skipped = num_skipped + 1 test_id = test_id + 1 @@ -205,7 +205,7 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file msg = " + " + input + f" ({test_id+1}/{num_tests}): skipped as specified in {configFileName}" print(msg) logger.info(msg) - progress.write(f"{input}: {{ folder: {input_folder}, status: \"skipped\", walltime: {walltime} }}\n") + progress.write(f"{{ '{input}': {{ 'folder': {input_folder}, 'status': 'skipped', 'walltime': '{walltime}' }} }}\n") progress.close() num_skipped = num_skipped + 1 test_id = test_id + 1 @@ -352,7 +352,7 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file results.append(result) print(f"{result.status}") - msg = f"{input}: {{ folder: {input_folder}, status: \"{result.status}\", walltime: {walltime} }}\n" + msg = f"{{ '{input}': {{ 'folder': '{input_folder}', 'status': '{result.status}', 'walltime': '{walltime}' }} }}\n" progress.write(msg) progress.close() failure.write(msg) @@ -369,7 +369,7 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file logger.info(f" {output}") logger.info(f" Error:\n{error}") - msg = f"{input}: {{ folder: {input_folder}, status: \"failed, no log file generated\", walltime: {walltime} }}\n" + msg = f"{{ '{input}': {{ 'folder': '{input_folder}', 'status': 'failed, no log file generated', 'walltime': '{walltime}' }} }}\n" progress.write(msg) progress.close() failure.write(msg) @@ -399,7 +399,7 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file result.status = msg results.append(result) - msg = f"{input}: {{ folder: {input_folder}, status: \"{msg}\", walltime: {walltime} }}\n" + msg = f"{{ '{input}': {{ 'folder': '{input_folder}', status: \"{msg}\", 'walltime': '{walltime}' }} }}\n" progress.write(msg) progress.close() failure.write(msg) @@ -418,7 +418,7 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file logger.info(f"\n Output:\n{output}") logger.info(f"\n Error:\n{error}") - msg = f"{input}: {{ folder: {input_folder}, status: \"failed, no Total wall time in the output, {error}\", walltime: {walltime} }}\n" + msg = f"{{ '{input}': {{ 'folder': '{input_folder}', 'status': 'failed, no Total wall time in the output, {error}', 'walltime': '{walltime}' }} }}\n" progress.write(msg) progress.close() failure.write(msg) @@ -449,7 +449,7 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file logger.info(f"\n Output:\n{output}") logger.info(f"\n Error:\n{error}") - msg = f"{input}: {{ folder: {input_folder}, status: \"completed, but no Step nor Loop in the output.\", walltime: {walltime}, walltime_norm: {walltime_norm} }}\n" + msg = f"{{ '{input}': {{ 'folder': '{input_folder}', 'status': 'completed, but no Step nor Loop in the output.', 'walltime': '{walltime}', 'walltime_norm': '{walltime_norm}' }} }}\n" progress.write(msg) progress.close() failure.write(msg) @@ -477,7 +477,7 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file result.status = msg + f", error parsing {logfilename} into YAML" results.append(result) - progress.write(f"{input}: {{ folder: {input_folder}, status: \"{result.status}\", walltime: {walltime}, walltime_norm: {walltime_norm} }}\n") + progress.write(f"{{ '{input}': {{ 'folder': '{input_folder}', 'status': '{result.status}', 'walltime': '{walltime}', 'walltime_norm': '{walltime_norm}' }} }}\n") progress.close() if verbose == True: @@ -499,7 +499,7 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file logger.info(f" failed, error parsing the reference log file {thermo_ref_file}.") result.status = "skipped numerical checks due to parsing the reference log file" results.append(result) - progress.write(f"{input}: {{ folder: {input_folder}, status: \"completed, numerical checks skipped, unsupported log file format\", walltime: {walltime}, walltime_norm: {walltime_norm} }}\n") + progress.write(f"{{ '{input}': {{ 'folder': '{input_folder}', 'status': 'completed, numerical checks skipped, unsupported log file format', 'walltime': '{walltime}', 'walltime_norm': '{walltime_norm}' }} }}\n") progress.close() num_completed = num_completed + 1 num_error = num_error + 1 @@ -521,7 +521,7 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file result.status = "skipped due to missing the reference log file" results.append(result) - msg = f"{input}: {{ folder: {input_folder}, status: \"completed, numerical checks skipped due to missing the reference log file\", walltime: {walltime}, walltime_norm: {walltime_norm} }}\n" + msg = f"{{ '{input}': {{ 'folder': '{input_folder}', 'status': 'completed, numerical checks skipped due to missing the reference log file', 'walltime': '{walltime}', 'walltime_norm': '{walltime_norm}' }} }}\n" progress.write(msg) progress.close() failure.write(msg) @@ -539,7 +539,7 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file " Check README in the folder, possibly due to using mpirun with partitions or parsing the wrong reference log file.") result.status = "failed, incomplete runs" results.append(result) - progress.write(f"{input}: {{ folder: {input_folder}, status: \"{result.status}\", walltime: {walltime}, walltime_norm: {walltime_norm} }}\n") + progress.write(f"{{ '{input}': {{ 'folder': '{input_folder}', 'status': '{result.status}', 'walltime': '{walltime}', 'walltime_norm': '{walltime_norm}' }} }}\n") progress.close() num_error = num_error + 1 test_id = test_id + 1 @@ -555,7 +555,7 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file logger.info(f" Check both log files for more details.") result.status = "failed, mismatched columns in the log files" results.append(result) - progress.write(f"{input}: {{ folder: {input_folder}, status: \"{result.status}\", walltime: {walltime}, walltime_norm: {walltime_norm} }}\n") + progress.write(f"{{ '{input}': {{ 'folder': '{input_folder}', 'status': '{result.status}', 'walltime': '{walltime}', 'walltime_norm': '{walltime_norm}' }} }}\n") progress.close() num_error = num_error + 1 test_id = test_id + 1 @@ -691,12 +691,12 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file msg += ", memory leaks detected" num_memleak = num_memleak + 1 - progress.write(f"{input}: {{ folder: {input_folder}, status: \"{msg}\", failed_checks: {{ {result.status} }}, walltime: {walltime}, walltime_norm: {walltime_norm} }}\n") + progress.write(f"{{ '{input}': {{ 'folder': '{input_folder}', 'status': '{msg}', 'failed_checks': {{ '{result.status}' }}, 'walltime': '{walltime}', 'walltime_norm': '{walltime_norm}' }} }}\n") progress.close() # write to failure if there is any numerical failed check if num_abs_failed > 0 or num_rel_failed > 0: - failure.write(f"{input}: {{ folder: {input_folder}, status: \"{msg}\", failed_checks: {{ {result.status} }}, walltime: {walltime}, walltime_norm: {walltime_norm} }}\n") + failure.write(f"{{ '{input}': {{ 'folder': '{input_folder}', 'status': '{msg}', 'failed_checks': '{{ '{result.status}' }}, 'walltime': '{walltime}', 'walltime_norm': '{walltime_norm}' }} }}\n") # count the number of completed runs num_completed = num_completed + 1 @@ -940,6 +940,14 @@ def get_reference_walltime(lmp_binary, config): minutes = float(hms[1]) seconds = float(hms[2]) walltime = hours * 3600.0 + minutes * 60.0 + seconds + if "Loop time" in line: + looptime_str = line.split(' ')[3] + seconds = float(looptime_str) + looptime = seconds + + # there is case where total walltime with in.lj is reported as zero seconds, then use loop time + if float(walltime) < float(config['epsilon']): + walltime = looptime logger.info(f" Reference walltime, sec = {walltime}") @@ -1456,6 +1464,9 @@ if __name__ == "__main__": for directory in example_subfolders: + if os.path.exists(directory) is False: + continue + # change to the directory where the input script and data files are located print("-"*80) print("Entering " + directory)