Skip to contentSkip to conversation

rteval: Handle isolcpus correctly

PATCH In review Tomas Glozar 2 participants 14 messages Jun 30, 2023 – Jul 25, 2023

lore
Share & tools
lore
#0 lore raw

cover rteval: Handle isolcpus correctly

This is a patch set that enables rteval to do load calculations and reporting correctly on systems with isolated CPUs.

Tomas Glozar (6):
rteval: Detect isolcpus in systopology
rteval: Report isolated CPUs
rteval: Exclude isolcpus from kcompile by default
rteval: Exclude isolcpus from stressng by default
rteval: Fix CPU count calculation for hackbench
rteval: Exclude isolcpus from loads report

 rteval/modules/loads/__init__.py       |  2 +-
 rteval/modules/loads/hackbench.py      |  6 +++-
 rteval/modules/loads/kcompile.py       |  8 +++--
 rteval/modules/loads/stressng.py       |  5 +++
 rteval/modules/measurement/__init__.py |  2 +-
 rteval/rteval_text.xsl                 |  4 +++
 rteval/sysinfo/cputopology.py          | 11 +++++++
 rteval/systopology.py                  | 43 ++++++++++++++++++++++++++
 8 files changed, 76 insertions(+), 5 deletions(-)
Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/6 rteval: Detect isolcpus in systopology

Works similarly to online_cpus:
- add CpuList.isolated_cpulist to filter isolated CPUs
- add SysTopology.isolated_cpus to get list of isolated CPUs
- add CpuList.nonisolated_cpulist to do the opposite filter
- add SysTopology.default_cpus to get CPUs that are used for scheduling by default, i.e. online and non-isolated CPUs

---
 rteval/systopology.py | 47 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
rteval/systopology.py +47 -0
index c8f85c5..19443f9 100644
@@ -127,6 +127,11 @@ class CpuList:
             return True
         return False
 
+    @staticmethod
+    def isolated_file_exists():
+        """ Check whether machine / kernel is configured with isolated file """
+        return os.path.exists(os.path.join(CpuList.cpupath, "isolated"))
+
     @staticmethod
     def longest_sequence(cpulist):
         """ return index of last element of a sequence that steps by one """
@@ -214,6 +219,24 @@ class CpuList:
                 newlist.append(cpu)
         return newlist
 
+    @staticmethod
+    def isolated_cpulist(cpulist):
+        """Given a cpulist, return a cpulist of isolated CPUs"""
+        if not CpuList.isolated_file_exists():
+            return cpulist
+        isolated_cpulist = sysread(CpuList.cpupath, "isolated")
+        isolated_cpulist = CpuList.expand_cpulist(isolated_cpulist)
+        return list(set(isolated_cpulist) & set(cpulist))
+
+    @staticmethod
+    def nonisolated_cpulist(cpulist):
+        """Given a cpulist, return a cpulist of non-isolated CPUs"""
+        if not CpuList.isolated_file_exists():
+            return cpulist
+        isolated_cpulist = sysread(CpuList.cpupath, "isolated")
+        isolated_cpulist = CpuList.expand_cpulist(isolated_cpulist)
+        return list(set(cpulist).difference(set(isolated_cpulist)))
+
 #
 # class to abstract access to NUMA nodes in /sys filesystem
 #
@@ -362,11 +385,35 @@ class SysTopology:
         cpulist.sort()
         return cpulist
 
+    def isolated_cpus(self):
+        """ return a list of integers of all isolated cpus """
+        cpulist = []
+        for n in self.nodes:
+            cpulist += CpuList.isolated_cpulist(self.getcpus(n))
+        cpulist.sort()
+        return cpulist
+
+    def default_cpus(self):
+        """ return a list of integers of all default schedulable cpus, i.e. online non-isolated cpus """
+        cpulist = []
+        for n in self.nodes:
+            cpulist += CpuList.nonisolated_cpulist(self.getcpus(n))
+        cpulist.sort()
+        return cpulist
+
     def online_cpus_str(self):
         """ return a list of strings of numbers of all online cpus """
         cpulist = [str(cpu) for cpu in self.online_cpus()]
         return cpulist
 
+    def isolated_cpus_str(self):
+        cpulist = [str(cpu) for cpu in self.isolated_cpus()]
+        return cpulist
+
+    def default_cpus_str(self):
+        cpulist = [str(cpu) for cpu in self.default_cpus()]
+        return cpulist
+
     def invert_cpulist(self, cpulist):
         """ return a list of online cpus not in cpulist """
         return [c for c in self.online_cpus() if c not in cpulist]
