revert to building with basic.cmake preset and manually include packages, refactor the get_kokkos_input script

This commit is contained in:
Trung Nguyen
2024-10-11 15:36:18 -05:00
parent e9ff0d3402
commit b960cb213f
2 changed files with 51 additions and 164 deletions

View File

@ -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

View File

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