Skip to content

Commit

Permalink
merge cpu_info
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeyi-Lin committed Aug 24, 2024
1 parent fd860d5 commit 8e62b38
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions swanlab/data/run/system/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def __get_git_branch_and_commit():

def __get_cpu_info():
"""获取 CPU 信息"""
info = {"brand": None}
info = {"brand": None, "cores": None}

def get_cpu_brand_windows():
try:
Expand Down Expand Up @@ -130,6 +130,12 @@ def get_cpu_brand_macos():
elif platform.system() == "Darwin":
info["brand"] = get_cpu_brand_macos()

try:
# 获取 CPU 核心数
info["cores"] = multiprocessing.cpu_count()
except Exception:
pass

return info


Expand Down Expand Up @@ -307,7 +313,6 @@ def get_system_info(version: str, logdir: str):
"python_verbose": sys.version, # python详细版本
"executable": sys.executable, # python 解释器路径
"git_remote": __get_remote_url(), # 获取远程仓库的链接
"cpu": multiprocessing.cpu_count(), # cpu 核心数
"cpu_info": __get_cpu_info(), # cpu 相关信息
"gpu": __get_gpu_info(), # gpu 相关信息
"git_info": __get_git_branch_and_commit(), # git 分支和最新 commit 信息
Expand Down

0 comments on commit 8e62b38

Please sign in to comment.