Signature · 1 line
2.41.0
#2 lore raw

Re: [PATCH 1/6] rteval: Detect isolcpus in systopology

Quoted 93 lines · Tomas Glozar

Works similarly to online_cpus:
- add CpuList.isolated_cpulist to filter isolated CPUs
- add SysTopology.isolated_cpus to get list of isolated CPUs
- add CpuList.nonisolated_cpulist to do the opposite filter
- add SysTopology.default_cpus to get CPUs that are used for scheduling by default, i.e. online and non-isolated CPUs

---
 rteval/systopology.py | 47 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
rteval/systopology.py +47 -0
index c8f85c5..19443f9 100644
@@ -127,6 +127,11 @@ class CpuList:
             return True
         return False
 
+    @staticmethod
+    def isolated_file_exists():
+        """ Check whether machine / kernel is configured with isolated file """
+        return os.path.exists(os.path.join(CpuList.cpupath, "isolated"))
+
     @staticmethod
     def longest_sequence(cpulist):
         """ return index of last element of a sequence that steps by one """
@@ -214,6 +219,24 @@ class CpuList:
                 newlist.append(cpu)
         return newlist
 
+    @staticmethod
+    def isolated_cpulist(cpulist):
+        """Given a cpulist, return a cpulist of isolated CPUs"""
+        if not CpuList.isolated_file_exists():
+            return cpulist
+        isolated_cpulist = sysread(CpuList.cpupath, "isolated")
+        isolated_cpulist = CpuList.expand_cpulist(isolated_cpulist)
+        return list(set(isolated_cpulist) & set(cpulist))
+
+    @staticmethod
+    def nonisolated_cpulist(cpulist):
+        """Given a cpulist, return a cpulist of non-isolated CPUs"""
+        if not CpuList.isolated_file_exists():
+            return cpulist
+        isolated_cpulist = sysread(CpuList.cpupath, "isolated")
+        isolated_cpulist = CpuList.expand_cpulist(isolated_cpulist)
+        return list(set(cpulist).difference(set(isolated_cpulist)))
+
 #
 # class to abstract access to NUMA nodes in /sys filesystem
 #
@@ -362,11 +385,35 @@ class SysTopology:
         cpulist.sort()
         return cpulist
 
+    def isolated_cpus(self):
+        """ return a list of integers of all isolated cpus """
+        cpulist = []
+        for n in self.nodes:
+            cpulist += CpuList.isolated_cpulist(self.getcpus(n))
+        cpulist.sort()
+        return cpulist
+
+    def default_cpus(self):
+        """ return a list of integers of all default schedulable cpus, i.e. online non-isolated cpus """
+        cpulist = []
+        for n in self.nodes:
+            cpulist += CpuList.nonisolated_cpulist(self.getcpus(n))
+        cpulist.sort()
+        return cpulist
+
     def online_cpus_str(self):
         """ return a list of strings of numbers of all online cpus """
         cpulist = [str(cpu) for cpu in self.online_cpus()]
         return cpulist
 
+    def isolated_cpus_str(self):
+        cpulist = [str(cpu) for cpu in self.isolated_cpus()]
+        return cpulist
+
+    def default_cpus_str(self):
+        cpulist = [str(cpu) for cpu in self.default_cpus()]
+        return cpulist
+
     def invert_cpulist(self, cpulist):
         """ return a list of online cpus not in cpulist """
         return [c for c in self.online_cpus() if c not in cpulist]
Signature · 1 line
2.41.0

--
The code is good, but I don't love the name "default_cpus", but it will do. isolated_cpus_str() and default_cpus_str() require docstrings. I'm signing off on this to move it forward so please send that in a separate patch.

#3 lore raw

Re: [PATCH 1/6] rteval: Detect isolcpus in systopology

In reply to Tomas Glozar
Quoted 93 lines · Tomas Glozar

Works similarly to online_cpus:
- add CpuList.isolated_cpulist to filter isolated CPUs
- add SysTopology.isolated_cpus to get list of isolated CPUs
- add CpuList.nonisolated_cpulist to do the opposite filter
- add SysTopology.default_cpus to get CPUs that are used for scheduling by default, i.e. online and non-isolated CPUs

