split randomly the pair input list by batch size

This commit is contained in:
Trung Nguyen
2024-10-27 00:00:10 -05:00
parent 67d1c7d17d
commit dd0dfd3c7f
2 changed files with 14 additions and 10 deletions

View File

@ -83,6 +83,7 @@ jobs:
-D PKG_REAXFF=on \
-D PKG_REPLICA=on \
-D PKG_SRD=on \
-D PKG_SPH=on \
-D PKG_VORONOI=on \
-G Ninja
cmake --build build
@ -93,8 +94,8 @@ jobs:
run: |
source linuxenv/bin/activate
python3 tools/regression-tests/get_kokkos_input.py \
--examples-top-level=examples --batch-size=100 \
--filter-out="balance;fire;gcmc;granregion;mdi;mliap;neb;pace;prd;pour;python;snap"
--examples-top-level=examples --batch-size=50 \
--filter-out="balance;fire;gcmc;granregion;hyper;mc;mdi;mliap;neb;pace;prd;pour;python;rigid;snap;streitz;shear;ttm"
cat input-list-fix-*-kk.txt > input-list-fix-kk.txt
export OMP_PROC_BIND=false

View File

@ -7,6 +7,7 @@
# These 4 files will be read in by the regression tester run_tests.py
from argparse import ArgumentParser
import random
import subprocess
import sys
@ -68,7 +69,7 @@ if __name__ == "__main__":
input_list = []
generate_list(feature, example_toplevel, filter_out, input_list)
num_batches = int((len(input_list) + batch_size - 1) / batch_size)
num_batches = int(len(input_list) / batch_size)
if num_batches < 2:
with open(f"input-list-{feature}-kk.txt", "w") as f:
for input in input_list:
@ -77,13 +78,15 @@ if __name__ == "__main__":
else:
for idx in range(num_batches):
with open(f"input-list-{feature}-{idx}-kk.txt", "w") as f:
start = idx * batch_size
for i in range(batch_size):
if start + i < len(input_list):
input = input_list[start + i]
if input != "":
f.write(f"{input}\n")
if len(input_list) > batch_size:
sampled = random.sample(input_list, batch_size)
else:
sampled = input_list
for input in sampled:
if input != "":
if input in input_list:
input_list.remove(input)
f.write(f"{input}\n")
# 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' ]