Improve extraction of CPU type information
(cherry picked from commit 071b0b22f23f643cbf68996308561b1c29f69535)
This commit is contained in:
parent
7313d6e39c
commit
6849f10653
@ -1,11 +1,13 @@
|
||||
Name: BiSheng-opentuner
|
||||
Version: 0.8.8
|
||||
Release: 1
|
||||
Release: 2
|
||||
Summary: An Extensible Framework for Program Autotuning
|
||||
License: MIT
|
||||
URL: https://github.com/Huawei-CPLLab/bisheng-opentuner
|
||||
Source0: https://github.com/Huawei-CPLLab/bisheng-opentuner/archive/bisheng-opentuner.zip
|
||||
|
||||
Patch0001: Driver-Improve-extraction-of-CPU-type-informa.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
BuildRequires: python3-devel
|
||||
@ -26,7 +28,7 @@ simultaneously, techniques which perform well will receive larger testing budget
|
||||
and techniques which perform poorly will be disabled.
|
||||
|
||||
%prep
|
||||
%autosetup -n %{name}-%{version}
|
||||
%autosetup -p1 -n %{name}-%{version}
|
||||
sed -i 's/numpy>=1.12.1, <=1.23.5/numpy>=1.12.1/' requirements.txt
|
||||
sed -i 's/SQLAlchemy==1.4.49/SQLAlchemy/' requirements.txt
|
||||
sed -i 's/argparse>=1.2.1//' requirements.txt
|
||||
@ -44,5 +46,8 @@ sed -i 's/argparse>=1.2.1//' requirements.txt
|
||||
%{python3_sitelib}/opentuner
|
||||
|
||||
%changelog
|
||||
* Wed Dec 04 2024 huanghe <huanghe88@h-partners.com> - 0.8.8-2
|
||||
- Patch0001 Improve extraction of CPU type information
|
||||
|
||||
* Wed Apr 24 2024 liyunfei <liyunfei33@huawei.com> - 0.8.8-1
|
||||
- Package init
|
||||
52
Driver-Improve-extraction-of-CPU-type-informa.patch
Normal file
52
Driver-Improve-extraction-of-CPU-type-informa.patch
Normal file
@ -0,0 +1,52 @@
|
||||
From c5d4306792bb14eacf2192fe372dcb1b37f862f1 Mon Sep 17 00:00:00 2001
|
||||
From: Muhammad Asif Manzoor <muhammad.asif.manzoor1@huawei.com>
|
||||
Date: Mon, 29 Apr 2024 13:32:15 -0400
|
||||
Subject: [PATCH] [Driver] Improve extraction of CPU type information
|
||||
|
||||
Use lscpu command to extract 'model name' for Linux OS if 'model name' is not
|
||||
available in /proc/cpuinfo file; return 'unknown' otherwise.
|
||||
---
|
||||
opentuner/measurement/driver.py | 27 ++++++++++++++++++++++-----
|
||||
1 file changed, 22 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/opentuner/measurement/driver.py b/opentuner/measurement/driver.py
|
||||
index 707b4ec..512bcb5 100644
|
||||
--- a/opentuner/measurement/driver.py
|
||||
+++ b/opentuner/measurement/driver.py
|
||||
@@ -221,11 +221,28 @@ class MeasurementDriver(DriverBase):
|
||||
|
||||
|
||||
def _cputype():
|
||||
- try:
|
||||
- return re.search(r"model name\s*:\s*([^\n]*)",
|
||||
- open("/proc/cpuinfo").read()).group(1)
|
||||
- except:
|
||||
- pass
|
||||
+ if os.name is "posix":
|
||||
+ try:
|
||||
+ return re.search(
|
||||
+ r"model name\s*:\s*([^\n]*)", open("/proc/cpuinfo").read()
|
||||
+ ).group(1)
|
||||
+ except:
|
||||
+ pass
|
||||
+ try:
|
||||
+ # AArch64 machines may not have 'model name' attribute in
|
||||
+ # /proc/cpuinfo file. Using lscpu command to extract 'model name'.
|
||||
+ import subprocess
|
||||
+
|
||||
+ return re.search(
|
||||
+ r"Model name\s*:\s*([^\n]*)",
|
||||
+ subprocess.Popen(["lscpu"], stdout=subprocess.PIPE)
|
||||
+ .communicate()[0]
|
||||
+ .decode(),
|
||||
+ ).group(1)
|
||||
+ except:
|
||||
+ log.warning("failed to get cpu type")
|
||||
+ return "unknown"
|
||||
+
|
||||
try:
|
||||
# for OS X
|
||||
import subprocess
|
||||
--
|
||||
2.45.1.windows.1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user