---
 rteval/systopology.py | 47 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
rteval/systopology.py +47 -0
index c8f85c5..19443f9 100644
@@ -127,6 +127,11 @@ class CpuList:
             return True
         return False
 
+    @staticmethod
+    def isolated_file_exists():
+        """ Check whether machine / kernel is configured with isolated file """
+        return os.path.exists(os.path.join(CpuList.cpupath, "isolated"))
+
     @staticmethod
     def longest_sequence(cpulist):
         """ return index of last element of a sequence that steps by one """
@@ -214,6 +219,24 @@ class CpuList:
                 newlist.append(cpu)
         return newlist
 
+    @staticmethod
+    def isolated_cpulist(cpulist):
+        """Given a cpulist, return a cpulist of isolated CPUs"""
+        if not CpuList.isolated_file_exists():
+            return cpulist
+        isolated_cpulist = sysread(CpuList.cpupath, "isolated")
+        isolated_cpulist = CpuList.expand_cpulist(isolated_cpulist)
+        return list(set(isolated_cpulist) & set(cpulist))
+
+    @staticmethod
+    def nonisolated_cpulist(cpulist):
+        """Given a cpulist, return a cpulist of non-isolated CPUs"""
+        if not CpuList.isolated_file_exists():
+            return cpulist
+        isolated_cpulist = sysread(CpuList.cpupath, "isolated")
+        isolated_cpulist = CpuList.expand_cpulist(isolated_cpulist)
+        return list(set(cpulist).difference(set(isolated_cpulist)))
+
 #
 # class to abstract access to NUMA nodes in /sys filesystem
 #
@@ -362,11 +385,35 @@ class SysTopology:
         cpulist.sort()
         return cpulist
 
+    def isolated_cpus(self):
+        """ return a list of integers of all isolated cpus """
+        cpulist = []
+        for n in self.nodes:
+            cpulist += CpuList.isolated_cpulist(self.getcpus(n))
+        cpulist.sort()
+        return cpulist
+
+    def default_cpus(self):
+        """ return a list of integers of all default schedulable cpus, i.e. online non-isolated cpus """
+        cpulist = []
+        for n in self.nodes:
+            cpulist += CpuList.nonisolated_cpulist(self.getcpus(n))
+        cpulist.sort()
+        return cpulist
+
     def online_cpus_str(self):
         """ return a list of strings of numbers of all online cpus """
         cpulist = [str(cpu) for cpu in self.online_cpus()]
         return cpulist
 
+    def isolated_cpus_str(self):
+        cpulist = [str(cpu) for cpu in self.isolated_cpus()]
+        return cpulist
+
+    def default_cpus_str(self):
+        cpulist = [str(cpu) for cpu in self.default_cpus()]
+        return cpulist
+
     def invert_cpulist(self, cpulist):
         """ return a list of online cpus not in cpulist """
         return [c for c in self.online_cpus() if c not in cpulist]
Signature · 1 line
2.41.0
#4 lore raw

PATCH 2/6 rteval: Report isolated CPUs

In reply to Tomas Glozar

Add a flag for whether a CPU is isolated in CPUtopology and display the number of isolated CPUs in text report.

---
 rteval/rteval_text.xsl        |  4 ++++
 rteval/sysinfo/cputopology.py | 11 +++++++++++
 2 files changed, 15 insertions(+)
rteval/rteval_text.xsl +4 -0
index 7ecfac6..0ef649b 100644
@@ -59,6 +59,10 @@
 	<xsl:value-of select="SystemInfo/CPUtopology/@num_cpu_cores"/>
 	<xsl:text> (online: </xsl:text>
 	<xsl:value-of select="SystemInfo/CPUtopology/@num_cpu_cores_online"/>
+    <xsl:if test="SystemInfo/CPUtopology/@num_cpu_cores_isolated != 0">
+      <xsl:text>, isolated: </xsl:text>
+      <xsl:value-of select="SystemInfo/CPUtopology/@num_cpu_cores_isolated"/>
+    </xsl:if>
 	<xsl:text>)</xsl:text>
       </xsl:when>
       <xsl:when test="hardware/cpu_topology">
rteval/sysinfo/cputopology.py +11 -0
index 2bb6323..f60b059 100644
@@ -25,6 +25,7 @@
 
 import os
 import libxml2
