Skip to contentSkip to conversation

rteval: kcompile: Use systopology to get a list of cpus on a node

PATCH In review John Kacur 2 participants 3 messages Apr 29, 2022 – May 3, 2022

lore
Share & tools
lore

John Kacur

author
#0 lore raw

PATCH 1/1 rteval: kcompile: Use systopology to get a list of cpus on a node

kcompile gets a lists of cpus on a node but doesn't take into account whether the cpus are online or not.

Instead of using the method in kcompile, use the method in systopology, since that will consider whether the cpus are online or not.

---
 rteval/modules/loads/kcompile.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
rteval/modules/loads/kcompile.py +1 -1
index 367f8dc1ca86..add0cd86cde4 100644
@@ -202,7 +202,7 @@ class Kcompile(CommandLineLoad):
         self.cpus = {}
         self.nodes = self.topology.getnodes()
         for n in self.nodes:
-            self.cpus[n] = [int(c.split('/')[-1][3:]) for c in glob.glob('/sys/devices/system/node/node%s/cpu[0-9]*' % n)]
+            self.cpus[n] = self.topology.getcpus(n)
             self.cpus[n].sort()
 
             # if a cpulist was specified, only allow cpus in that list on the node
Signature · 1 line
2.35.1
Tested-by on v1 1/1
#1 lore raw
Quoted 8 lines · John Kacur

kcompile gets a lists of cpus on a node but doesn't take into account whether the cpus are online or not.

Instead of using the method in kcompile, use the method in systopology, since that will consider whether the cpus are online or not.

Quoted 19 lines
---
 rteval/modules/loads/kcompile.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
rteval/modules/loads/kcompile.py +1 -2
index 367f8dc1ca86..add0cd86cde4 100644
@@ -202,7 +202,7 @@ class Kcompile(CommandLineLoad):
         self.cpus = {}
         self.nodes = self.topology.getnodes()
         for n in self.nodes:
-            self.cpus[n] = [int(c.split('/')[-1][3:]) for c in glob.glob('/sys/devices/system/node/node%s/cpu[0-9]*' % n)]
+            self.cpus[n] = self.topology.getcpus(n)
             self.cpus[n].sort()
 
             # if a cpulist was specified, only allow cpus in that list on the node
--

2.35.1

author
#2 lore raw
Quoted 28 lines · Valentin Schneider
Quoted 8 lines · John Kacur

kcompile gets a lists of cpus on a node but doesn't take into account whether the cpus are online or not.

Instead of using the method in kcompile, use the method in systopology, since that will consider whether the cpus are online or not.

Quoted 16 lines
---
 rteval/modules/loads/kcompile.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
rteval/modules/loads/kcompile.py +1 -1
index 367f8dc1ca86..add0cd86cde4 100644
@@ -202,7 +202,7 @@ class Kcompile(CommandLineLoad):
         self.cpus = {}
         self.nodes = self.topology.getnodes()
         for n in self.nodes:
-            self.cpus[n] = [int(c.split('/')[-1][3:]) for c in glob.glob('/sys/devices/system/node/node%s/cpu[0-9]*' % n)]
+            self.cpus[n] = self.topology.getcpus(n)
             self.cpus[n].sort()
 
Quoted 5 lines
Quoted 3 lines
rteval/modules/loads/kcompile.py +0 -1
             # if a cpulist was specified, only allow cpus in that list on the node
--

2.35.1

I added your Tested-by: to the commit.

Thanks for testing!

John