From aae93506ff625bd536f22cf373bd69a33bc6e09a Mon Sep 17 00:00:00 2001
From: Jayesh Badwaik <j.badwaik@fz-juelich.de>
Date: Wed, 9 Oct 2024 23:13:55 +0200
Subject: [PATCH] + strong scaling

---
 preprocess/generator.py | 4 ++--
 simple.yml              | 4 ++--
 src/value.py            | 9 +++++++--
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/preprocess/generator.py b/preprocess/generator.py
index cdaf1c9..5648b83 100644
--- a/preprocess/generator.py
+++ b/preprocess/generator.py
@@ -13,9 +13,9 @@ if __name__ == "__main__":
     args = parser().parse_args()
     with open(args.output, "w") as f:
         if args.machine == "jurecadc":
-            f.write("24")
-        elif args.machine == "jedi": 
             f.write("12")
+        elif args.machine == "jedi": 
+            f.write("24")
         else:
             raise ValueError("Unknown machine")
         
diff --git a/simple.yml b/simple.yml
index 89e282b..3b219f5 100644
--- a/simple.yml
+++ b/simple.yml
@@ -42,13 +42,13 @@ parameterset:
     parameter:
       - name: nodes
         mode: python
-        _: '{ "jurecadc" : 2, "jedi" : 1 }["${system_name}"]'
+        _: '{ "jurecadc" : "2,4" , "jedi" : "1,2" }["${system_name}"]'
       - name: queue
         mode: python
         _: '{ "jurecadc" : "dc-cpu", "jedi" : "all" }["${system_name}"]'
       - name: preprocess
         mode: python
-        _: '{ "jurecadc" : "module load Stages/2023 && module load GCC Python/3.10.4", "jedi" : "module load GCC Python/3.11.3" }["${system_name}"]'
+        _: '{ "jurecadc" : "module load GCC Python OpenMPI mpi4py", "jedi" : "module load GCC Python OpenMPI mpi4py" }["${system_name}"]'
       - name: executable
         _: "python"
       - name: args_exec
diff --git a/src/value.py b/src/value.py
index 68e3dca..24a756b 100644
--- a/src/value.py
+++ b/src/value.py
@@ -2,6 +2,7 @@
 
 import argparse
 import random
+from mpi4py import MPI
 
 def parser():
     parser = argparse.ArgumentParser(description="Value of a number")
@@ -10,9 +11,13 @@ def parser():
     return parser
 
 if __name__ == "__main__":
+    comm = MPI.COMM_WORLD
+    nproc = comm.Get_size()
     args = parser().parse_args()
     with open(args.input, "r") as f:
         data = f.read()
-        runtime = float(data) * float(args.number) * 12
+        problem_size = float(data) * float(args.number) * 12
+        runtime = problem_size / nproc * random.uniform(0.8, 1.2)
         string = " " * random.randint(1, 10)
-        print("Runtime={}{}".format(string,runtime))
+        if comm.Get_rank() == 0:
+            print("Runtime={}{}".format(string,runtime))
-- 
GitLab