From 84c1492ce696cb53b07ff6d33d561dcf8ac3a3d0 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Mon, 7 Oct 2024 12:01:59 -0500 Subject: [PATCH 01/31] 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) From 31f10f96754449b9102255d7a87cf8494b259df5 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Mon, 7 Oct 2024 12:04:29 -0500 Subject: [PATCH 02/31] add a workflow file for testing KOKKOS with the OpenMP backend --- .github/workflows/kokkos-regression.yaml | 90 ++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 .github/workflows/kokkos-regression.yaml diff --git a/.github/workflows/kokkos-regression.yaml b/.github/workflows/kokkos-regression.yaml new file mode 100644 index 0000000000..661c646c2f --- /dev/null +++ b/.github/workflows/kokkos-regression.yaml @@ -0,0 +1,90 @@ +# GitHub action to build LAMMPS on Linux and run selected regression tests +name: "Kokkos Regression Test" + +on: + pull_request: + branches: + - develop + + workflow_dispatch: + +jobs: + build: + name: Build LAMMPS + # restrict to official LAMMPS repository + if: ${{ github.repository == 'lammps/lammps' }} + runs-on: ubuntu-latest + env: + CCACHE_DIR: ${{ github.workspace }}/.ccache + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + show-progress: false + + - name: Install extra packages + run: | + sudo apt-get update + sudo apt-get install -y ccache ninja-build libeigen3-dev \ + libcurl4-openssl-dev python3-dev \ + mpi-default-bin mpi-default-dev + + - name: Create Build Environment + run: mkdir build + + - name: Set up ccache + uses: actions/cache@v4 + with: + path: ${{ env.CCACHE_DIR }} + key: linux-quick-ccache-${{ github.sha }} + restore-keys: linux-quick-ccache- + + - name: Building LAMMPS via CMake + shell: bash + run: | + ccache -z + python3 -m venv linuxenv + source linuxenv/bin/activate + python3 -m pip install --upgrade pip + python3 -m pip install numpy pyyaml junit_xml + cmake -S cmake -B build \ + -C cmake/presets/gcc.cmake \ + -C cmake/presets/basic.cmake \ + -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -D CMAKE_C_COMPILER_LAUNCHER=ccache \ + -D BUILD_SHARED_LIBS=off \ + -D DOWNLOAD_POTENTIALS=off \ + -D PKG_KOKKOS=on \ + -D Kokkos_ARCH_ARMAVX=on \ + -D Kokkos_ENABLE_OPENMP=on \ + -D Kokkos_ENABLE_CUDA=off \ + -D PKG_COLLOID=on \ + -D PKG_GRANULAR=on \ + -D PKG_ML-SNAP=on \ + -D BUILD_OMP=yes \ + -G Ninja + cmake --build build + ccache -s + + - name: Run Regression Tests for Selected Examples + shell: bash + run: | + source linuxenv/bin/activate + python3 tools/regression-tests/run_tests.py \ + --lmp-bin=build/lmp \ + --config-file=tools/regression-tests/config_kokkos.yaml \ + --example-folders="examples/colloid;examples/melt;examples/micelle;examples/threebody;examples/snap;" + --output-file=output.xml \ + --progress-file=progress.yaml \ + --log-file=run.log + + tar -cvf kokkos-regression-test.tar run.log progress.yaml output.xml + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: kokkos-regression-test-artifact + path: kokkos-regression-test.tar + From 076bb056aa19aa4d6ee758dc6e5c03f0e9c20361 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Mon, 7 Oct 2024 12:59:48 -0500 Subject: [PATCH 03/31] fixed leftover typos in the workflow file and the tester --- .github/workflows/kokkos-regression.yaml | 2 +- tools/regression-tests/run_tests.py | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/kokkos-regression.yaml b/.github/workflows/kokkos-regression.yaml index 661c646c2f..7da35add60 100644 --- a/.github/workflows/kokkos-regression.yaml +++ b/.github/workflows/kokkos-regression.yaml @@ -75,7 +75,7 @@ jobs: python3 tools/regression-tests/run_tests.py \ --lmp-bin=build/lmp \ --config-file=tools/regression-tests/config_kokkos.yaml \ - --example-folders="examples/colloid;examples/melt;examples/micelle;examples/threebody;examples/snap;" + --example-folders="examples/colloid;examples/melt;examples/micelle;examples/threebody;examples/snap" \ --output-file=output.xml \ --progress-file=progress.yaml \ --log-file=run.log diff --git a/tools/regression-tests/run_tests.py b/tools/regression-tests/run_tests.py index dae6b2f22f..a73eceb975 100755 --- a/tools/regression-tests/run_tests.py +++ b/tools/regression-tests/run_tests.py @@ -656,7 +656,6 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file msg = f" {num_abs_failed} abs diff checks failed." print(msg) logger.info(msg) - #result.status = f"abs_diff_failed: {num_abs_failed}, " if verbose == True: for out in failed_abs_output: print(f" - {out}") @@ -665,7 +664,6 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file msg = f" {num_rel_failed} rel diff checks failed." print(msg) logger.info(msg) - #result.status += f"rel_diff_failed: {num_rel_failed}" if verbose == True: for out in failed_rel_output: print(f" - {out}") @@ -674,12 +672,11 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file msg = f" all {num_checks} checks passed." print(msg) logger.info(msg) - #result.status = f"all {num_checks} checks passed." num_passed = num_passed + 1 else: num_error = num_error + 1 - result.status = f"abs_diff_failed: {num_abs_failed}, rel_diff_failed: {num_rel_failed}" + result.status = f" 'abs_diff_failed': '{num_abs_failed}', 'rel_diff_failed': '{num_rel_failed}' " results.append(result) # check if memleak detects from valgrind run (need to replace "mpirun" -> valgrind --leak-check=yes mpirun") @@ -691,12 +688,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 From 7b3762881e2cfe767c2e443eafc2602802f283d0 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Mon, 7 Oct 2024 13:14:35 -0500 Subject: [PATCH 04/31] try with 4 procs --- tools/regression-tests/config_kokkos.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/regression-tests/config_kokkos.yaml b/tools/regression-tests/config_kokkos.yaml index dba203605d..faf1fc1655 100644 --- a/tools/regression-tests/config_kokkos.yaml +++ b/tools/regression-tests/config_kokkos.yaml @@ -1,9 +1,9 @@ --- lmp_binary: "" - nprocs: "2" + nprocs: "4" args: "-cite none -k on t 2 -sf kk -pk kokkos newton on neigh half" mpiexec: "mpirun" - mpiexec_numproc_flag: "-np" + mpiexec_numproc_flag: "--host localhost:4 -np" tolerance: PotEng: abs: 1e-4 From 09a115cb89b0033201eeca938cac8cda2a039807 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Mon, 7 Oct 2024 15:04:28 -0500 Subject: [PATCH 05/31] add and switch to a workflow file dedicated for OpenMP backend for KOKKOS --- .github/workflows/kokkos-regression.yaml | 5 ++- tools/regression-tests/config_kokkos.yaml | 2 +- .../config_kokkos_openmp.yaml | 34 +++++++++++++++++++ tools/regression-tests/run_tests.py | 1 + 4 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 tools/regression-tests/config_kokkos_openmp.yaml diff --git a/.github/workflows/kokkos-regression.yaml b/.github/workflows/kokkos-regression.yaml index 7da35add60..9929759493 100644 --- a/.github/workflows/kokkos-regression.yaml +++ b/.github/workflows/kokkos-regression.yaml @@ -62,7 +62,6 @@ jobs: -D Kokkos_ENABLE_CUDA=off \ -D PKG_COLLOID=on \ -D PKG_GRANULAR=on \ - -D PKG_ML-SNAP=on \ -D BUILD_OMP=yes \ -G Ninja cmake --build build @@ -74,8 +73,8 @@ jobs: source linuxenv/bin/activate python3 tools/regression-tests/run_tests.py \ --lmp-bin=build/lmp \ - --config-file=tools/regression-tests/config_kokkos.yaml \ - --example-folders="examples/colloid;examples/melt;examples/micelle;examples/threebody;examples/snap" \ + --config-file=tools/regression-tests/config_kokkos_openmp.yaml \ + --example-folders="examples/colloid;examples/melt;examples/micelle;examples/threebody" \ --output-file=output.xml \ --progress-file=progress.yaml \ --log-file=run.log diff --git a/tools/regression-tests/config_kokkos.yaml b/tools/regression-tests/config_kokkos.yaml index faf1fc1655..88257da5fc 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 t 2 -sf kk -pk kokkos newton on neigh half" + args: "-cite none -k on g 2 -sf kk -pk kokkos newton on neigh half" mpiexec: "mpirun" mpiexec_numproc_flag: "--host localhost:4 -np" tolerance: diff --git a/tools/regression-tests/config_kokkos_openmp.yaml b/tools/regression-tests/config_kokkos_openmp.yaml new file mode 100644 index 0000000000..faf1fc1655 --- /dev/null +++ b/tools/regression-tests/config_kokkos_openmp.yaml @@ -0,0 +1,34 @@ +--- + lmp_binary: "" + nprocs: "4" + args: "-cite none -k on t 2 -sf kk -pk kokkos newton on neigh half" + mpiexec: "mpirun" + mpiexec_numproc_flag: "--host localhost:4 -np" + tolerance: + PotEng: + abs: 1e-4 + rel: 1e-7 + TotEng: + abs: 1e-4 + rel: 1e-7 + Press: + abs: 1e-4 + rel: 1e-7 + Temp: + abs: 1e-4 + rel: 1e-7 + E_vdwl: + abs: 1e-3 + rel: 1e-7 + overrides: + in.rigid.tnr: + Temp: + abs: 1e-3 + rel: 1e-5 + Press: + 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 a73eceb975..8e4f6b041c 100755 --- a/tools/regression-tests/run_tests.py +++ b/tools/regression-tests/run_tests.py @@ -929,6 +929,7 @@ def get_reference_walltime(lmp_binary, config): logger.info(msg) print(msg) + looptime = 1.0 for line in output.split('\n'): if "Total wall time" in line: walltime_str = line.split('time:')[1] From 900f472ea62ce313a42f9e932b3dbd88a0a32512 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Mon, 7 Oct 2024 16:39:26 -0500 Subject: [PATCH 06/31] test logic to run with different nprocs than the ref files if nprocs is specified --- tools/regression-tests/config_kokkos.yaml | 4 ++-- tools/regression-tests/config_kokkos_openmp.yaml | 4 ++-- tools/regression-tests/run_tests.py | 11 +++++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/tools/regression-tests/config_kokkos.yaml b/tools/regression-tests/config_kokkos.yaml index 88257da5fc..76a142d7d8 100644 --- a/tools/regression-tests/config_kokkos.yaml +++ b/tools/regression-tests/config_kokkos.yaml @@ -1,9 +1,9 @@ --- lmp_binary: "" - nprocs: "4" + nprocs: "2" args: "-cite none -k on g 2 -sf kk -pk kokkos newton on neigh half" mpiexec: "mpirun" - mpiexec_numproc_flag: "--host localhost:4 -np" + mpiexec_numproc_flag: "--host localhost:2 -np" tolerance: PotEng: abs: 1e-4 diff --git a/tools/regression-tests/config_kokkos_openmp.yaml b/tools/regression-tests/config_kokkos_openmp.yaml index faf1fc1655..c3061d2e68 100644 --- a/tools/regression-tests/config_kokkos_openmp.yaml +++ b/tools/regression-tests/config_kokkos_openmp.yaml @@ -1,9 +1,9 @@ --- lmp_binary: "" - nprocs: "4" + nprocs: "2" args: "-cite none -k on t 2 -sf kk -pk kokkos newton on neigh half" mpiexec: "mpirun" - mpiexec_numproc_flag: "--host localhost:4 -np" + mpiexec_numproc_flag: "--host localhost:2 -np" tolerance: PotEng: abs: 1e-4 diff --git a/tools/regression-tests/run_tests.py b/tools/regression-tests/run_tests.py index 8e4f6b041c..afb12b2845 100755 --- a/tools/regression-tests/run_tests.py +++ b/tools/regression-tests/run_tests.py @@ -300,12 +300,15 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file saved_nprocs = config['nprocs'] - # if the maximum number of procs is different from the value in the configuration file - # then override the setting for this particular input script - if max_np != int(config['nprocs']): + # if the nprocs value in the configuration file is empty then use max_np for this particular input script + if config['nprocs'] == "": config['nprocs'] = str(max_np) + else: + # otherwise use the nprocs value in the configuration file (4 for most examples) + logger.info(f" Using nprocs {config['nprocs']} nprocs for {input_test} as specified in the config file.") + logger.info(f" The maximum number of procs in the log files is {max_np}.") - # store the value of nprocs + # store the value of nprocs to name the generated log file nprocs = int(config['nprocs']) # if valgrind is used for mem check, the run command will be From 0e3a6a7190a28da4ea064261c7780cd62628a9da Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Tue, 8 Oct 2024 10:51:12 -0500 Subject: [PATCH 07/31] turned on verbose to check tolerances and also print that info out to the run.log file --- .github/workflows/kokkos-regression.yaml | 9 +++------ tools/regression-tests/run_tests.py | 20 ++++++++++++++------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/workflows/kokkos-regression.yaml b/.github/workflows/kokkos-regression.yaml index 9929759493..94e8c60c5d 100644 --- a/.github/workflows/kokkos-regression.yaml +++ b/.github/workflows/kokkos-regression.yaml @@ -75,15 +75,12 @@ jobs: --lmp-bin=build/lmp \ --config-file=tools/regression-tests/config_kokkos_openmp.yaml \ --example-folders="examples/colloid;examples/melt;examples/micelle;examples/threebody" \ - --output-file=output.xml \ - --progress-file=progress.yaml \ - --log-file=run.log - - tar -cvf kokkos-regression-test.tar run.log progress.yaml output.xml + --output-file=output_kokkos.xml --progress-file=progress_kokkos.yaml --log-file=run_kokkos.log \ + --verbose - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: kokkos-regression-test-artifact - path: kokkos-regression-test.tar + path: *_kokkos.* diff --git a/tools/regression-tests/run_tests.py b/tools/regression-tests/run_tests.py index afb12b2845..15fe0c01ca 100755 --- a/tools/regression-tests/run_tests.py +++ b/tools/regression-tests/run_tests.py @@ -659,6 +659,9 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file msg = f" {num_abs_failed} abs diff checks failed." print(msg) logger.info(msg) + for out in failed_abs_output: + logger.info(f" - {out}") + if verbose == True: for out in failed_abs_output: print(f" - {out}") @@ -667,6 +670,9 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file msg = f" {num_rel_failed} rel diff checks failed." print(msg) logger.info(msg) + for out in failed_rel_output: + logger.info(f" - {out}") + if verbose == True: for out in failed_rel_output: print(f" - {out}") @@ -675,11 +681,15 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file msg = f" all {num_checks} checks passed." print(msg) logger.info(msg) + + result.status = f" 'status': 'passed', 'abs_diff_failed': '{num_abs_failed}', 'rel_diff_failed': '{num_rel_failed}' " + num_passed = num_passed + 1 else: + result.status = f" 'status': 'failed', 'abs_diff_failed': '{num_abs_failed}', 'rel_diff_failed': '{num_rel_failed}' " num_error = num_error + 1 - result.status = f" 'abs_diff_failed': '{num_abs_failed}', 'rel_diff_failed': '{num_rel_failed}' " + results.append(result) # check if memleak detects from valgrind run (need to replace "mpirun" -> valgrind --leak-check=yes mpirun") @@ -1556,12 +1566,10 @@ if __name__ == "__main__": for result in all_results: #print(f"{result.name}: {result.status}") case = TestCase(name=result.name, classname=result.name) - if result.status == "failed": - case.add_failure_info(message="Actual values did not match expected ones.") - if result.status == "skipped": + if "passed" not in result.status: + case.add_failure_info(message=result.status) + if "skipped" in result.status: case.add_skipped_info(message="Test was skipped.") - if result.status == "error": - case.add_skipped_info(message="Test run had errors.") test_cases.append(case) current_timestamp = datetime.datetime.now() From 63649979e3f2ae494b4b881e30be59b7864c77af Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Tue, 8 Oct 2024 10:55:40 -0500 Subject: [PATCH 08/31] revert the file names and the upload action step --- .github/workflows/kokkos-regression.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/kokkos-regression.yaml b/.github/workflows/kokkos-regression.yaml index 94e8c60c5d..f47844f75a 100644 --- a/.github/workflows/kokkos-regression.yaml +++ b/.github/workflows/kokkos-regression.yaml @@ -75,12 +75,14 @@ jobs: --lmp-bin=build/lmp \ --config-file=tools/regression-tests/config_kokkos_openmp.yaml \ --example-folders="examples/colloid;examples/melt;examples/micelle;examples/threebody" \ - --output-file=output_kokkos.xml --progress-file=progress_kokkos.yaml --log-file=run_kokkos.log \ + --output-file=output.xml --progress-file=progress.yaml --log-file=run.log \ --verbose + tar -cvf kokkos-regression-test.tar run.log progress.yaml output.xml + - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: kokkos-regression-test-artifact - path: *_kokkos.* + path: kokkos-regression-test.tar From 63a26b177071ffc497640f0385ca0c2130c09e9b Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Tue, 8 Oct 2024 12:10:48 -0500 Subject: [PATCH 09/31] add the missing log file using --gen-ref --- .../threebody/log.08Oct24.mos2.sw.mod.g++.4 | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 examples/threebody/log.08Oct24.mos2.sw.mod.g++.4 diff --git a/examples/threebody/log.08Oct24.mos2.sw.mod.g++.4 b/examples/threebody/log.08Oct24.mos2.sw.mod.g++.4 new file mode 100644 index 0000000000..f0941f2532 --- /dev/null +++ b/examples/threebody/log.08Oct24.mos2.sw.mod.g++.4 @@ -0,0 +1,102 @@ +LAMMPS (29 Aug 2024 - Development - patch_29Aug2024-512-g13c57ab9b5) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +# monolayer MoS2 +units metal +boundary p p f +processors * * 1 + +atom_style atomic +read_data single_layer_MoS2.data +Reading data file ... + triclinic box = (0 0 -100) to (51.15232 44.299209 100) with tilt (25.57616 0 0) +WARNING: Triclinic box skew is large. LAMMPS will run inefficiently. (src/domain.cpp:221) + 2 by 2 by 1 MPI processor grid + reading atoms ... + 768 atoms + read_data CPU = 0.003 seconds + +mass * 32.065 # mass of sulphur atom , uint: a.u.=1.66X10^(-27)kg +mass 1 95.94 # mass of molebdenum atom , uint: a.u.=1.66X10^(-27)kg + +########################## Define potentials ################################ +pair_style sw/mod maxdelcs 0.25 0.35 +pair_coeff * * tmd.sw.mod Mo S S +Reading sw potential file tmd.sw.mod with DATE: 2018-03-26 +######################################################################### + +### Simulation settings #### +timestep 0.001 +velocity all create 300.0 12345 + +############################ + +# Output +thermo 500 +thermo_style custom step etotal pe ke temp +thermo_modify lost warn + +###### Run molecular dynamics ###### +fix thermostat all nve +run 5000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: +- Type Label Framework: https://doi.org/10.1021/acs.jpcb.3c08419 +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.158796 + ghost atom cutoff = 5.158796 + binsize = 2.579398, bins = 30 18 78 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair sw/mod, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.165 | 3.165 | 3.165 Mbytes + Step TotEng PotEng KinEng Temp + 0 -899.28605 -929.02881 29.742759 300 + 500 -899.28626 -922.45519 23.168929 233.69313 + 1000 -899.29247 -925.86547 26.573002 268.02828 + 1500 -899.27957 -916.95478 17.675214 178.28084 + 2000 -899.28171 -918.38728 19.105573 192.70814 + 2500 -899.28732 -922.50423 23.21691 234.17709 + 3000 -899.28195 -918.74112 19.459174 196.27473 + 3500 -899.27944 -918.03105 18.751604 189.13784 + 4000 -899.28397 -920.50737 21.223397 214.06955 + 4500 -899.28386 -919.79154 20.507685 206.85053 + 5000 -899.28077 -918.78947 19.508698 196.77425 +Loop time of 0.595509 on 4 procs for 5000 steps with 768 atoms + +Performance: 725.430 ns/day, 0.033 hours/ns, 8396.182 timesteps/s, 6.448 Matom-step/s +99.9% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.4603 | 0.49732 | 0.54269 | 4.2 | 83.51 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.03293 | 0.078347 | 0.11558 | 10.6 | 13.16 +Output | 0.00010079 | 0.00010935 | 0.00012827 | 0.0 | 0.02 +Modify | 0.0073413 | 0.0082665 | 0.0091767 | 0.7 | 1.39 +Other | | 0.01146 | | | 1.92 + +Nlocal: 192 ave 194 max 190 min +Histogram: 1 0 0 0 0 2 0 0 0 1 +Nghost: 194 ave 196 max 192 min +Histogram: 1 0 0 0 0 2 0 0 0 1 +Neighs: 0 ave 0 max 0 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 5120 ave 5170 max 5070 min +Histogram: 1 0 0 0 0 2 0 0 0 1 + +Total # of neighbors = 20480 +Ave neighs/atom = 26.666667 +Neighbor list builds = 0 +Dangerous builds = 0 +Total wall time: 0:00:00 From 8f76fcdc54b22cc26d5ce844cdbefa11d0cdd566 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Fri, 11 Oct 2024 14:18:43 -0500 Subject: [PATCH 10/31] Added a python script to get the example inputs that contain KOKKOS styles and generate the input lists for regression tests --- .github/workflows/kokkos-regression.yaml | 30 +++- .../config_kokkos_openmp.yaml | 16 +- tools/regression-tests/get_kokkos_input.py | 164 ++++++++++++++++++ 3 files changed, 192 insertions(+), 18 deletions(-) create mode 100644 tools/regression-tests/get_kokkos_input.py diff --git a/.github/workflows/kokkos-regression.yaml b/.github/workflows/kokkos-regression.yaml index f47844f75a..950c10b90f 100644 --- a/.github/workflows/kokkos-regression.yaml +++ b/.github/workflows/kokkos-regression.yaml @@ -10,13 +10,18 @@ on: jobs: build: - name: Build LAMMPS + name: Build LAMMPS with Kokkos OpenMP # restrict to official LAMMPS repository if: ${{ github.repository == 'lammps/lammps' }} runs-on: ubuntu-latest env: CCACHE_DIR: ${{ github.workspace }}/.ccache + strategy: + max-parallel: 4 + matrix: + style: [ 'pair', 'fix', 'compute', 'misc' ] + steps: - name: Checkout repository uses: actions/checkout@v4 @@ -71,18 +76,31 @@ jobs: shell: bash run: | source linuxenv/bin/activate + python3 tools/regression-tests/get_kokkos_input.py --examples-top-level=examples + python3 tools/regression-tests/run_tests.py \ --lmp-bin=build/lmp \ --config-file=tools/regression-tests/config_kokkos_openmp.yaml \ - --example-folders="examples/colloid;examples/melt;examples/micelle;examples/threebody" \ - --output-file=output.xml --progress-file=progress.yaml --log-file=run.log \ + --list-input=input-list-${{ matrix.style }}-kk.txt \ + --output-file=output-${{ matrix.style }}.xml \ + --progress-file=progress-${{ matrix.style }}.yaml --log-file=run-${{ matrix.style }}.log \ --verbose - tar -cvf kokkos-regression-test.tar run.log progress.yaml output.xml + tar -cvf kokkos-regression-test-${{ matrix.style }}.tar run-${{ matrix.style }}.log progress-${{ matrix.style }}.yaml output-${{ matrix.style }}.xml - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: kokkos-regression-test-artifact - path: kokkos-regression-test.tar + name: kokkos-regression-test-artifact-${{ matrix.style }} + path: kokkos-regression-test-${{ matrix.style }}.tar + + merge: + runs-on: ubuntu-latest + needs: build + steps: + - name: Merge Artifacts + uses: actions/upload-artifact/merge@v4 + with: + name: merged-kokkos-regresssion-artifact + pattern: kokkos-regression-test-artifact-* diff --git a/tools/regression-tests/config_kokkos_openmp.yaml b/tools/regression-tests/config_kokkos_openmp.yaml index c3061d2e68..217888c762 100644 --- a/tools/regression-tests/config_kokkos_openmp.yaml +++ b/tools/regression-tests/config_kokkos_openmp.yaml @@ -7,27 +7,19 @@ tolerance: PotEng: abs: 1e-4 - rel: 1e-7 + rel: 1e-6 TotEng: abs: 1e-4 - rel: 1e-7 + rel: 1e-6 Press: abs: 1e-4 - rel: 1e-7 + rel: 1e-6 Temp: abs: 1e-4 - rel: 1e-7 + rel: 1e-6 E_vdwl: abs: 1e-3 rel: 1e-7 - overrides: - in.rigid.tnr: - Temp: - abs: 1e-3 - rel: 1e-5 - Press: - abs: 1e-2 - rel: 1e-4 timeout: 180 nugget: 1.0 diff --git a/tools/regression-tests/get_kokkos_input.py b/tools/regression-tests/get_kokkos_input.py new file mode 100644 index 0000000000..3f004bbcba --- /dev/null +++ b/tools/regression-tests/get_kokkos_input.py @@ -0,0 +1,164 @@ +# This script looks for input scripts under examples/ that have pair/fix/compute styles with KOKKOS support +# and print out separate sets of input lists into 4 files: +# input-list-pair-kk.txt +# input-list-fix-kk.txt +# input-list-compute-kk.txt +# input-list-misc-kk.txt +# These 4 files will be read in by the regression tester run_tests.py + +from argparse import ArgumentParser +import subprocess +import sys + +if __name__ == "__main__": + parser = ArgumentParser() + parser.add_argument("--examples-top-level", dest="example_toplevel", default="", help="Examples top-level") + + args = parser.parse_args() + example_toplevel = args.example_toplevel + + with open("input-list-pair-kk.txt", "w") as f: + # find all the pair styles with the kokkos suffix + cmd_str = f"ls {example_toplevel}/../src/KOKKOS | grep -v npair | grep pair | grep .cpp" + p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) + kokkos_styles = p.stdout.split('\n') + style_names = [] + for style in kokkos_styles: + if style != "": + # replace "pair_[name]_kokkos.cpp" into "[name]" + style = style.replace("pair_","") + style = style.replace("_kokkos.cpp","") + style = style.replace("_","/") + style_names.append(style) + + for style in style_names: + cmd_str = f"grep -rl 'pair_style.*{style}' {example_toplevel}/*/in.* " + p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) + input_list = p.stdout.split('\n') + input_list = ' '.join(input_list).split() + #print(f"There are {len(input_list)} input files that contains pair {style}") + for input in input_list: + if input != "": + f.write(f"{input}\n") + + with open("input-list-fix-kk.txt", "w") as f: + + # find all the fix styles with the kokkos suffix + cmd_str = f"ls {example_toplevel}/../src/KOKKOS | grep fix | grep .cpp" + p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) + kokkos_styles = p.stdout.split('\n') + style_names = [] + for style in kokkos_styles: + if style != "": + # replace "fix_[name]_kokkos.cpp" into "[name]" + style = style.replace("fix_","") + style = style.replace("_kokkos.cpp","") + style = style.replace("_","/") + style_names.append(style) + + for style in style_names: + cmd_str = f"grep -rl 'fix.*{style}' {example_toplevel}/*/in.* " + p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) + input_list = p.stdout.split('\n') + input_list = ' '.join(input_list).split() + #print(f"There are {len(input_list)} input files that contains fix {style}") + for input in input_list: + if input != "": + f.write(f"{input}\n") + + with open("input-list-compute-kk.txt", "w") as f: + # find all the compute styles with the kokkos suffix + cmd_str = f"ls {example_toplevel}/../src/KOKKOS | grep compute | grep .cpp" + p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) + kokkos_styles = p.stdout.split('\n') + style_names = [] + for style in kokkos_styles: + if style != "": + # replace "compute_[name]_kokkos.cpp" into "[name]" + style = style.replace("compute_","") + style = style.replace("_kokkos.cpp","") + style = style.replace("_","/") + style_names.append(style) + + for style in style_names: + cmd_str = f"grep -rl 'compute.*{style}' {example_toplevel}/*/in.* " + p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) + input_list = p.stdout.split('\n') + input_list = ' '.join(input_list).split() + #print(f"There are {len(input_list)} input files that contains compute {style}") + for input in input_list: + if input != "": + f.write(f"{input}\n") + + + with open("input-list-misc-kk.txt", "w") as f: + + # find all the angle styles with the kokkos suffix + cmd_str = f"ls {example_toplevel}/../src/KOKKOS | grep angle | grep .cpp" + p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) + kokkos_styles = p.stdout.split('\n') + style_names = [] + for style in kokkos_styles: + if style != "": + # replace "compute_[name]_kokkos.cpp" into "[name]" + style = style.replace("angle_","") + style = style.replace("_kokkos.cpp","") + style = style.replace("_","/") + style_names.append(style) + + for style in style_names: + cmd_str = f"grep -rl 'angle_style.*{style}' {example_toplevel}/*/in.* " + p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) + input_list = p.stdout.split('\n') + input_list = ' '.join(input_list).split() + #print(f"There are {len(input_list)} input files that contains angle {style}") + for input in input_list: + if input != "": + f.write(f"{input}\n") + + + # find all the bond styles with the kokkos suffix + cmd_str = f"ls {example_toplevel}/../src/KOKKOS | grep bond | grep .cpp" + p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) + kokkos_styles = p.stdout.split('\n') + style_names = [] + for style in kokkos_styles: + if style != "": + # replace "compute_[name]_kokkos.cpp" into "[name]" + style = style.replace("bond_","") + style = style.replace("_kokkos.cpp","") + style = style.replace("_","/") + style_names.append(style) + + for style in style_names: + cmd_str = f"grep -rl 'bond_style.*{style}' {example_toplevel}/*/in.* " + p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) + input_list = p.stdout.split('\n') + input_list = ' '.join(input_list).split() + #print(f"There are {len(input_list)} input files that contains bond {style}") + for input in input_list: + if input != "": + f.write(f"{input}\n") + + # find all the min styles with the kokkos suffix + cmd_str = f"ls {example_toplevel}/../src/KOKKOS | grep min | grep .cpp" + p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) + kokkos_styles = p.stdout.split('\n') + style_names = [] + for style in kokkos_styles: + if style != "": + # replace "compute_[name]_kokkos.cpp" into "[name]" + style = style.replace("min_","") + style = style.replace("_kokkos.cpp","") + style = style.replace("_","/") + style_names.append(style) + + for style in style_names: + cmd_str = f"grep -rl 'min_style.*{style}' {example_toplevel}/*/in.* " + p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) + input_list = p.stdout.split('\n') + input_list = ' '.join(input_list).split() + #print(f"There are {len(input_list)} input files that contains min {style}") + for input in input_list: + if input != "": + f.write(f"{input}\n") From e9ff0d34023505a7458b7d1499a68fdb46c1f141 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Fri, 11 Oct 2024 14:42:45 -0500 Subject: [PATCH 11/31] modify the kokkos workflow file --- .github/workflows/kokkos-regression.yaml | 19 +++++++-------- tools/regression-tests/get_kokkos_input.py | 27 ++++++++++++++++++++++ 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/.github/workflows/kokkos-regression.yaml b/.github/workflows/kokkos-regression.yaml index 950c10b90f..57e5323b24 100644 --- a/.github/workflows/kokkos-regression.yaml +++ b/.github/workflows/kokkos-regression.yaml @@ -16,17 +16,16 @@ jobs: runs-on: ubuntu-latest env: CCACHE_DIR: ${{ github.workspace }}/.ccache - strategy: max-parallel: 4 matrix: style: [ 'pair', 'fix', 'compute', 'misc' ] - + steps: - name: Checkout repository uses: actions/checkout@v4 with: - fetch-depth: 0 + fetch-depth: 2 show-progress: false - name: Install extra packages @@ -43,8 +42,8 @@ jobs: uses: actions/cache@v4 with: path: ${{ env.CCACHE_DIR }} - key: linux-quick-ccache-${{ github.sha }} - restore-keys: linux-quick-ccache- + key: linux-kokkos-ccache-${{ github.sha }} + restore-keys: linux-kokkos-ccache- - name: Building LAMMPS via CMake shell: bash @@ -56,7 +55,7 @@ jobs: python3 -m pip install numpy pyyaml junit_xml cmake -S cmake -B build \ -C cmake/presets/gcc.cmake \ - -C cmake/presets/basic.cmake \ + -C cmake/presets/most.cmake \ -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ -D CMAKE_C_COMPILER_LAUNCHER=ccache \ -D BUILD_SHARED_LIBS=off \ @@ -67,6 +66,7 @@ jobs: -D Kokkos_ENABLE_CUDA=off \ -D PKG_COLLOID=on \ -D PKG_GRANULAR=on \ + -D PKG_PYTHON=on \ -D BUILD_OMP=yes \ -G Ninja cmake --build build @@ -83,7 +83,8 @@ jobs: --config-file=tools/regression-tests/config_kokkos_openmp.yaml \ --list-input=input-list-${{ matrix.style }}-kk.txt \ --output-file=output-${{ matrix.style }}.xml \ - --progress-file=progress-${{ matrix.style }}.yaml --log-file=run-${{ matrix.style }}.log \ + --progress-file=progress-${{ matrix.style }}.yaml \ + --log-file=run-${{ matrix.style }}.log \ --verbose tar -cvf kokkos-regression-test-${{ matrix.style }}.tar run-${{ matrix.style }}.log progress-${{ matrix.style }}.yaml output-${{ matrix.style }}.xml @@ -93,7 +94,7 @@ jobs: with: name: kokkos-regression-test-artifact-${{ matrix.style }} path: kokkos-regression-test-${{ matrix.style }}.tar - + merge: runs-on: ubuntu-latest needs: build @@ -102,5 +103,5 @@ jobs: uses: actions/upload-artifact/merge@v4 with: name: merged-kokkos-regresssion-artifact - pattern: kokkos-regression-test-artifact-* + pattern: kokkos-regression-test-artifact-* diff --git a/tools/regression-tests/get_kokkos_input.py b/tools/regression-tests/get_kokkos_input.py index 3f004bbcba..6131ef395d 100644 --- a/tools/regression-tests/get_kokkos_input.py +++ b/tools/regression-tests/get_kokkos_input.py @@ -10,6 +10,33 @@ from argparse import ArgumentParser import subprocess import sys +# in_style = fix, pair, compute, angle, bond, min +def get_list(in_style, example_toplevel): + + with open(f"input-list-{in_style}-kk.txt", "w") as f: + # find all the pair styles with the kokkos suffix + cmd_str = f"ls {example_toplevel}/../src/KOKKOS | grep -v npair | grep {in_style} | grep .cpp" + p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) + kokkos_styles = p.stdout.split('\n') + style_names = [] + for style in kokkos_styles: + if style != "": + # replace "{in_style}_[name]_kokkos.cpp" into "[name]" + style = style.replace(f"{in_style}_","") + style = style.replace("_kokkos.cpp","") + style = style.replace("_","/") + style_names.append(style) + + for style in style_names: + cmd_str = f"grep -rl '{in_style}_style.*{style}' {example_toplevel}/*/in.* " + p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) + input_list = p.stdout.split('\n') + input_list = ' '.join(input_list).split() + #print(f"There are {len(input_list)} input files that contains {in_style} {style}") + for input in input_list: + if input != "": + f.write(f"{input}\n") + if __name__ == "__main__": parser = ArgumentParser() parser.add_argument("--examples-top-level", dest="example_toplevel", default="", help="Examples top-level") From b960cb213fad96e3ee5dbfbad7d3c82ae843fb9c Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Fri, 11 Oct 2024 15:36:18 -0500 Subject: [PATCH 12/31] revert to building with basic.cmake preset and manually include packages, refactor the get_kokkos_input script --- .github/workflows/kokkos-regression.yaml | 8 +- tools/regression-tests/get_kokkos_input.py | 207 +++++---------------- 2 files changed, 51 insertions(+), 164 deletions(-) diff --git a/.github/workflows/kokkos-regression.yaml b/.github/workflows/kokkos-regression.yaml index 57e5323b24..4c482a67cc 100644 --- a/.github/workflows/kokkos-regression.yaml +++ b/.github/workflows/kokkos-regression.yaml @@ -55,7 +55,7 @@ jobs: python3 -m pip install numpy pyyaml junit_xml cmake -S cmake -B build \ -C cmake/presets/gcc.cmake \ - -C cmake/presets/most.cmake \ + -C cmake/presets/basic.cmake \ -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ -D CMAKE_C_COMPILER_LAUNCHER=ccache \ -D BUILD_SHARED_LIBS=off \ @@ -64,9 +64,15 @@ jobs: -D Kokkos_ARCH_ARMAVX=on \ -D Kokkos_ENABLE_OPENMP=on \ -D Kokkos_ENABLE_CUDA=off \ + -D PKG_BROWNIAN=on \ + -D PKG_CLASS2=on \ -D PKG_COLLOID=on \ + -D PKG_DIPOLE=on \ + -D PKG_DPD-BASIC=on \ -D PKG_GRANULAR=on \ -D PKG_PYTHON=on \ + -D PKG_QEQ=on \ + -D PKG_REAXFF=on \ -D BUILD_OMP=yes \ -G Ninja cmake --build build diff --git a/tools/regression-tests/get_kokkos_input.py b/tools/regression-tests/get_kokkos_input.py index 6131ef395d..12697a8b1c 100644 --- a/tools/regression-tests/get_kokkos_input.py +++ b/tools/regression-tests/get_kokkos_input.py @@ -10,32 +10,38 @@ from argparse import ArgumentParser import subprocess import sys -# in_style = fix, pair, compute, angle, bond, min -def get_list(in_style, example_toplevel): +# in_style = fix, pair, compute, angle, bond, dihedral, improper, min +def generate_list(in_style, example_toplevel, output_list): - with open(f"input-list-{in_style}-kk.txt", "w") as f: - # find all the pair styles with the kokkos suffix - cmd_str = f"ls {example_toplevel}/../src/KOKKOS | grep -v npair | grep {in_style} | grep .cpp" - p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) - kokkos_styles = p.stdout.split('\n') - style_names = [] - for style in kokkos_styles: - if style != "": - # replace "{in_style}_[name]_kokkos.cpp" into "[name]" - style = style.replace(f"{in_style}_","") - style = style.replace("_kokkos.cpp","") - style = style.replace("_","/") - style_names.append(style) + # find all the pair styles with the kokkos suffix + cmd_str = f"ls {example_toplevel}/../src/KOKKOS | grep {in_style} | grep .cpp" + p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) + kokkos_styles = p.stdout.split('\n') + style_names = [] + for style in kokkos_styles: + if style != "": + # replace "{in_style}_[name]_kokkos.cpp" into "[name]" + style = style.replace(f"{in_style}_","") + style = style.replace("_kokkos.cpp","") + style = style.replace("_","/") + style_names.append(style) - for style in style_names: + for style in style_names: + # find in the in. script a line with "pair_style [name]" + if in_style == "pair": cmd_str = f"grep -rl '{in_style}_style.*{style}' {example_toplevel}/*/in.* " - p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) - input_list = p.stdout.split('\n') - input_list = ' '.join(input_list).split() - #print(f"There are {len(input_list)} input files that contains {in_style} {style}") - for input in input_list: - if input != "": - f.write(f"{input}\n") + else: + # find in the in. script a line with "fix ... [name]" (or "compute ... [name]") + cmd_str = f"grep -rl '{in_style}.*{style}' {example_toplevel}/*/in.* " + + p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) + input_list = p.stdout.split('\n') + input_list = ' '.join(input_list).split() + #print(f"There are {len(input_list)} input files that contains {in_style} {style}") + for input in input_list: + if input != "": + output_list.append(input) + if __name__ == "__main__": parser = ArgumentParser() @@ -44,148 +50,23 @@ if __name__ == "__main__": args = parser.parse_args() example_toplevel = args.example_toplevel - with open("input-list-pair-kk.txt", "w") as f: - # find all the pair styles with the kokkos suffix - cmd_str = f"ls {example_toplevel}/../src/KOKKOS | grep -v npair | grep pair | grep .cpp" - p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) - kokkos_styles = p.stdout.split('\n') - style_names = [] - for style in kokkos_styles: - if style != "": - # replace "pair_[name]_kokkos.cpp" into "[name]" - style = style.replace("pair_","") - style = style.replace("_kokkos.cpp","") - style = style.replace("_","/") - style_names.append(style) - - for style in style_names: - cmd_str = f"grep -rl 'pair_style.*{style}' {example_toplevel}/*/in.* " - p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) - input_list = p.stdout.split('\n') - input_list = ' '.join(input_list).split() - #print(f"There are {len(input_list)} input files that contains pair {style}") + # print the list of the input scripts that has each feature to a separate file + features = [ 'pair', 'fix', 'compute' ] + for feature in features: + input_list = [] + generate_list(feature, example_toplevel, input_list) + with open(f"input-list-{feature}-kk.txt", "w") as f: for input in input_list: if input != "": f.write(f"{input}\n") - with open("input-list-fix-kk.txt", "w") as f: + # combine the list of the input scripts that have these feature to a single file input-list-misc-kk.txt + features = [ 'angle', 'bond', 'dihedral', 'improper', 'min' ] + input_list = [] + for feature in features: + generate_list(feature, example_toplevel, input_list) - # find all the fix styles with the kokkos suffix - cmd_str = f"ls {example_toplevel}/../src/KOKKOS | grep fix | grep .cpp" - p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) - kokkos_styles = p.stdout.split('\n') - style_names = [] - for style in kokkos_styles: - if style != "": - # replace "fix_[name]_kokkos.cpp" into "[name]" - style = style.replace("fix_","") - style = style.replace("_kokkos.cpp","") - style = style.replace("_","/") - style_names.append(style) - - for style in style_names: - cmd_str = f"grep -rl 'fix.*{style}' {example_toplevel}/*/in.* " - p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) - input_list = p.stdout.split('\n') - input_list = ' '.join(input_list).split() - #print(f"There are {len(input_list)} input files that contains fix {style}") - for input in input_list: - if input != "": - f.write(f"{input}\n") - - with open("input-list-compute-kk.txt", "w") as f: - # find all the compute styles with the kokkos suffix - cmd_str = f"ls {example_toplevel}/../src/KOKKOS | grep compute | grep .cpp" - p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) - kokkos_styles = p.stdout.split('\n') - style_names = [] - for style in kokkos_styles: - if style != "": - # replace "compute_[name]_kokkos.cpp" into "[name]" - style = style.replace("compute_","") - style = style.replace("_kokkos.cpp","") - style = style.replace("_","/") - style_names.append(style) - - for style in style_names: - cmd_str = f"grep -rl 'compute.*{style}' {example_toplevel}/*/in.* " - p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) - input_list = p.stdout.split('\n') - input_list = ' '.join(input_list).split() - #print(f"There are {len(input_list)} input files that contains compute {style}") - for input in input_list: - if input != "": - f.write(f"{input}\n") - - - with open("input-list-misc-kk.txt", "w") as f: - - # find all the angle styles with the kokkos suffix - cmd_str = f"ls {example_toplevel}/../src/KOKKOS | grep angle | grep .cpp" - p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) - kokkos_styles = p.stdout.split('\n') - style_names = [] - for style in kokkos_styles: - if style != "": - # replace "compute_[name]_kokkos.cpp" into "[name]" - style = style.replace("angle_","") - style = style.replace("_kokkos.cpp","") - style = style.replace("_","/") - style_names.append(style) - - for style in style_names: - cmd_str = f"grep -rl 'angle_style.*{style}' {example_toplevel}/*/in.* " - p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) - input_list = p.stdout.split('\n') - input_list = ' '.join(input_list).split() - #print(f"There are {len(input_list)} input files that contains angle {style}") - for input in input_list: - if input != "": - f.write(f"{input}\n") - - - # find all the bond styles with the kokkos suffix - cmd_str = f"ls {example_toplevel}/../src/KOKKOS | grep bond | grep .cpp" - p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) - kokkos_styles = p.stdout.split('\n') - style_names = [] - for style in kokkos_styles: - if style != "": - # replace "compute_[name]_kokkos.cpp" into "[name]" - style = style.replace("bond_","") - style = style.replace("_kokkos.cpp","") - style = style.replace("_","/") - style_names.append(style) - - for style in style_names: - cmd_str = f"grep -rl 'bond_style.*{style}' {example_toplevel}/*/in.* " - p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) - input_list = p.stdout.split('\n') - input_list = ' '.join(input_list).split() - #print(f"There are {len(input_list)} input files that contains bond {style}") - for input in input_list: - if input != "": - f.write(f"{input}\n") - - # find all the min styles with the kokkos suffix - cmd_str = f"ls {example_toplevel}/../src/KOKKOS | grep min | grep .cpp" - p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) - kokkos_styles = p.stdout.split('\n') - style_names = [] - for style in kokkos_styles: - if style != "": - # replace "compute_[name]_kokkos.cpp" into "[name]" - style = style.replace("min_","") - style = style.replace("_kokkos.cpp","") - style = style.replace("_","/") - style_names.append(style) - - for style in style_names: - cmd_str = f"grep -rl 'min_style.*{style}' {example_toplevel}/*/in.* " - p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) - input_list = p.stdout.split('\n') - input_list = ' '.join(input_list).split() - #print(f"There are {len(input_list)} input files that contains min {style}") - for input in input_list: - if input != "": - f.write(f"{input}\n") + with open(f"input-list-misc-kk.txt", "w") as f: + for input in input_list: + if input != "": + f.write(f"{input}\n") From 29e6ca00441358506df7819a86d8eca3c04090cd Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Fri, 11 Oct 2024 16:18:33 -0500 Subject: [PATCH 13/31] filter out input scripts for testing, remove concurrent (matrix) testing --- .github/workflows/kokkos-regression.yaml | 30 +++++++--------------- tools/regression-tests/get_kokkos_input.py | 18 ++++++++++--- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/.github/workflows/kokkos-regression.yaml b/.github/workflows/kokkos-regression.yaml index 4c482a67cc..95117aa206 100644 --- a/.github/workflows/kokkos-regression.yaml +++ b/.github/workflows/kokkos-regression.yaml @@ -16,10 +16,6 @@ jobs: runs-on: ubuntu-latest env: CCACHE_DIR: ${{ github.workspace }}/.ccache - strategy: - max-parallel: 4 - matrix: - style: [ 'pair', 'fix', 'compute', 'misc' ] steps: - name: Checkout repository @@ -73,6 +69,7 @@ jobs: -D PKG_PYTHON=on \ -D PKG_QEQ=on \ -D PKG_REAXFF=on \ + -D PKG_REPLICA=on \ -D BUILD_OMP=yes \ -G Ninja cmake --build build @@ -82,32 +79,23 @@ jobs: shell: bash run: | source linuxenv/bin/activate - python3 tools/regression-tests/get_kokkos_input.py --examples-top-level=examples + python3 tools/regression-tests/get_kokkos_input.py --examples-top-level=examples --filter-out="balance;mdi;mliap;pace;prd;pour;python;snap" python3 tools/regression-tests/run_tests.py \ --lmp-bin=build/lmp \ --config-file=tools/regression-tests/config_kokkos_openmp.yaml \ - --list-input=input-list-${{ matrix.style }}-kk.txt \ - --output-file=output-${{ matrix.style }}.xml \ - --progress-file=progress-${{ matrix.style }}.yaml \ - --log-file=run-${{ matrix.style }}.log \ + --list-input=input-list-pair-kk.txt \ + --output-file=output-pair.xml \ + --progress-file=progress-pair.yaml \ + --log-file=run-pair.log \ --verbose - tar -cvf kokkos-regression-test-${{ matrix.style }}.tar run-${{ matrix.style }}.log progress-${{ matrix.style }}.yaml output-${{ matrix.style }}.xml + tar -cvf kokkos-regression-test-pair.tar run-pair.log progress-pair.yaml output-pair.xml - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: kokkos-regression-test-artifact-${{ matrix.style }} - path: kokkos-regression-test-${{ matrix.style }}.tar + name: kokkos-regression-test-artifact + path: kokkos-regression-test.tar - merge: - runs-on: ubuntu-latest - needs: build - steps: - - name: Merge Artifacts - uses: actions/upload-artifact/merge@v4 - with: - name: merged-kokkos-regresssion-artifact - pattern: kokkos-regression-test-artifact-* diff --git a/tools/regression-tests/get_kokkos_input.py b/tools/regression-tests/get_kokkos_input.py index 12697a8b1c..6f6781abb9 100644 --- a/tools/regression-tests/get_kokkos_input.py +++ b/tools/regression-tests/get_kokkos_input.py @@ -11,7 +11,7 @@ import subprocess import sys # in_style = fix, pair, compute, angle, bond, dihedral, improper, min -def generate_list(in_style, example_toplevel, output_list): +def generate_list(in_style, example_toplevel, filter_out, output_list): # find all the pair styles with the kokkos suffix cmd_str = f"ls {example_toplevel}/../src/KOKKOS | grep {in_style} | grep .cpp" @@ -40,21 +40,31 @@ def generate_list(in_style, example_toplevel, output_list): #print(f"There are {len(input_list)} input files that contains {in_style} {style}") for input in input_list: if input != "": - output_list.append(input) + skip = False + for filter in filter_out: + if filter in input: + skip = True + break + if skip == True: + continue + else: + output_list.append(input) if __name__ == "__main__": parser = ArgumentParser() parser.add_argument("--examples-top-level", dest="example_toplevel", default="", help="Examples top-level") + parser.add_argument("--filter-out", dest="filter_out", default="", help="Filter out input scripts that contain strings") args = parser.parse_args() example_toplevel = args.example_toplevel + filter_out = args.filter_out.split(";") # print the list of the input scripts that has each feature to a separate file features = [ 'pair', 'fix', 'compute' ] for feature in features: input_list = [] - generate_list(feature, example_toplevel, input_list) + generate_list(feature, example_toplevel, filter_out, input_list) with open(f"input-list-{feature}-kk.txt", "w") as f: for input in input_list: if input != "": @@ -64,7 +74,7 @@ if __name__ == "__main__": features = [ 'angle', 'bond', 'dihedral', 'improper', 'min' ] input_list = [] for feature in features: - generate_list(feature, example_toplevel, input_list) + generate_list(feature, example_toplevel, filter_out, input_list) with open(f"input-list-misc-kk.txt", "w") as f: for input in input_list: From 3e649668004da35529391485438609a82900de51 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Sat, 12 Oct 2024 23:53:35 -0500 Subject: [PATCH 14/31] filter out examples/fire --- .github/workflows/kokkos-regression.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/kokkos-regression.yaml b/.github/workflows/kokkos-regression.yaml index 95117aa206..1965ca7f94 100644 --- a/.github/workflows/kokkos-regression.yaml +++ b/.github/workflows/kokkos-regression.yaml @@ -79,7 +79,7 @@ jobs: shell: bash run: | source linuxenv/bin/activate - python3 tools/regression-tests/get_kokkos_input.py --examples-top-level=examples --filter-out="balance;mdi;mliap;pace;prd;pour;python;snap" + python3 tools/regression-tests/get_kokkos_input.py --examples-top-level=examples --filter-out="balance;fire;mdi;mliap;pace;prd;pour;python;snap" python3 tools/regression-tests/run_tests.py \ --lmp-bin=build/lmp \ From c735dc7d535f9912c3592e9c1d37d675f4989642 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Sun, 13 Oct 2024 08:21:00 -0500 Subject: [PATCH 15/31] skip in.min.box, ensure that input lists only contain unique entries --- tools/regression-tests/config_kokkos.yaml | 4 ++++ tools/regression-tests/get_kokkos_input.py | 9 +++++---- tools/regression-tests/run_tests.py | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tools/regression-tests/config_kokkos.yaml b/tools/regression-tests/config_kokkos.yaml index 76a142d7d8..e66dda9fc2 100644 --- a/tools/regression-tests/config_kokkos.yaml +++ b/tools/regression-tests/config_kokkos.yaml @@ -28,6 +28,10 @@ Press: abs: 1e-2 rel: 1e-4 + skip: + [ + in.min.box, + ] timeout: 180 nugget: 1.0 diff --git a/tools/regression-tests/get_kokkos_input.py b/tools/regression-tests/get_kokkos_input.py index 6f6781abb9..c03a813456 100644 --- a/tools/regression-tests/get_kokkos_input.py +++ b/tools/regression-tests/get_kokkos_input.py @@ -28,7 +28,7 @@ def generate_list(in_style, example_toplevel, filter_out, output_list): for style in style_names: # find in the in. script a line with "pair_style [name]" - if in_style == "pair": + if in_style == "pair" or in_style == "angle" or in_style == "bond" or in_style == "dihedral" or in_style == "improper": cmd_str = f"grep -rl '{in_style}_style.*{style}' {example_toplevel}/*/in.* " else: # find in the in. script a line with "fix ... [name]" (or "compute ... [name]") @@ -37,7 +37,6 @@ def generate_list(in_style, example_toplevel, filter_out, output_list): p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True) input_list = p.stdout.split('\n') input_list = ' '.join(input_list).split() - #print(f"There are {len(input_list)} input files that contains {in_style} {style}") for input in input_list: if input != "": skip = False @@ -47,8 +46,9 @@ def generate_list(in_style, example_toplevel, filter_out, output_list): break if skip == True: continue - else: - output_list.append(input) + else: + if input not in output_list: + output_list.append(input) if __name__ == "__main__": @@ -80,3 +80,4 @@ if __name__ == "__main__": for input in input_list: if input != "": f.write(f"{input}\n") + diff --git a/tools/regression-tests/run_tests.py b/tools/regression-tests/run_tests.py index 15fe0c01ca..9d9499efc9 100755 --- a/tools/regression-tests/run_tests.py +++ b/tools/regression-tests/run_tests.py @@ -305,8 +305,8 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file config['nprocs'] = str(max_np) else: # otherwise use the nprocs value in the configuration file (4 for most examples) - logger.info(f" Using nprocs {config['nprocs']} nprocs for {input_test} as specified in the config file.") - logger.info(f" The maximum number of procs in the log files is {max_np}.") + logger.info(f" Using {config['nprocs']} nprocs for {input_test} as enforced in the config file.") + logger.info(f" WARNING: The maximum number of procs found from the reference log files is {max_np}.") # store the value of nprocs to name the generated log file nprocs = int(config['nprocs']) From 0d894c33c4553832ebbe721af84f7c22b5579bdc Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Sun, 13 Oct 2024 11:52:10 -0500 Subject: [PATCH 16/31] adjust the workflow files and config file --- tools/regression-tests/config_kokkos.yaml | 2 +- tools/regression-tests/config_kokkos_openmp.yaml | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/regression-tests/config_kokkos.yaml b/tools/regression-tests/config_kokkos.yaml index e66dda9fc2..71cbd603c4 100644 --- a/tools/regression-tests/config_kokkos.yaml +++ b/tools/regression-tests/config_kokkos.yaml @@ -33,6 +33,6 @@ in.min.box, ] - timeout: 180 + timeout: 120 nugget: 1.0 epsilon: 1e-16 diff --git a/tools/regression-tests/config_kokkos_openmp.yaml b/tools/regression-tests/config_kokkos_openmp.yaml index 217888c762..495c5fc638 100644 --- a/tools/regression-tests/config_kokkos_openmp.yaml +++ b/tools/regression-tests/config_kokkos_openmp.yaml @@ -20,7 +20,12 @@ E_vdwl: abs: 1e-3 rel: 1e-7 + + skip: + [ + in.min.box, + ] - timeout: 180 + timeout: 120 nugget: 1.0 epsilon: 1e-16 From 4773b3e7e4fe529b832364ffa8fe7174c070470c Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Sun, 13 Oct 2024 15:48:29 -0500 Subject: [PATCH 17/31] fix indentation in the config files --- tools/regression-tests/config_kokkos.yaml | 6 +++--- tools/regression-tests/config_kokkos_openmp.yaml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/regression-tests/config_kokkos.yaml b/tools/regression-tests/config_kokkos.yaml index 71cbd603c4..fbf53ece80 100644 --- a/tools/regression-tests/config_kokkos.yaml +++ b/tools/regression-tests/config_kokkos.yaml @@ -29,9 +29,9 @@ abs: 1e-2 rel: 1e-4 skip: - [ - in.min.box, - ] + [ + in.min.box, + ] timeout: 120 nugget: 1.0 diff --git a/tools/regression-tests/config_kokkos_openmp.yaml b/tools/regression-tests/config_kokkos_openmp.yaml index 495c5fc638..d12ef7a27b 100644 --- a/tools/regression-tests/config_kokkos_openmp.yaml +++ b/tools/regression-tests/config_kokkos_openmp.yaml @@ -22,9 +22,9 @@ rel: 1e-7 skip: - [ - in.min.box, - ] + [ + in.min.box, + ] timeout: 120 nugget: 1.0 From 383ae086e5e65b62fda05e76146d0a839cae666c Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Sun, 13 Oct 2024 22:54:54 -0500 Subject: [PATCH 18/31] skip in.icos due to the minimize command --- .github/workflows/kokkos-regression.yaml | 3 ++- tools/regression-tests/config_kokkos.yaml | 1 + tools/regression-tests/config_kokkos_openmp.yaml | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/kokkos-regression.yaml b/.github/workflows/kokkos-regression.yaml index 1965ca7f94..81b72cd1e4 100644 --- a/.github/workflows/kokkos-regression.yaml +++ b/.github/workflows/kokkos-regression.yaml @@ -63,6 +63,7 @@ jobs: -D PKG_BROWNIAN=on \ -D PKG_CLASS2=on \ -D PKG_COLLOID=on \ + -D PKG_CORESHELL=on \ -D PKG_DIPOLE=on \ -D PKG_DPD-BASIC=on \ -D PKG_GRANULAR=on \ @@ -79,7 +80,7 @@ jobs: shell: bash run: | source linuxenv/bin/activate - python3 tools/regression-tests/get_kokkos_input.py --examples-top-level=examples --filter-out="balance;fire;mdi;mliap;pace;prd;pour;python;snap" + python3 tools/regression-tests/get_kokkos_input.py --examples-top-level=examples --filter-out="balance;fire;gcmc;mdi;mliap;neb;pace;prd;pour;python;snap" python3 tools/regression-tests/run_tests.py \ --lmp-bin=build/lmp \ diff --git a/tools/regression-tests/config_kokkos.yaml b/tools/regression-tests/config_kokkos.yaml index fbf53ece80..bfb67793da 100644 --- a/tools/regression-tests/config_kokkos.yaml +++ b/tools/regression-tests/config_kokkos.yaml @@ -31,6 +31,7 @@ skip: [ in.min.box, + in.icos, ] timeout: 120 diff --git a/tools/regression-tests/config_kokkos_openmp.yaml b/tools/regression-tests/config_kokkos_openmp.yaml index d12ef7a27b..8df487b1bb 100644 --- a/tools/regression-tests/config_kokkos_openmp.yaml +++ b/tools/regression-tests/config_kokkos_openmp.yaml @@ -20,10 +20,11 @@ E_vdwl: abs: 1e-3 rel: 1e-7 - + skip: [ in.min.box, + in.icos, ] timeout: 120 From 3e7642bc8cb1a9062ee5b7548ca5ae63e016225d Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Mon, 14 Oct 2024 09:43:08 -0500 Subject: [PATCH 19/31] fix artifact names, allow to run quick test with a given input list --- .github/workflows/kokkos-regression.yaml | 3 ++- tools/regression-tests/run_tests.py | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/kokkos-regression.yaml b/.github/workflows/kokkos-regression.yaml index 81b72cd1e4..04f64b94b2 100644 --- a/.github/workflows/kokkos-regression.yaml +++ b/.github/workflows/kokkos-regression.yaml @@ -86,6 +86,7 @@ jobs: --lmp-bin=build/lmp \ --config-file=tools/regression-tests/config_kokkos_openmp.yaml \ --list-input=input-list-pair-kk.txt \ + --quick --quick-max=100 \ --output-file=output-pair.xml \ --progress-file=progress-pair.yaml \ --log-file=run-pair.log \ @@ -97,6 +98,6 @@ jobs: uses: actions/upload-artifact@v4 with: name: kokkos-regression-test-artifact - path: kokkos-regression-test.tar + path: kokkos-regression-test*.tar diff --git a/tools/regression-tests/run_tests.py b/tools/regression-tests/run_tests.py index 9d9499efc9..4af39522ae 100755 --- a/tools/regression-tests/run_tests.py +++ b/tools/regression-tests/run_tests.py @@ -1370,6 +1370,14 @@ if __name__ == "__main__": example_inputs.append(input) num_inputscripts += 1 + # allow to select randomly some input scripts at this point if quick is set to be True + if quick: + if len(example_inputs) > quick_max: + example_inputs = random.sample(example_inputs, quick_max) + msg = "\nTesting " + str(quick_max) + " randomly selected inputs" + print(msg) + logger.info(msg) + example_subfolders = folder_list msg = f"\nThere are {num_inputscripts} input scripts listed in {list_input}." print(msg) From b0f2484441fc09d2efc3e9e808d3f7f734f861d1 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Mon, 14 Oct 2024 10:45:53 -0500 Subject: [PATCH 20/31] fix logic bug with allowing quick_max to run without requiring quick to be True --- tools/regression-tests/run_tests.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tools/regression-tests/run_tests.py b/tools/regression-tests/run_tests.py index 4af39522ae..5be3b6cd2f 100755 --- a/tools/regression-tests/run_tests.py +++ b/tools/regression-tests/run_tests.py @@ -1123,7 +1123,7 @@ if __name__ == "__main__": help="Determine which test inputs have commands changed between a branch and the head") parser.add_argument("--quick-branch", dest="quick_branch", default=quick_branch, help="Branch to which compare the current head to for changed styles") - parser.add_argument("--quick-max", dest="quick_max", default=50, + parser.add_argument("--quick-max", dest="quick_max", default=0, help="Maximum number of inputs to randomly select") parser.add_argument("--quick-reference", dest="quick_reference", default=quick_reference, help="Reference YAML file with progress data from full regression test run") @@ -1370,13 +1370,12 @@ if __name__ == "__main__": example_inputs.append(input) num_inputscripts += 1 - # allow to select randomly some input scripts at this point if quick is set to be True - if quick: - if len(example_inputs) > quick_max: - example_inputs = random.sample(example_inputs, quick_max) - msg = "\nTesting " + str(quick_max) + " randomly selected inputs" - print(msg) - logger.info(msg) + # allow to select randomly some input scripts at this point if quick_max is set + if quick_max > 0 and len(example_inputs) > quick_max: + example_inputs = random.sample(example_inputs, quick_max) + msg = "\nTesting " + str(quick_max) + " randomly selected inputs" + print(msg) + logger.info(msg) example_subfolders = folder_list msg = f"\nThere are {num_inputscripts} input scripts listed in {list_input}." From eadb2f2eb1e858fac715646a8f36ec4b02a92786 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Mon, 14 Oct 2024 11:23:08 -0500 Subject: [PATCH 21/31] fix the workflow file for not turning on quick --- .github/workflows/kokkos-regression.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/kokkos-regression.yaml b/.github/workflows/kokkos-regression.yaml index 04f64b94b2..5779ede52a 100644 --- a/.github/workflows/kokkos-regression.yaml +++ b/.github/workflows/kokkos-regression.yaml @@ -86,7 +86,7 @@ jobs: --lmp-bin=build/lmp \ --config-file=tools/regression-tests/config_kokkos_openmp.yaml \ --list-input=input-list-pair-kk.txt \ - --quick --quick-max=100 \ + --quick-max=100 \ --output-file=output-pair.xml \ --progress-file=progress-pair.yaml \ --log-file=run-pair.log \ From b9e4c6e1e7be9464fea36599106008db68f5f139 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Mon, 14 Oct 2024 14:55:26 -0500 Subject: [PATCH 22/31] re-enable matrix tests --- .github/workflows/kokkos-regression.yaml | 37 ++++++++++++++++-------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/.github/workflows/kokkos-regression.yaml b/.github/workflows/kokkos-regression.yaml index 5779ede52a..4a202b664f 100644 --- a/.github/workflows/kokkos-regression.yaml +++ b/.github/workflows/kokkos-regression.yaml @@ -1,5 +1,5 @@ # GitHub action to build LAMMPS on Linux and run selected regression tests -name: "Kokkos Regression Test" +name: "Kokkos OpenMP Regression Test" on: pull_request: @@ -16,6 +16,10 @@ jobs: runs-on: ubuntu-latest env: CCACHE_DIR: ${{ github.workspace }}/.ccache + strategy: + max-parallel: 4 + matrix: + idx: [ 'pair', 'fix', 'compute', 'misc' ] steps: - name: Checkout repository @@ -80,24 +84,33 @@ jobs: shell: bash run: | source linuxenv/bin/activate - python3 tools/regression-tests/get_kokkos_input.py --examples-top-level=examples --filter-out="balance;fire;gcmc;mdi;mliap;neb;pace;prd;pour;python;snap" + python3 tools/regression-tests/get_kokkos_input.py \ + --examples-top-level=examples \ + --filter-out="balance;fire;gcmc;mdi;mliap;neb;pace;prd;pour;python;snap" python3 tools/regression-tests/run_tests.py \ --lmp-bin=build/lmp \ --config-file=tools/regression-tests/config_kokkos_openmp.yaml \ - --list-input=input-list-pair-kk.txt \ - --quick-max=100 \ - --output-file=output-pair.xml \ - --progress-file=progress-pair.yaml \ - --log-file=run-pair.log \ - --verbose + --list-input=input-list-${{ matrix.idx }}-kk.txt \ + --output-file=output-${{ matrix.idx }}.xml \ + --progress-file=progress-${{ matrix.idx }}.yaml \ + --log-file=run-${{ matrix.idx }}.log \ + --quick-max=100 --verbose - tar -cvf kokkos-regression-test-pair.tar run-pair.log progress-pair.yaml output-pair.xml + tar -cvf kokkos-regression-test-${{ matrix.idx }}.tar run-${{ matrix.idx }}.log progress-${{ matrix.idx }}.yaml output-${{ matrix.idx }}.xml - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: kokkos-regression-test-artifact - path: kokkos-regression-test*.tar - + name: kokkos-regression-test-artifact-${{ matrix.idx }} + path: kokkos-regression-test-${{ matrix.idx }}.tar + merge: + runs-on: ubuntu-latest + needs: build + steps: + - name: Merge Artifacts + uses: actions/upload-artifact/merge@v4 + with: + name: merged-kokkos-regresssion-artifact + pattern: kokkos-regression-test-artifact-* From c533ca0af12b868477ed8c83718c1fdf6a239354 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Mon, 14 Oct 2024 16:05:21 -0500 Subject: [PATCH 23/31] handle the cases where num steps do not match with the reference log files --- .github/workflows/kokkos-regression.yaml | 2 +- tools/regression-tests/config_kokkos.yaml | 23 ++++---------- .../config_kokkos_openmp.yaml | 6 ---- tools/regression-tests/run_tests.py | 30 +++++++++++++++++-- 4 files changed, 34 insertions(+), 27 deletions(-) diff --git a/.github/workflows/kokkos-regression.yaml b/.github/workflows/kokkos-regression.yaml index 4a202b664f..1670fc4e8c 100644 --- a/.github/workflows/kokkos-regression.yaml +++ b/.github/workflows/kokkos-regression.yaml @@ -19,7 +19,7 @@ jobs: strategy: max-parallel: 4 matrix: - idx: [ 'pair', 'fix', 'compute', 'misc' ] + idx: [ 'pair', 'compute', 'misc' ] steps: - name: Checkout repository diff --git a/tools/regression-tests/config_kokkos.yaml b/tools/regression-tests/config_kokkos.yaml index bfb67793da..455d1ad0dd 100644 --- a/tools/regression-tests/config_kokkos.yaml +++ b/tools/regression-tests/config_kokkos.yaml @@ -7,32 +7,19 @@ tolerance: PotEng: abs: 1e-4 - rel: 1e-7 + rel: 1e-6 TotEng: abs: 1e-4 - rel: 1e-7 + rel: 1e-6 Press: abs: 1e-4 - rel: 1e-7 + rel: 1e-6 Temp: abs: 1e-4 - rel: 1e-7 + rel: 1e-6 E_vdwl: abs: 1e-3 - rel: 1e-7 - overrides: - in.rigid.tnr: - Temp: - abs: 1e-3 - rel: 1e-5 - Press: - abs: 1e-2 - rel: 1e-4 - skip: - [ - in.min.box, - in.icos, - ] + rel: 1e-6 timeout: 120 nugget: 1.0 diff --git a/tools/regression-tests/config_kokkos_openmp.yaml b/tools/regression-tests/config_kokkos_openmp.yaml index 8df487b1bb..1979d54b6a 100644 --- a/tools/regression-tests/config_kokkos_openmp.yaml +++ b/tools/regression-tests/config_kokkos_openmp.yaml @@ -21,12 +21,6 @@ abs: 1e-3 rel: 1e-7 - skip: - [ - in.min.box, - in.icos, - ] - timeout: 120 nugget: 1.0 epsilon: 1e-16 diff --git a/tools/regression-tests/run_tests.py b/tools/regression-tests/run_tests.py index 5be3b6cd2f..cb418c98da 100755 --- a/tools/regression-tests/run_tests.py +++ b/tools/regression-tests/run_tests.py @@ -584,6 +584,7 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file failed_rel_output = [] num_checks = 0 mismatched_columns = False + mismatched_num_steps = False for irun in range(num_runs): num_fields = len(thermo[irun]['keywords']) @@ -596,6 +597,13 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file # get the total number of the thermo output lines nthermo_steps = len(thermo[irun]['data']) + nthermo_steps_ref = len(thermo_ref[irun]['data']) + + if nthermo_steps_ref != nthermo_steps: + logger.info(f" failed: Number of thermo steps in {logfilename} ({nthermo_steps})") + logger.info(f" is different from that in the reference log ({nthermo_steps_ref}) in run {irun}.") + mismatched_num_steps = True + continue # get the output at the last timestep thermo_step = nthermo_steps - 1 @@ -647,12 +655,30 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file print(f" {thermo[irun]['keywords'][i].ljust(width)} {str(val).rjust(20)} {str(ref).rjust(20)} {abs_diff_check.rjust(20)} {rel_diff_check.rjust(20)}") # after all runs completed, or are interrupted in one of the runs (mismatched_columns = True) - if mismatched_columns == True: - msg = f" mismatched log files after the first run. Check both log files for more details." + msg = f" mismatched columns in the log files after the first run. Check both log files for more details." print(msg) logger.info(msg) result.status = "thermo checks failed due to mismatched log files after the first run" + results.append(result) + 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 + continue + + # some runs that involve the minimize command that leads to different number of steps vs the reference log file + if mismatched_num_steps == True: + msg = f" mismatched num steps in the log files. Check both log files for more details." + print(msg) + logger.info(msg) + result.status = "thermo checks failed due to mismatched log files " + results.append(result) + 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 + continue result.status = "" if num_abs_failed > 0: From a354ad8d64ca29e04d8f540c0384738cacfb4900 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Mon, 14 Oct 2024 17:20:04 -0500 Subject: [PATCH 24/31] add pair back to the matrix entries --- .github/workflows/kokkos-regression.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/kokkos-regression.yaml b/.github/workflows/kokkos-regression.yaml index 1670fc4e8c..4a202b664f 100644 --- a/.github/workflows/kokkos-regression.yaml +++ b/.github/workflows/kokkos-regression.yaml @@ -19,7 +19,7 @@ jobs: strategy: max-parallel: 4 matrix: - idx: [ 'pair', 'compute', 'misc' ] + idx: [ 'pair', 'fix', 'compute', 'misc' ] steps: - name: Checkout repository From 6e32470cfa8ac73c94d823e0d4d880d2a746c19f Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Mon, 14 Oct 2024 23:27:06 -0500 Subject: [PATCH 25/31] distinguish the error tests vs failed tests --- tools/regression-tests/run_tests.py | 46 +++++++++++++++++++---------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/tools/regression-tests/run_tests.py b/tools/regression-tests/run_tests.py index cb418c98da..006be9663d 100755 --- a/tools/regression-tests/run_tests.py +++ b/tools/regression-tests/run_tests.py @@ -147,10 +147,12 @@ class TestResult: def iterate(lmp_binary, input_folder, input_list, config, results, progress_file, failure_file, walltime_ref=1, verbose=False, last_progress=None, output_buf=None): num_tests = len(input_list) + + num_skipped = 0 + num_error = 0 + num_failed = 0 num_completed = 0 num_passed = 0 - num_skipped = 0 - num_error = 0 num_memleak = 0 test_id = 0 @@ -498,14 +500,14 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file if thermo_ref: num_runs_ref = len(thermo_ref) else: - # thhe thermo_ref dictionary is empty + # the thermo_ref dictionary is empty 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.close() num_completed = num_completed + 1 - num_error = num_error + 1 + num_failed = num_failed + 1 test_id = test_id + 1 continue else: @@ -529,7 +531,7 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file progress.close() failure.write(msg) num_completed = num_completed + 1 - num_error = num_error + 1 + num_failed = num_failed + 1 test_id = test_id + 1 continue @@ -544,7 +546,8 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file results.append(result) progress.write(f"{{ '{input}': {{ 'folder': '{input_folder}', 'status': '{result.status}', 'walltime': '{walltime}', 'walltime_norm': '{walltime_norm}' }} }}\n") progress.close() - num_error = num_error + 1 + num_completed = num_completed + 1 + num_failed = num_failed + 1 test_id = test_id + 1 continue @@ -560,7 +563,8 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file results.append(result) progress.write(f"{{ '{input}': {{ 'folder': '{input_folder}', 'status': '{result.status}', 'walltime': '{walltime}', 'walltime_norm': '{walltime_norm}' }} }}\n") progress.close() - num_error = num_error + 1 + num_completed = num_completed + 1 + num_failed = num_failed + 1 test_id = test_id + 1 continue @@ -663,7 +667,8 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file results.append(result) progress.write(f"{{ '{input}': {{ 'folder': '{input_folder}', 'status': '{result.status}', 'walltime': '{walltime}', 'walltime_norm': '{walltime_norm}' }} }}\n") progress.close() - num_error = num_error + 1 + num_completed = num_completed + 1 + num_failed = num_failed + 1 test_id = test_id + 1 continue @@ -676,7 +681,8 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file results.append(result) progress.write(f"{{ '{input}': {{ 'folder': '{input_folder}', 'status': '{result.status}', 'walltime': '{walltime}', 'walltime_norm': '{walltime_norm}' }} }}\n") progress.close() - num_error = num_error + 1 + num_completed = num_completed + 1 + num_failed = num_failed + 1 test_id = test_id + 1 continue @@ -713,9 +719,8 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file num_passed = num_passed + 1 else: result.status = f" 'status': 'failed', 'abs_diff_failed': '{num_abs_failed}', 'rel_diff_failed': '{num_rel_failed}' " - num_error = num_error + 1 + num_failed = num_failed + 1 - results.append(result) # check if memleak detects from valgrind run (need to replace "mpirun" -> valgrind --leak-check=yes mpirun") @@ -745,6 +750,7 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file 'num_passed': num_passed, 'num_skipped': num_skipped, 'num_error': num_error, + 'num_failed': num_failed, 'num_memleak': num_memleak, } return stat @@ -1489,6 +1495,7 @@ if __name__ == "__main__": passed_tests = 0 skipped_tests = 0 error_tests = 0 + failed_tests = 0 memleak_tests = 0 # default setting is to use inplace_input @@ -1545,6 +1552,7 @@ if __name__ == "__main__": skipped_tests += stat['num_skipped'] passed_tests += stat['num_passed'] error_tests += stat['num_error'] + failed_tests += stat['num_failed'] memleak_tests += stat['num_memleak'] # append the results to the all_results list @@ -1564,26 +1572,32 @@ if __name__ == "__main__": skipped_tests = stat['num_skipped'] passed_tests = stat['num_passed'] error_tests = stat['num_error'] + failed_tests = stat['num_failed'] memleak_tests = stat['num_memleak'] all_results.extend(results) - # print out summary + # print out summary: + # error_tests = number of runs that errored out + # failed_tests = number of runs that failed the numerical checks, including missing the reference log files, different num runs and num steps in a run + # completed_tests = number of runs that reached the end (Total wall time printed out) = failed_sests + passed_tests + msg = "\nSummary:\n" msg += f" Total number of input scripts: {total_tests}\n" msg += f" - Skipped : {skipped_tests}\n" - msg += f" - Failed : {error_tests}\n" + msg += f" - Error : {error_tests}\n" msg += f" - Completed: {completed_tests}\n" + msg += f" - failed : {failed_tests}\n" # print notice to GitHub if 'GITHUB_STEP_SUMMARY' in os.environ: with open(os.environ.get('GITHUB_STEP_SUMMARY'), 'w') as f: - print(f"Skipped: {skipped_tests} Failed: {error_tests} Completed: {completed_tests}", file=f) + print(f"Skipped: {skipped_tests} Error: {error_tests} Failed: {failed_tests} Completed: {completed_tests}", file=f) if memleak_tests < completed_tests and 'valgrind' in config['mpiexec']: - msg += f" - memory leak detected : {memleak_tests}\n" + msg += f" - memory leak detected : {memleak_tests}\n" if passed_tests <= completed_tests: - msg += f" - numerical tests passed: {passed_tests}\n" + msg += f" - numerical tests passed: {passed_tests}\n" msg += "\nOutput:\n" msg += f" - List of failed inputs : {failure_file}\n" msg += f" - Status of the tested inputs : {progress_file}\n" From 8503cac2ce5b402c5106480d2dba8d5fb5cc74b9 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Mon, 14 Oct 2024 23:44:02 -0500 Subject: [PATCH 26/31] update README to explain how to set nprocs in the config file --- tools/regression-tests/README | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/regression-tests/README b/tools/regression-tests/README index 1342e50310..b698be6669 100644 --- a/tools/regression-tests/README +++ b/tools/regression-tests/README @@ -106,7 +106,7 @@ An example of the test configuration `config.yaml` is given as below. --- lmp_binary: "" - nprocs: "4" + nprocs: "" args: "-cite none" mpiexec: "mpirun" mpiexec_numproc_flag: "-np" @@ -135,7 +135,8 @@ An example of the test configuration `config.yaml` is given as below. abs: 1e-2 rel: 1e-4 skip: - [ in.displ, + [ + in.displ, in.displ2, in.*_imd*, ] @@ -144,6 +145,13 @@ An example of the test configuration `config.yaml` is given as below. epsilon: 1e-16 timeout: 180 +Note that if nprocs is left empty "", as in the above example, the test for a given input script will use the maximum number of procs among the log files. +For instance, for the input script examples/melt/in.melt, there are 2 log files with 1 and 4 procs. The test for in.melt will then run with 4 procs and the output is compare against the 4-proc log file. This is the typical configuration. + +If nprocs is specified explicitly, for example, nprocs: "2", this value of nprocs will be used for ALL the input scripts (except for the valgrind test). +In this case, the reference log file is again the one with the maximum number of procs, that is, 4. One example of this configuration is for KOKKOS tests where +the runs are often `mpirun -np 2 lmp -in in.melt -k on g 2` (with the CUDA backend) or `mpirun -np 2 lmp -in in.melt -k on t 2` (with the OpenMP backend). + An example of the list of example subfolders in a text file `list_subfolders1.txt` /home/codes/lammps/examples/melt 1 From 6c31dbf86f570db8b4410040edfe73ca2af2deb5 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Tue, 15 Oct 2024 13:38:02 -0500 Subject: [PATCH 27/31] add more packages to the build --- .github/workflows/kokkos-regression.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/kokkos-regression.yaml b/.github/workflows/kokkos-regression.yaml index 4a202b664f..f9215df6c6 100644 --- a/.github/workflows/kokkos-regression.yaml +++ b/.github/workflows/kokkos-regression.yaml @@ -64,17 +64,29 @@ jobs: -D Kokkos_ARCH_ARMAVX=on \ -D Kokkos_ENABLE_OPENMP=on \ -D Kokkos_ENABLE_CUDA=off \ + -D PKG_AMOEBA=on \ + -D PKG_ASPHERE=on \ -D PKG_BROWNIAN=on \ -D PKG_CLASS2=on \ -D PKG_COLLOID=on \ -D PKG_CORESHELL=on \ -D PKG_DIPOLE=on \ -D PKG_DPD-BASIC=on \ + -D PKG_EXTRA-COMPUTE=on \ + -D PKG_EXTRA-FIX=on \ + -D PKG_EXTRA-MOLECULE=on \ + -D PKG_EXTRA-PAIR=on \ -D PKG_GRANULAR=on \ + -D PKG_LEPTON=on \ + -D PKG_MC=on \ + -D PKG_MEAM=on \ + -D PKG_POEMS=on \ -D PKG_PYTHON=on \ -D PKG_QEQ=on \ -D PKG_REAXFF=on \ -D PKG_REPLICA=on \ + -D PKG_SRD=on \ + -D PKG_VORONOI=on \ -D BUILD_OMP=yes \ -G Ninja cmake --build build @@ -86,7 +98,7 @@ jobs: source linuxenv/bin/activate python3 tools/regression-tests/get_kokkos_input.py \ --examples-top-level=examples \ - --filter-out="balance;fire;gcmc;mdi;mliap;neb;pace;prd;pour;python;snap" + --filter-out="balance;fire;gcmc;granregion;mdi;mliap;neb;pace;prd;pour;python;snap" python3 tools/regression-tests/run_tests.py \ --lmp-bin=build/lmp \ From 06207fd91ed666eae0b1e47386a3c89c5f66e582 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Tue, 22 Oct 2024 23:21:37 -0500 Subject: [PATCH 28/31] modify how execute() returns --- tools/regression-tests/run_tests.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/tools/regression-tests/run_tests.py b/tools/regression-tests/run_tests.py index 006be9663d..ac315560e6 100755 --- a/tools/regression-tests/run_tests.py +++ b/tools/regression-tests/run_tests.py @@ -327,7 +327,12 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file result = TestResult(name=input, output="", time="", status="passed") # run the LAMMPS binary with the input script - cmd_str, output, error, returncode, logfilename = execute(lmp_binary, config, input_test) + status = execute(lmp_binary, config, input_test) + cmd_str = status['cmd_str'] + output = status['stdout'] + error = status['stderr'] + returncode = status['returncode'] + logfilename = status['logfilename'] # restore the nprocs value in the configuration config['nprocs'] = saved_nprocs @@ -928,7 +933,14 @@ def execute(lmp_binary, config, input_file_name, generate_ref=False): try: p = subprocess.run(cmd_str, shell=True, text=True, capture_output=True, timeout=timeout) - return cmd_str, p.stdout, p.stderr, p.returncode, logfilename + status = { + 'cmd_str': cmd_str, + 'stdout': p.stdout, + 'stderr': p.stderr, + 'returncode': p.returncode, + 'logfilename': logfilename, + } + return status except subprocess.TimeoutExpired: msg = f" Timeout for: {cmd_str} ({timeout}s expired)" @@ -936,7 +948,14 @@ def execute(lmp_binary, config, input_file_name, generate_ref=False): print(msg) error_str = f"timeout ({timeout}s expired)" - return cmd_str, "", error_str, -1, logfilename + status = { + 'cmd_str': cmd_str, + 'stdout': "", + 'stderr': error_str, + 'returncode': -1, + 'logfilename': logfilename, + } + return status ''' get the reference walltime by running the lmp_binary with config with an input script in the bench/ folder From d2b1e22b4aba5b6b2c53d0c71cdc830c4008f8eb Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Tue, 22 Oct 2024 23:31:22 -0500 Subject: [PATCH 29/31] added counter for timeout tests --- tools/regression-tests/run_tests.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/regression-tests/run_tests.py b/tools/regression-tests/run_tests.py index ac315560e6..577ca211c0 100755 --- a/tools/regression-tests/run_tests.py +++ b/tools/regression-tests/run_tests.py @@ -150,6 +150,7 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file num_skipped = 0 num_error = 0 + num_timeout = 0 num_failed = 0 num_completed = 0 num_passed = 0 @@ -433,6 +434,10 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file progress.close() failure.write(msg) + returncode = int(returncode) + if returncode == -1: + num_timeout = num_timeout + 1 + num_error = num_error + 1 test_id = test_id + 1 continue @@ -755,6 +760,7 @@ def iterate(lmp_binary, input_folder, input_list, config, results, progress_file 'num_passed': num_passed, 'num_skipped': num_skipped, 'num_error': num_error, + 'num_timeout': num_timeout, 'num_failed': num_failed, 'num_memleak': num_memleak, } @@ -1514,6 +1520,7 @@ if __name__ == "__main__": passed_tests = 0 skipped_tests = 0 error_tests = 0 + timeout_tests = 0 failed_tests = 0 memleak_tests = 0 @@ -1571,6 +1578,7 @@ if __name__ == "__main__": skipped_tests += stat['num_skipped'] passed_tests += stat['num_passed'] error_tests += stat['num_error'] + timeout_tests += stat['num_timeout'] failed_tests += stat['num_failed'] memleak_tests += stat['num_memleak'] @@ -1591,6 +1599,7 @@ if __name__ == "__main__": skipped_tests = stat['num_skipped'] passed_tests = stat['num_passed'] error_tests = stat['num_error'] + timeout_tests += stat['num_timeout'] failed_tests = stat['num_failed'] memleak_tests = stat['num_memleak'] @@ -1605,13 +1614,14 @@ if __name__ == "__main__": msg += f" Total number of input scripts: {total_tests}\n" msg += f" - Skipped : {skipped_tests}\n" msg += f" - Error : {error_tests}\n" + msg += f" - timeout : {timeout_tests}\n" msg += f" - Completed: {completed_tests}\n" msg += f" - failed : {failed_tests}\n" # print notice to GitHub if 'GITHUB_STEP_SUMMARY' in os.environ: with open(os.environ.get('GITHUB_STEP_SUMMARY'), 'w') as f: - print(f"Skipped: {skipped_tests} Error: {error_tests} Failed: {failed_tests} Completed: {completed_tests}", file=f) + print(f"Skipped: {skipped_tests} Error: {error_tests} Timeout: {timeout_tests} Failed: {failed_tests} Completed: {completed_tests}", file=f) if memleak_tests < completed_tests and 'valgrind' in config['mpiexec']: msg += f" - memory leak detected : {memleak_tests}\n" From 25eaf38cee331e379dfc4d125f1468b631d17c1f Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Thu, 24 Oct 2024 10:18:59 -0500 Subject: [PATCH 30/31] use the kokkos-openmp preset for brevity --- .github/workflows/kokkos-regression.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/kokkos-regression.yaml b/.github/workflows/kokkos-regression.yaml index f9215df6c6..e38c0eb742 100644 --- a/.github/workflows/kokkos-regression.yaml +++ b/.github/workflows/kokkos-regression.yaml @@ -56,14 +56,11 @@ jobs: cmake -S cmake -B build \ -C cmake/presets/gcc.cmake \ -C cmake/presets/basic.cmake \ + -D cmake/presets/kokkos-openmp.cmake \ -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ -D CMAKE_C_COMPILER_LAUNCHER=ccache \ -D BUILD_SHARED_LIBS=off \ -D DOWNLOAD_POTENTIALS=off \ - -D PKG_KOKKOS=on \ - -D Kokkos_ARCH_ARMAVX=on \ - -D Kokkos_ENABLE_OPENMP=on \ - -D Kokkos_ENABLE_CUDA=off \ -D PKG_AMOEBA=on \ -D PKG_ASPHERE=on \ -D PKG_BROWNIAN=on \ @@ -87,7 +84,6 @@ jobs: -D PKG_REPLICA=on \ -D PKG_SRD=on \ -D PKG_VORONOI=on \ - -D BUILD_OMP=yes \ -G Ninja cmake --build build ccache -s From f09a9c1c2afc69d0ec701d28a94ae52b5f7d5f4a Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Thu, 24 Oct 2024 10:26:18 -0500 Subject: [PATCH 31/31] fix typo in cmake command --- .github/workflows/kokkos-regression.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/kokkos-regression.yaml b/.github/workflows/kokkos-regression.yaml index e38c0eb742..0756b080b0 100644 --- a/.github/workflows/kokkos-regression.yaml +++ b/.github/workflows/kokkos-regression.yaml @@ -56,7 +56,7 @@ jobs: cmake -S cmake -B build \ -C cmake/presets/gcc.cmake \ -C cmake/presets/basic.cmake \ - -D cmake/presets/kokkos-openmp.cmake \ + -C cmake/presets/kokkos-openmp.cmake \ -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ -D CMAKE_C_COMPILER_LAUNCHER=ccache \ -D BUILD_SHARED_LIBS=off \