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")