From f0639054466dd537a719ac2a1be90d802396921f Mon Sep 17 00:00:00 2001 From: Diego Tavares Date: Thu, 9 Jan 2025 10:02:47 -0800 Subject: [PATCH 1/2] Fix wrongly reported CUE_HT attribute This attribute is only used on the GUI and API to report whether a host CPU architecture is hyperthreaded or not. For some reason I couldn't get to the bottom of, this attribute was always hardcode to true. --- rqd/rqd/rqcore.py | 5 ++++- rqd/rqd/rqmachine.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/rqd/rqd/rqcore.py b/rqd/rqd/rqcore.py index 4c3a04199..5e07be1a9 100644 --- a/rqd/rqd/rqcore.py +++ b/rqd/rqd/rqcore.py @@ -735,7 +735,10 @@ def __createEnvVariables(self): self.frameEnv['CUE_THREADS'] = str(max( int(self.frameEnv['CUE_THREADS']), len(self.runFrame.attributes['CPU_LIST'].split(',')))) - self.frameEnv['CUE_HT'] = "True" + if self.rqCore.machine.getHyperthreadingMultiplier() > 1: + self.frameEnv['CUE_HT'] = "True" + else: + self.frameEnv['CUE_HT'] = "False" # Add GPU's to use all assigned GPU cores if 'GPU_LIST' in self.runFrame.attributes: diff --git a/rqd/rqd/rqmachine.py b/rqd/rqd/rqmachine.py index 8694afee4..86fa4d26b 100644 --- a/rqd/rqd/rqmachine.py +++ b/rqd/rqd/rqmachine.py @@ -441,7 +441,7 @@ def getLoadAvg(self): with open(rqd.rqconstants.PATH_LOADAVG, "r", encoding='utf-8') as loadAvgFile: loadAvg = int(float(loadAvgFile.read().split()[0]) * 100) if self.__enabledHT(): - loadAvg = loadAvg // self.__getHyperthreadingMultiplier() + loadAvg = loadAvg // self.getHyperthreadingMultiplier() loadAvg = loadAvg + rqd.rqconstants.LOAD_MODIFIER loadAvg = max(loadAvg, 0) return loadAvg @@ -893,7 +893,7 @@ def getBootReport(self): def __enabledHT(self): return 'hyperthreadingMultiplier' in self.__renderHost.attributes - def __getHyperthreadingMultiplier(self): + def getHyperthreadingMultiplier(self): return int(self.__renderHost.attributes['hyperthreadingMultiplier']) def setupTaskset(self): From 759e9f8e0ee1c7c9fbaad71b2348c30a3d395223 Mon Sep 17 00:00:00 2001 From: Diego Tavares Date: Mon, 13 Jan 2025 09:25:47 -0800 Subject: [PATCH 2/2] Fix unit tests and lint --- rqd/rqd/rqmachine.py | 4 ++++ rqd/tests/rqmachine_test.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/rqd/rqd/rqmachine.py b/rqd/rqd/rqmachine.py index 86fa4d26b..46a433571 100644 --- a/rqd/rqd/rqmachine.py +++ b/rqd/rqd/rqmachine.py @@ -894,6 +894,10 @@ def __enabledHT(self): return 'hyperthreadingMultiplier' in self.__renderHost.attributes def getHyperthreadingMultiplier(self): + """ + Multiplied used to compute the number of threads that can be allocated simultaneously + on a core + """ return int(self.__renderHost.attributes['hyperthreadingMultiplier']) def setupTaskset(self): diff --git a/rqd/tests/rqmachine_test.py b/rqd/tests/rqmachine_test.py index c74b22e80..8d7144846 100644 --- a/rqd/tests/rqmachine_test.py +++ b/rqd/tests/rqmachine_test.py @@ -328,7 +328,7 @@ def test_getLoadAvg(self): @mock.patch.object( rqd.rqmachine.Machine, '_Machine__enabledHT', new=mock.MagicMock(return_value=True)) @mock.patch.object( - rqd.rqmachine.Machine, '_Machine__getHyperthreadingMultiplier', + rqd.rqmachine.Machine, 'getHyperthreadingMultiplier', new=mock.MagicMock(return_value=2)) def test_getLoadAvgHT(self): self.loadavg.set_contents(LOADAVG_HIGH_USAGE)