Skip to content
Snippets Groups Projects
Commit b5c286d3 authored by Michael Reuscher's avatar Michael Reuscher
Browse files

Simrunner 1.01 now different sets of tests parameter available

parent 0a651807
No related branches found
No related tags found
2 merge requests!4Python driver and data analysis part,!2Threading fix
...@@ -4,19 +4,39 @@ import subprocess ...@@ -4,19 +4,39 @@ import subprocess
def start_cpp_program(program_path, arguments): def start_cpp_program(program_path, arguments):
command = [program_path] + arguments command = [program_path] + arguments
process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE) process = subprocess.run(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
return process return process
def send_input(program_path, arguments): def send_input(program_path, arg):
command = [program_path] + arguments command = [program_path] + arg
process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE) process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
output = process.stdout.readline().decode() stdout, stderr = process.communicate()
return output return stdout.decode()
data_config = {
"s": ["1M", "2M", "3M"], #Size
"n": ["30", "10", "20"], #nEvents
"i": ["0.1", "0.2", "0.3"], #interval
"N": ["4", "4", "4"] #UsedThreads
# Beispielverwendung }
data_size = ["1M", "2M"]
skript_path = os.path.abspath(__file__)
main_folder = os.path.dirname(os.path.dirname(skript_path))
data_path = os.path.join(main_folder, "protokoll")
cpp_program_path = os.path.join(os.path.dirname(__file__), "../build/src/detsim") cpp_program_path = os.path.join(os.path.dirname(__file__), "../build/src/detsim")
arguments = ["-o", "output", "--posixDataDir", "protokoll", "-n", "100", "-s", "2M", "-i", "0.1s", "-N", "4"] os.makedirs(data_path, mode=0o777, exist_ok=True)
send_input(cpp_program_path, arguments) for data_set in range(len(data_config["s"])):
size = data_config["s"][data_set]
nEvents = data_config["n"][data_set]
interval = data_config["i"][data_set]
threads = data_config["N"][data_set]
folder_name = data_config["s"][data_set]
relativ_path = os.path.join(main_folder, "output1", folder_name)
os.makedirs(relativ_path, mode=0o777, exist_ok=True)
arguments = ["-o", relativ_path, "--posixDataDir", "protokoll", "-n", nEvents, "-s", size, "-i", interval, "-N", threads]
output = start_cpp_program(cpp_program_path, arguments)
print(output)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment