From 8ac03d359bbcbc746598e10f48449634d3ac4d25 Mon Sep 17 00:00:00 2001
From: Quentin Guilloteau <qguilloteau@fnancy>
Date: Mon, 23 Jan 2023 09:51:42 +0100
Subject: [PATCH] update to take filesize into account

---
 Snakefile          | 22 +++++++++++++++-------
 nxc/my_scripts.nix |  2 +-
 nxc/script.py      | 16 ++++++++++------
 nxc/script_ior.nix |  4 ++--
 4 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/Snakefile b/Snakefile
index d0f291c..edd0fbb 100644
--- a/Snakefile
+++ b/Snakefile
@@ -14,10 +14,18 @@ FLAVOURS = [
 ]
 
 NB_NODES = [
-    4,
-    6,
-    8,
-    16
+    #5,
+  9, 17, 25
+ # 13,
+ #17, 21, 33 , 65
+#, 25
+]
+
+BLOCK_SIZES = [
+"1M",
+"10M",
+"100M",
+"1G" 
 ]
 
 
@@ -25,7 +33,7 @@ rule all:
     input:
         # expand(["nxc/build/composition::{file}"], file=FLAVOURS),
         # expand(["{result_folder}/csv_zip/results_csv_ior_{nb_nodes}_nodes_{flavour}.zip"], result_folder=RESULT_FOLDER, flavour=FLAVOURS, nb_nodes=NB_NODES),
-        expand(["{path_here}/data/json_zip/results_ior_{nb_nodes}_nodes_{flavour}.zip"], path_here=PATH_HERE, flavour=FLAVOURS, nb_nodes=NB_NODES),
+        expand(["{path_here}/data/json_zip/results_ior_{nb_nodes}_nodes_{block_size}_block_size_{flavour}.zip"], path_here=PATH_HERE, flavour=FLAVOURS, nb_nodes=NB_NODES, block_size=BLOCK_SIZES),
         # expand(["{result_folder}/csv/{nb_nodes}_{flavour}.csv"], result_folder=RESULT_FOLDER, flavour=FLAVOURS, nb_nodes=NB_NODES)
         # expand(["data/repeat/iter_{iter}/csv_zip/results_csv_ior_{nb_nodes}_nodes_{flavour}.zip"], iter=[1, 2, 3, 4, 5], nb_nodes=8, flavour=FLAVOURS),
         # expand(["data/repeat/iter_{iter}/csv/{nb_nodes}_{flavour}.csv"], iter=[1, 2, 3, 4, 5], nb_nodes=8, flavour=FLAVOURS),
@@ -50,9 +58,9 @@ rule run_ior:
     input:
         "nxc/build/composition::{flavour}"
     output:
-        "{PATH_HERE}/data/json_zip/results_ior_{nb_nodes}_nodes_{flavour}.zip"
+        "{PATH_HERE}/data/json_zip/results_ior_{nb_nodes}_nodes_{block_size}_block_size_{flavour}.zip"
     shell:
-        "cd nxc; nix develop --command python3 script.py --nxc_build_file {PATH_HERE}/{input} --nb_nodes {wildcards.nb_nodes} --result_dir {RESULT_FOLDER} --flavour {wildcards.flavour} --outfile {output} --walltime 2"
+        "cd nxc; nix develop --command python3 script.py --nxc_build_file {PATH_HERE}/{input} --nb_nodes {wildcards.nb_nodes} --block_size {wildcards.block_size} --result_dir {RESULT_FOLDER} --flavour {wildcards.flavour} --outfile {output} --walltime 5"
 
 rule json_to_csv:
     input:
diff --git a/nxc/my_scripts.nix b/nxc/my_scripts.nix
index 51600b7..2dbe6a6 100644
--- a/nxc/my_scripts.nix
+++ b/nxc/my_scripts.nix
@@ -41,6 +41,6 @@ in {
 
       cat /etc/hosts | grep node | head -n $NB_NODES | awk -v nb_slots="$NB_SLOTS_PER_NODE" '{ print $2 " slots=" nb_slots;}' > my_hosts
 
-      mpirun --allow-run-as-root --oversubscribe -mca btl self,vader -np $TOTAL_NB_NODES --hostfile my_hosts ior -f ${iorConfigPerCluster}
+      mpirun --allow-run-as-root --oversubscribe --mca btl ^openib -np $TOTAL_NB_NODES --hostfile my_hosts ior -f ${iorConfigPerCluster}
     '';
 }
