From 192ce1491e946fab2e5c83ba351edbe9236c485d Mon Sep 17 00:00:00 2001
From: David Hendriks <davidhendriks93@gmail.com>
Date: Tue, 11 Feb 2020 12:36:31 +0000
Subject: [PATCH] added script to automatically generate the tests

---
 .../scaling/generate_test_script.py           | 32 +++++++++++++++++++
 ...n_tests_david-Lenovo-IdeaPad-S340-14IWL.sh | 24 ++++++++++++++
 ...result_david-Lenovo-IdeaPad-S340-14IWL.dat |  1 +
 3 files changed, 57 insertions(+)
 create mode 100644 tests/population/scaling/generate_test_script.py
 create mode 100755 tests/population/scaling/run_tests_david-Lenovo-IdeaPad-S340-14IWL.sh

diff --git a/tests/population/scaling/generate_test_script.py b/tests/population/scaling/generate_test_script.py
new file mode 100644
index 000000000..46bc6357a
--- /dev/null
+++ b/tests/population/scaling/generate_test_script.py
@@ -0,0 +1,32 @@
+# 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 = ""
diff --git a/tests/population/scaling/run_tests_david-Lenovo-IdeaPad-S340-14IWL.sh b/tests/population/scaling/run_tests_david-Lenovo-IdeaPad-S340-14IWL.sh
new file mode 100755
index 000000000..eba29c977
--- /dev/null
+++ b/tests/population/scaling/run_tests_david-Lenovo-IdeaPad-S340-14IWL.sh
@@ -0,0 +1,24 @@
+python3 evolve_population_comparing_with_multiprocessing.py 10 10 1 david-Lenovo-IdeaPad-S340-14IWL
+python3 evolve_population_comparing_with_multiprocessing.py 20 20 1 david-Lenovo-IdeaPad-S340-14IWL
+python3 evolve_population_comparing_with_multiprocessing.py 25 25 1 david-Lenovo-IdeaPad-S340-14IWL
+python3 evolve_population_comparing_with_multiprocessing.py 35 35 1 david-Lenovo-IdeaPad-S340-14IWL
+python3 evolve_population_comparing_with_multiprocessing.py 50 50 1 david-Lenovo-IdeaPad-S340-14IWL
+
+python3 evolve_population_comparing_with_multiprocessing.py 10 10 2 david-Lenovo-IdeaPad-S340-14IWL
+python3 evolve_population_comparing_with_multiprocessing.py 20 20 2 david-Lenovo-IdeaPad-S340-14IWL
+python3 evolve_population_comparing_with_multiprocessing.py 25 25 2 david-Lenovo-IdeaPad-S340-14IWL
+python3 evolve_population_comparing_with_multiprocessing.py 35 35 2 david-Lenovo-IdeaPad-S340-14IWL
+python3 evolve_population_comparing_with_multiprocessing.py 50 50 2 david-Lenovo-IdeaPad-S340-14IWL
+
+python3 evolve_population_comparing_with_multiprocessing.py 10 10 3 david-Lenovo-IdeaPad-S340-14IWL
+python3 evolve_population_comparing_with_multiprocessing.py 20 20 3 david-Lenovo-IdeaPad-S340-14IWL
+python3 evolve_population_comparing_with_multiprocessing.py 25 25 3 david-Lenovo-IdeaPad-S340-14IWL
+python3 evolve_population_comparing_with_multiprocessing.py 35 35 3 david-Lenovo-IdeaPad-S340-14IWL
+python3 evolve_population_comparing_with_multiprocessing.py 50 50 3 david-Lenovo-IdeaPad-S340-14IWL
+
+python3 evolve_population_comparing_with_multiprocessing.py 10 10 4 david-Lenovo-IdeaPad-S340-14IWL
+python3 evolve_population_comparing_with_multiprocessing.py 20 20 4 david-Lenovo-IdeaPad-S340-14IWL
+python3 evolve_population_comparing_with_multiprocessing.py 25 25 4 david-Lenovo-IdeaPad-S340-14IWL
+python3 evolve_population_comparing_with_multiprocessing.py 35 35 4 david-Lenovo-IdeaPad-S340-14IWL
+python3 evolve_population_comparing_with_multiprocessing.py 50 50 4 david-Lenovo-IdeaPad-S340-14IWL
+
diff --git a/tests/population/scaling/scaling_results/comparison_result_david-Lenovo-IdeaPad-S340-14IWL.dat b/tests/population/scaling/scaling_results/comparison_result_david-Lenovo-IdeaPad-S340-14IWL.dat
index 81ae05378..702d34645 100644
--- a/tests/population/scaling/scaling_results/comparison_result_david-Lenovo-IdeaPad-S340-14IWL.dat
+++ b/tests/population/scaling/scaling_results/comparison_result_david-Lenovo-IdeaPad-S340-14IWL.dat
@@ -1,2 +1,3 @@
 (2, 225, 23.872895002365112, 17.51114845275879, 1.3632969343369403)
 (2, 625, 76.88419461250305, 63.15470623970032, 1.2173945409656914)
+(1, 100, 18.417582511901855, 19.06265616416931, 0.9661603479225548)
-- 
GitLab