Formatter cleanups

这个提交包含在:
Craig Warren
2025-02-03 11:00:50 +00:00
父节点 0aa13902d3
当前提交 07a958da25

查看文件

@@ -48,7 +48,11 @@ def get_host_info():
# Manufacturer/model # Manufacturer/model
try: try:
manufacturer = ( manufacturer = (
subprocess.check_output(["wmic", "csproduct", "get", "vendor"], shell=False, stderr=subprocess.STDOUT) subprocess.check_output(
["wmic", "csproduct", "get", "vendor"],
shell=False,
stderr=subprocess.STDOUT,
)
.decode("utf-8") .decode("utf-8")
.strip() .strip()
) )
@@ -59,7 +63,9 @@ def get_host_info():
manufacturer = manufacturer[0] manufacturer = manufacturer[0]
model = ( model = (
subprocess.check_output( subprocess.check_output(
["wmic", "computersystem", "get", "model"], shell=False, stderr=subprocess.STDOUT ["wmic", "computersystem", "get", "model"],
shell=False,
stderr=subprocess.STDOUT,
) )
.decode("utf-8") .decode("utf-8")
.strip() .strip()
@@ -76,7 +82,11 @@ def get_host_info():
# CPU information # CPU information
try: try:
allcpuinfo = ( allcpuinfo = (
subprocess.check_output(["wmic", "cpu", "get", "Name"], shell=False, stderr=subprocess.STDOUT) subprocess.check_output(
["wmic", "cpu", "get", "Name"],
shell=False,
stderr=subprocess.STDOUT,
)
.decode("utf-8") .decode("utf-8")
.strip() .strip()
) )
@@ -109,7 +119,9 @@ def get_host_info():
manufacturer = "Apple" manufacturer = "Apple"
try: try:
model = ( model = (
subprocess.check_output(["sysctl", "-n", "hw.model"], shell=False, stderr=subprocess.STDOUT) subprocess.check_output(
["sysctl", "-n", "hw.model"], shell=False, stderr=subprocess.STDOUT
)
.decode("utf-8") .decode("utf-8")
.strip() .strip()
) )
@@ -120,14 +132,20 @@ def get_host_info():
# CPU information # CPU information
try: try:
sockets = ( sockets = (
subprocess.check_output(["sysctl", "-n", "hw.packages"], shell=False, stderr=subprocess.STDOUT) subprocess.check_output(
["sysctl", "-n", "hw.packages"],
shell=False,
stderr=subprocess.STDOUT,
)
.decode("utf-8") .decode("utf-8")
.strip() .strip()
) )
sockets = int(sockets) sockets = int(sockets)
cpuID = ( cpuID = (
subprocess.check_output( subprocess.check_output(
["sysctl", "-n", "machdep.cpu.brand_string"], shell=False, stderr=subprocess.STDOUT ["sysctl", "-n", "machdep.cpu.brand_string"],
shell=False,
stderr=subprocess.STDOUT,
) )
.decode("utf-8") .decode("utf-8")
.strip() .strip()
@@ -150,13 +168,19 @@ def get_host_info():
# Manufacturer/model # Manufacturer/model
try: try:
manufacturer = ( manufacturer = (
subprocess.check_output(["cat", "/sys/class/dmi/id/sys_vendor"], shell=False, stderr=subprocess.STDOUT) subprocess.check_output(
["cat", "/sys/class/dmi/id/sys_vendor"],
shell=False,
stderr=subprocess.STDOUT,
)
.decode("utf-8") .decode("utf-8")
.strip() .strip()
) )
model = ( model = (
subprocess.check_output( subprocess.check_output(
["cat", "/sys/class/dmi/id/product_name"], shell=False, stderr=subprocess.STDOUT ["cat", "/sys/class/dmi/id/product_name"],
shell=False,
stderr=subprocess.STDOUT,
) )
.decode("utf-8") .decode("utf-8")
.strip() .strip()
@@ -170,7 +194,12 @@ def get_host_info():
# Locale to ensure English # Locale to ensure English
myenv = {**os.environ, "LANG": "en_US.utf8"} myenv = {**os.environ, "LANG": "en_US.utf8"}
cpuIDinfo = ( cpuIDinfo = (
subprocess.check_output(["cat", "/proc/cpuinfo"], shell=False, stderr=subprocess.STDOUT, env=myenv) subprocess.check_output(
["cat", "/proc/cpuinfo"],
shell=False,
stderr=subprocess.STDOUT,
env=myenv,
)
.decode("utf-8") .decode("utf-8")
.strip() .strip()
) )
@@ -179,7 +208,9 @@ def get_host_info():
cpuID = re.sub(".*model name.*:", "", line, 1).strip() cpuID = re.sub(".*model name.*:", "", line, 1).strip()
cpuID = " ".join(cpuID.split()) cpuID = " ".join(cpuID.split())
allcpuinfo = ( allcpuinfo = (
subprocess.check_output(["lscpu"], shell=False, stderr=subprocess.STDOUT, env=myenv) subprocess.check_output(
["lscpu"], shell=False, stderr=subprocess.STDOUT, env=myenv
)
.decode("utf-8") .decode("utf-8")
.strip() .strip()
) )
@@ -232,7 +263,7 @@ def print_host_info(hostinfo):
""" """
hyperthreadingstr = ( hyperthreadingstr = (
f", {config.sim_config.hostinfo['logicalcores']} " f"cores with Hyper-Threading" f", {config.sim_config.hostinfo['logicalcores']} cores with Hyper-Threading"
if config.sim_config.hostinfo["hyperthreading"] if config.sim_config.hostinfo["hyperthreading"]
else "" else ""
) )
@@ -490,12 +521,12 @@ def detect_cuda_gpus():
def print_cuda_info(devs): def print_cuda_info(devs):
""""Prints info about detected CUDA-capable GPU(s). """Prints info about detected CUDA-capable GPU(s).
Args: Args:
devs: dict of detected pycuda device object(s) where where device ID(s) devs: dict of detected pycuda device object(s) where where device ID(s)
are keys. are keys.
""" "" """
import pycuda import pycuda
@@ -545,12 +576,12 @@ def detect_opencl():
def print_opencl_info(devs): def print_opencl_info(devs):
""""Prints info about detected OpenCL-capable device(s). """Prints info about detected OpenCL-capable device(s).
Args: Args:
devs: dict of detected pyopencl device object(s) where where device ID(s) devs: dict of detected pyopencl device object(s) where where device ID(s)
are keys. are keys.
""" "" """
import pyopencl as cl import pyopencl as cl