Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
generate_test_script.py 1.18 KiB
# Script to generate the test script :P 
import socket, psutil
import numpy as np

amount_of_cores = psutil.cpu_count(logical=False)
amount_of_cpus = psutil.cpu_count()
hostname = socket.gethostname()

if amount_of_cpus <= 4:
    stepsize = 1
elif 4 < amount_of_cpus <= 24:
    stepsize = 2
elif 24 < amount_of_cpus <= 48:
    stepsize = 4



# Generate the lines to run
with open('run_tests_{}.sh'.format(hostname), 'w') as f:
    command = ""
    for cpu_count in np.arange(stepsize, amount_of_cpus + stepsize, stepsize):

        command += "python3 evolve_population_comparing_with_multiprocessing.py 10 10 {} {}\n".format(cpu_count, hostname)
        command += "python3 evolve_population_comparing_with_multiprocessing.py 20 20 {} {}\n".format(cpu_count, hostname)
        command += "python3 evolve_population_comparing_with_multiprocessing.py 25 25 {} {}\n".format(cpu_count, hostname)
        command += "python3 evolve_population_comparing_with_multiprocessing.py 35 35 {} {}\n".format(cpu_count, hostname)
        command += "python3 evolve_population_comparing_with_multiprocessing.py 50 50 {} {}\n".format(cpu_count, hostname)

        command += "\n"

        f.write(command)
        command = ""