Changed indentation

This commit is contained in:
Trung Nguyen
2024-07-09 08:22:37 -05:00
parent 170c12d5df
commit a72cffd198

View File

@ -13,6 +13,9 @@ UPDATE: July 5, 2024:
+ simplify the build configuration (no need to build the Python module) + simplify the build configuration (no need to build the Python module)
+ specify tolerances for individual quantities for any input script to override the global values + specify tolerances for individual quantities for any input script to override the global values
TODO:
+ distribute the input list across multiple processes via multiprocessing
Example usage: Example usage:
1) Simple use (using the provided tools/regression-tests/config.yaml and the examples/ folder at the top level) 1) Simple use (using the provided tools/regression-tests/config.yaml and the examples/ folder at the top level)
python3 run_tests.py --lmp-bin=/path/to/lmp_binary python3 run_tests.py --lmp-bin=/path/to/lmp_binary
@ -134,7 +137,7 @@ def extract_data_to_yaml(inputFileName):
docs += "]\n" docs += "]\n"
# load the docs into a YAML data struture # load the docs into a YAML data struture
#print(docs)
try: try:
yaml_struct = yaml.load_all(docs, Loader=Loader) yaml_struct = yaml.load_all(docs, Loader=Loader)
thermo = list(yaml_struct) thermo = list(yaml_struct)
@ -157,20 +160,20 @@ def get_lammps_build_configuration(lmp_binary):
packages = "" packages = ""
reading = False reading = False
row = 0 row = 0
for l in output: for line in output:
if l != "": if line != "":
if l == "Installed packages:": if line == "Installed packages:":
reading = True reading = True
n = row n = row
if "List of individual style options" in l: if "List of individual style options" in line:
reading = False reading = False
if reading == True and row > n: if reading == True and row > n:
packages += l.strip() + " " packages += line.strip() + " "
if "OS:" in l: if "OS:" in line:
operating_system = l operating_system = line
if "Git info" in l: if "Git info" in line:
GitInfo = l GitInfo = line
row += 1 row += 1
@ -178,10 +181,10 @@ def get_lammps_build_configuration(lmp_binary):
row = 0 row = 0
compile_flags = "" compile_flags = ""
for l in output: for line in output:
if l != "": if line != "":
if "-DLAMMPS" in l: if "-DLAMMPS" in line:
compile_flags += " " + l.strip() compile_flags += " " + line.strip()
row += 1 row += 1
@ -333,25 +336,25 @@ def iterate(lmp_binary, input_list, config, results, removeAnnotatedInput=False)
# restore the nprocs value in the configuration # restore the nprocs value in the configuration
config['nprocs'] = saved_nprocs config['nprocs'] = saved_nprocs
# process thermo output # process error code from the run
if returncode != 0: if returncode != 0:
print(f"ERROR: Failed with {input_test}. Check the log file for the run output.\n") print(f"ERROR: Failed with {input_test}. Check the log file for the run output.\n")
logger.info(f"\n{error}") logger.info(f"\n{error}")
continue continue
# process thermo output
thermo = extract_data_to_yaml("log.lammps") thermo = extract_data_to_yaml("log.lammps")
num_runs = len(thermo) num_runs = len(thermo)
if num_runs == 0: if num_runs == 0:
print(f"ERROR: Failed with {input_test}. Check the log file for the run output.\n") print(f"ERROR: Failed with {input_test}. Check the log file for the run output.\n")
#print(f"{output}")
logger.info(f"The run terminated with the following output:\n") logger.info(f"The run terminated with the following output:\n")
logger.info(f"\n{output}") logger.info(f"\n{output}")
result.status = "error" result.status = "error"
results.append(result) results.append(result)
continue continue
print(f"Comparing thermo output from log.lammps with the reference log file {thermo_ref_file}") print(f"Comparing thermo output from log.lammps against the reference log file {thermo_ref_file}")
if num_runs != num_runs_ref: if num_runs != num_runs_ref:
print(f"ERROR: Number of runs in log.lammps ({num_runs}) is not the same as that in the reference log ({num_runs_ref})") print(f"ERROR: Number of runs in log.lammps ({num_runs}) is not the same as that in the reference log ({num_runs_ref})")
result.status = "error" result.status = "error"
@ -606,6 +609,7 @@ if __name__ == "__main__":
example_subfolders.append('../../examples/srd') example_subfolders.append('../../examples/srd')
all_results = [] all_results = []
# default setting
if inplace_input == True: if inplace_input == True:
# save current working dir # save current working dir