diff --git a/nxc/script.py b/nxc/script.py
index d16b431..1d27d67 100644
--- a/nxc/script.py
+++ b/nxc/script.py
@@ -15,6 +15,7 @@ class MyEngine(Engine):
         parser = self.args_parser
         parser.add_argument('--nxc_build_file', help='Path to the NXC deploy file')
         parser.add_argument('--nb_nodes', help='Number of nodes')
+        parser.add_argument('--block_size', help='Size of the file to write')
         parser.add_argument('--walltime', help='walltime in hours')
         parser.add_argument('--result_dir', help='where to store results')
         parser.add_argument('--flavour', help='Flavour')
@@ -31,8 +32,10 @@ class MyEngine(Engine):
         self.flavour = self.args.flavour if self.args.flavour else "g5k-image"
 
 
-        site = "grenoble"
-        cluster = "dahu"
+        site = "nancy"
+        cluster = "gros"
+        # site = "grenoble"
+        # cluster = "dahu"
 
         oar_job = reserve_nodes(self.nb_nodes, site, cluster, "deploy" if self.flavour == "g5k-image" else "allow_classic_ssh",  walltime=walltime_hours*60*60)
         self.oar_job_id, site = oar_job[0]
@@ -49,15 +52,16 @@ class MyEngine(Engine):
 
     def run(self):
         result_dir = self.args.result_dir if self.args.result_dir else os.getcwd()
+        block_size = self.args.block_size if self.args.block_size else "1G"
 
-        zip_archive_name = f"{result_dir}/results_ior_{self.nb_nodes}_nodes_{self.flavour}"
+        zip_archive_name = f"{result_dir}/results_ior_{self.nb_nodes}_nodes_{block_size}_block_size_{self.flavour}"
         outfile = self.args.outfile[:-4] if self.args.outfile else zip_archive_name
 
-        folder_name = f"{result_dir}/expe_nfs_{self.flavour}_{self.nb_nodes}"
+        folder_name = f"{result_dir}/expe_nfs_{self.flavour}_{self.nb_nodes}_{block_size}"
         create_folder(folder_name)
 
         logger.info("Generating IOR config")
-        run_ior_config_remote = Remote(f"generate_ior_config {self.nb_nodes - 1}", self.nodes["node"][0], connection_params={'user': 'root'})
+        run_ior_config_remote = Remote(f"generate_ior_config {self.nb_nodes - 1} {block_size}", self.nodes["node"][0], connection_params={'user': 'root'})
         run_ior_config_remote.run()
 
         for nb_node in range(self.nb_nodes - 1, 0, -1):
@@ -86,7 +90,7 @@ class MyEngine(Engine):
         remove_folder(folder_name)
 
         logger.info(f"Giving back the resources")
-        oardel([(self.oar_job_id, "grenoble")])
+        oardel([(self.oar_job_id, "nancy")])
 
 def reserve_nodes(nb_nodes, site, cluster, job_type, walltime=3600):
     jobs = oarsub([(OarSubmission("{{cluster='{}'}}/nodes={}".format(cluster, nb_nodes), walltime, job_type=[job_type]), site)])
diff --git a/nxc/script_ior.nix b/nxc/script_ior.nix
index 590c304..02a01fe 100644
--- a/nxc/script_ior.nix
+++ b/nxc/script_ior.nix
@@ -40,8 +40,8 @@ IOR START
 
     repetitions=5
     numTasks=${builtins.toString numTasks}
-    segmentCount=4
-    blockSize=128M
+    segmentCount=1
+    blockSize=1G
     transferSize=4M
 
     summaryFile=/data/results_ior.json
-- 
GitLab