+from rteval.systopology import SysTopology
 
 class CPUtopology:
     "Retrieves an overview over the installed CPU cores and the system topology"
@@ -34,6 +35,7 @@ class CPUtopology:
         self.__cputop_n = None
         self.__cpu_cores = 0
         self.__online_cores = 0
+        self.__isolated_cores = 0
         self.__cpu_sockets = 0
 
     def __read(self, dirname, fname):
@@ -51,6 +53,10 @@ class CPUtopology:
 
         self.__cputop_n = libxml2.newNode('CPUtopology')
 
+        # Get list of isolated CPUs from SysTopology
+        systopology = SysTopology()
+        isolated_cpus = {'cpu' + n for n in systopology.isolated_cpus_str()}
+
         cpusockets = []
         for dirname in os.listdir(self.sysdir):
             # Only parse directories which starts with 'cpu'
@@ -82,6 +88,10 @@ class CPUtopology:
                                                       'physical_package_id')
                             cpu_n.newProp('physical_package_id', str(phys_pkg_id))
                             cpusockets.append(phys_pkg_id)
+                            is_isolated = dirname in isolated_cpus
+                            if is_isolated:
+                             self.__isolated_cores += 1
+                            cpu_n.newProp('isolated', str(int(dirname in isolated_cpus)))
                         break
 
         # Count unique CPU sockets
@@ -97,6 +107,7 @@ class CPUtopology:
         # Summarise the core counts
         self.__cputop_n.newProp('num_cpu_cores', str(self.__cpu_cores))
         self.__cputop_n.newProp('num_cpu_cores_online', str(self.__online_cores))
+        self.__cputop_n.newProp('num_cpu_cores_isolated', str(self.__isolated_cores))
         self.__cputop_n.newProp('num_cpu_sockets', str(self.__cpu_sockets))
 
         return self.__cputop_n
Signature · 1 line
2.41.0
#5 lore raw

Re: [PATCH 2/6] rteval: Report isolated CPUs

Quoted 78 lines · Tomas Glozar

Add a flag for whether a CPU is isolated in CPUtopology and display the number of isolated CPUs in text report.

---
 rteval/rteval_text.xsl        |  4 ++++
 rteval/sysinfo/cputopology.py | 11 +++++++++++
 2 files changed, 15 insertions(+)
rteval/rteval_text.xsl +4 -0
index 7ecfac6..0ef649b 100644
@@ -59,6 +59,10 @@
 	<xsl:value-of select="SystemInfo/CPUtopology/@num_cpu_cores"/>
 	<xsl:text> (online: </xsl:text>
 	<xsl:value-of select="SystemInfo/CPUtopology/@num_cpu_cores_online"/>
+    <xsl:if test="SystemInfo/CPUtopology/@num_cpu_cores_isolated != 0">
+      <xsl:text>, isolated: </xsl:text>
+      <xsl:value-of select="SystemInfo/CPUtopology/@num_cpu_cores_isolated"/>
+    </xsl:if>
 	<xsl:text>)</xsl:text>
       </xsl:when>
       <xsl:when test="hardware/cpu_topology">
rteval/sysinfo/cputopology.py +11 -0
index 2bb6323..f60b059 100644
@@ -25,6 +25,7 @@
 
 import os
 import libxml2
+from rteval.systopology import SysTopology
 
 class CPUtopology:
     "Retrieves an overview over the installed CPU cores and the system topology"
@@ -34,6 +35,7 @@ class CPUtopology:
         self.__cputop_n = None
         self.__cpu_cores = 0
         self.__online_cores = 0
+        self.__isolated_cores = 0
         self.__cpu_sockets = 0
 
     def __read(self, dirname, fname):
@@ -51,6 +53,10 @@ class CPUtopology:
 
         self.__cputop_n = libxml2.newNode('CPUtopology')
 
+        # Get list of isolated CPUs from SysTopology
+        systopology = SysTopology()
+        isolated_cpus = {'cpu' + n for n in systopology.isolated_cpus_str()}
+
         cpusockets = []
         for dirname in os.listdir(self.sysdir):
             # Only parse directories which starts with 'cpu'
@@ -82,6 +88,10 @@ class CPUtopology:
                                                       'physical_package_id')
                             cpu_n.newProp('physical_package_id', str(phys_pkg_id))
                             cpusockets.append(phys_pkg_id)
