From 87692c184abcbfe2ce539efcd9d40e1376de0dd7 Mon Sep 17 00:00:00 2001
From: jgatt <jolyne.gatt@irit.fr>
Date: Wed, 19 Jul 2023 13:50:49 +0200
Subject: [PATCH] reduce use of rounding in reconfig_job + explicit double
 conversion

---
 src/users/response_behaviors.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/users/response_behaviors.cpp b/src/users/response_behaviors.cpp
index 61162fa..d9a32d4 100644
--- a/src/users/response_behaviors.cpp
+++ b/src/users/response_behaviors.cpp
@@ -56,7 +56,15 @@ bool reconfig_job(shared_ptr<Job> job, Profile *profile, double alpha,
      *          => T_n = (orig_nb_core / n)^alpha * T_orig
      */
     long T_orig = std::stol(job->profile);
-    long T_n = pow((double)orig_nb_core / n, alpha) * T_orig;
+    long T_n;
+    if (orig_nb_core%n != 0 || alpha != 1.0)
+    {
+         T_n =(long) (( pow((double)orig_nb_core / n, alpha) )* (double) T_orig);
+    }
+    else
+    {
+         T_n = orig_nb_core/n *T_orig;
+    }
     Parser::profile_from_duration(
         profile, std::to_string(T_n), user->user_name); // parallel_homogeneous
     job->nb_requested_resources = n;
-- 
GitLab