+                            is_isolated = dirname in isolated_cpus
+                            if is_isolated:
+                             self.__isolated_cores += 1
+                            cpu_n.newProp('isolated', str(int(dirname in isolated_cpus)))
                         break
 
         # Count unique CPU sockets
@@ -97,6 +107,7 @@ class CPUtopology:
         # Summarise the core counts
         self.__cputop_n.newProp('num_cpu_cores', str(self.__cpu_cores))
         self.__cputop_n.newProp('num_cpu_cores_online', str(self.__online_cores))
+        self.__cputop_n.newProp('num_cpu_cores_isolated', str(self.__isolated_cores))
         self.__cputop_n.newProp('num_cpu_sockets', str(self.__cpu_sockets))
 
         return self.__cputop_n
Signature · 1 line
2.41.0
#6 lore raw

PATCH 3/6 rteval: Exclude isolcpus from kcompile by default

In reply to Tomas Glozar

Allows correct calculation of make job count that does not include isolated CPUs, on which the loads won't be scheduled.

---
 rteval/modules/loads/kcompile.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
rteval/modules/loads/kcompile.py +6 -2
index 35ee5cb..30c5965 100644
@@ -37,6 +37,7 @@ from rteval.systopology import CpuList, SysTopology
 
 expand_cpulist = CpuList.expand_cpulist
 compress_cpulist = CpuList.compress_cpulist
+nonisolated_cpulist = CpuList.nonisolated_cpulist
 
 DEFAULT_KERNEL_PREFIX = "linux-6.1"
 
@@ -55,17 +56,20 @@ class KBuildJob:
         if not os.path.isdir(self.objdir):
             os.mkdir(self.objdir)
 
+        # Exclude isolated CPUs if cpulist not set
+        cpus_available = len(nonisolated_cpulist(self.node.cpus.cpulist))
+
         if os.path.exists('/usr/bin/numactl') and not cpulist:
             # Use numactl
             self.binder = f'numactl --cpunodebind {int(self.node)}'
-            self.jobs = self.calc_jobs_per_cpu() * len(self.node)
+            self.jobs = self.calc_jobs_per_cpu() * cpus_available
         elif cpulist:
             # Use taskset
             self.jobs = self.calc_jobs_per_cpu() * len(cpulist)
             self.binder = f'taskset -c {compress_cpulist(cpulist)}'
         else:
             # Without numactl calculate number of jobs from the node
-            self.jobs = self.calc_jobs_per_cpu() * len(self.node)
+            self.jobs = self.calc_jobs_per_cpu() * cpus_available
 
         self.runcmd = f"make O={self.objdir} -C {self.kdir} -j{self.jobs}"
         self.cleancmd = f"make O={self.objdir} -C {self.kdir} clean allmodconfig"
Signature · 1 line
2.41.0
#7 lore raw

Re: [PATCH 3/6] rteval: Exclude isolcpus from kcompile by default

Quoted 47 lines · Tomas Glozar

Allows correct calculation of make job count that does not include isolated CPUs, on which the loads won't be scheduled.

---
 rteval/modules/loads/kcompile.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
rteval/modules/loads/kcompile.py +6 -2
index 35ee5cb..30c5965 100644
@@ -37,6 +37,7 @@ from rteval.systopology import CpuList, SysTopology
 
 expand_cpulist = CpuList.expand_cpulist
 compress_cpulist = CpuList.compress_cpulist
+nonisolated_cpulist = CpuList.nonisolated_cpulist
 
 DEFAULT_KERNEL_PREFIX = "linux-6.1"
 
@@ -55,17 +56,20 @@ class KBuildJob:
         if not os.path.isdir(self.objdir):
             os.mkdir(self.objdir)
 
+        # Exclude isolated CPUs if cpulist not set
+        cpus_available = len(nonisolated_cpulist(self.node.cpus.cpulist))
+
         if os.path.exists('/usr/bin/numactl') and not cpulist:
             # Use numactl
             self.binder = f'numactl --cpunodebind {int(self.node)}'
-            self.jobs = self.calc_jobs_per_cpu() * len(self.node)
+            self.jobs = self.calc_jobs_per_cpu() * cpus_available
         elif cpulist:
             # Use taskset
             self.jobs = self.calc_jobs_per_cpu() * len(cpulist)
             self.binder = f'taskset -c {compress_cpulist(cpulist)}'
         else:
             # Without numactl calculate number of jobs from the node
-            self.jobs = self.calc_jobs_per_cpu() * len(self.node)
+            self.jobs = self.calc_jobs_per_cpu() * cpus_available
 
         self.runcmd = f"make O={self.objdir} -C {self.kdir} -j{self.jobs}"
         self.cleancmd = f"make O={self.objdir} -C {self.kdir} clean allmodconfig"
Signature · 1 line
2.41.0
#8 lore raw

PATCH 4/6 rteval: Exclude isolcpus from stressng by default

In reply to Tomas Glozar

Note: this has little effect now, because the cpus variables is only used for removing empty nodes unless a cpulist is specified by the user. However, this can change in the future.

---
 rteval/modules/loads/stressng.py | 5 +++++
 1 file changed, 5 insertions(+)
rteval/modules/loads/stressng.py +5 -0
index 85cb473..800fdec 100644
@@ -9,6 +9,7 @@ from rteval.Log import Log
 from rteval.systopology import CpuList, SysTopology
 
 expand_cpulist = CpuList.expand_cpulist
+nonisolated_cpulist = CpuList.nonisolated_cpulist
 
 class Stressng(CommandLineLoad):
     " This class creates a load module that runs stress-ng "
@@ -69,6 +70,10 @@ class Stressng(CommandLineLoad):
             # if a cpulist was specified, only allow cpus in that list on the node
             if self.cpulist:
                 cpus[n] = [c for c in cpus[n] if c in expand_cpulist(self.cpulist)]
+            # if a cpulist was not specified, exclude isolated cpus
+            else:
+                cpus[n] = CpuList.nonisolated_cpulist(cpus[n])
+
 
         # remove nodes with no cpus available for running
         for node, cpu in cpus.items():
Signature · 1 line
2.41.0
#9 lore raw

Re: [PATCH 4/6] rteval: Exclude isolcpus from stressng by default

Quoted 36 lines · Tomas Glozar

Note: this has little effect now, because the cpus variables is only used for removing empty nodes unless a cpulist is specified by the user. However, this can change in the future.

---
 rteval/modules/loads/stressng.py | 5 +++++
 1 file changed, 5 insertions(+)
rteval/modules/loads/stressng.py +5 -0
index 85cb473..800fdec 100644
@@ -9,6 +9,7 @@ from rteval.Log import Log
 from rteval.systopology import CpuList, SysTopology
 
 expand_cpulist = CpuList.expand_cpulist
+nonisolated_cpulist = CpuList.nonisolated_cpulist
 
 class Stressng(CommandLineLoad):
     " This class creates a load module that runs stress-ng "
@@ -69,6 +70,10 @@ class Stressng(CommandLineLoad):
             # if a cpulist was specified, only allow cpus in that list on the node
             if self.cpulist:
                 cpus[n] = [c for c in cpus[n] if c in expand_cpulist(self.cpulist)]
+            # if a cpulist was not specified, exclude isolated cpus
+            else:
+                cpus[n] = CpuList.nonisolated_cpulist(cpus[n])
+
 
         # remove nodes with no cpus available for running
         for node, cpu in cpus.items():
Signature · 1 line
2.41.0
#10 lore raw

PATCH 5/6 rteval: Fix CPU count calculation for hackbench

In reply to Tomas Glozar

Use count from cpulist when specified and all CPUs on node excluding offline ones and isolated ones if not specified.

---
 rteval/modules/loads/hackbench.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
rteval/modules/loads/hackbench.py +5 -1
index 14e60d1..f5a547e 100644
@@ -38,6 +38,7 @@ from rteval.Log import Log
 from rteval.systopology import CpuList, SysTopology
 
 expand_cpulist = CpuList.expand_cpulist
+isolated_cpulist = CpuList.isolated_cpulist
 
 class Hackbench(CommandLineLoad):
     def __init__(self, config, logger):
@@ -77,9 +78,12 @@ class Hackbench(CommandLineLoad):
             # if a cpulist was specified, only allow cpus in that list on the node
             if self.cpulist:
                 self.cpus[n] = [c for c in self.cpus[n] if c in expand_cpulist(self.cpulist)]
+            # if a cpulist was not specified, exclude isolated cpus
+            else:
+                self.cpus[n] = CpuList.nonisolated_cpulist(self.cpus[n])
 
             # track largest number of cpus used on a node
-            node_biggest = len(sysTop.getcpus(int(n)))
+            node_biggest = len(self.cpus[n])
             if node_biggest > biggest:
                 biggest = node_biggest
 
Signature · 1 line
2.41.0
#11 lore raw

Re: [PATCH 5/6] rteval: Fix CPU count calculation for hackbench

Quoted 38 lines · Tomas Glozar

Use count from cpulist when specified and all CPUs on node excluding offline ones and isolated ones if not specified.

---
 rteval/modules/loads/hackbench.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
rteval/modules/loads/hackbench.py +5 -1
index 14e60d1..f5a547e 100644
@@ -38,6 +38,7 @@ from rteval.Log import Log
 from rteval.systopology import CpuList, SysTopology
 
 expand_cpulist = CpuList.expand_cpulist
+isolated_cpulist = CpuList.isolated_cpulist
 
 class Hackbench(CommandLineLoad):
     def __init__(self, config, logger):
@@ -77,9 +78,12 @@ class Hackbench(CommandLineLoad):
             # if a cpulist was specified, only allow cpus in that list on the node
             if self.cpulist:
                 self.cpus[n] = [c for c in self.cpus[n] if c in expand_cpulist(self.cpulist)]
+            # if a cpulist was not specified, exclude isolated cpus
+            else:
+                self.cpus[n] = CpuList.nonisolated_cpulist(self.cpus[n])
 
             # track largest number of cpus used on a node
-            node_biggest = len(sysTop.getcpus(int(n)))
+            node_biggest = len(self.cpus[n])
             if node_biggest > biggest:
                 biggest = node_biggest
 
Signature · 1 line
2.41.0
#12 lore raw

PATCH 6/6 rteval: Exclude isolcpus from loads report

In reply to Tomas Glozar

Use SysTopology.default_cpus() to report cores on which measurements and loads and run by default to reflect the default behavior (no isolcpus).

---
 rteval/modules/loads/__init__.py       | 2 +-
 rteval/modules/measurement/__init__.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
rteval/modules/loads/__init__.py +1 -1
index 761cc8c..74aad58 100644
@@ -138,7 +138,7 @@ class LoadModules(RtEvalModules):
             # Convert str to list and remove offline cpus
             cpulist = CpuList(cpulist).cpulist
         else:
-            cpulist = SysTop().online_cpus()
+            cpulist = SysTop().default_cpus()
         rep_n.newProp("loadcpus", collapse_cpulist(cpulist))
 
         return rep_n
rteval/modules/measurement/__init__.py +1 -1
index d99873e..0e395be 100644
@@ -194,7 +194,7 @@ measurement profiles, based on their characteristics"""
             # Convert str to list and remove offline cpus
             cpulist = CpuList(cpulist).cpulist
         else:
-            cpulist = SysTop().online_cpus()
+            cpulist = SysTop().default_cpus()
         rep_n.newProp("measurecpus", collapse_cpulist(cpulist))
 
         for mp in self.__measureprofiles:
Signature · 1 line
2.41.0
#13 lore raw

Re: [PATCH 6/6] rteval: Exclude isolcpus from loads report

Quoted 39 lines · Tomas Glozar

Use SysTopology.default_cpus() to report cores on which measurements and loads and run by default to reflect the default behavior (no isolcpus).

---
 rteval/modules/loads/__init__.py       | 2 +-
 rteval/modules/measurement/__init__.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
rteval/modules/loads/__init__.py +1 -1
index 761cc8c..74aad58 100644
@@ -138,7 +138,7 @@ class LoadModules(RtEvalModules):
             # Convert str to list and remove offline cpus
             cpulist = CpuList(cpulist).cpulist
         else:
-            cpulist = SysTop().online_cpus()
+            cpulist = SysTop().default_cpus()
         rep_n.newProp("loadcpus", collapse_cpulist(cpulist))
 
         return rep_n
rteval/modules/measurement/__init__.py +1 -1
index d99873e..0e395be 100644
@@ -194,7 +194,7 @@ measurement profiles, based on their characteristics"""
             # Convert str to list and remove offline cpus
             cpulist = CpuList(cpulist).cpulist
         else:
-            cpulist = SysTop().online_cpus()
+            cpulist = SysTop().default_cpus()
         rep_n.newProp("measurecpus", collapse_cpulist(cpulist))
 
         for mp in self.__measureprofiles:
Signature · 1 line
2.41.0