<jupyter_start><jupyter_text>系统环境检验  获取 CPU 信息<jupyter_code>def get_processor_name():
    import os, platform, subprocess
    
    if platform.system() == "Windows":
        command = "wmic cpu get Name | more +1"
        return subprocess.check_output(command, shell=True).strip().decode()
    elif platform.system() == "Darwin":
        os.environ['PATH'] = os.environ['PATH'] + os.pathsep + "/usr/sbin"
        command ="sysctl -n machdep.cpu.brand_string"
        return subprocess.check_output(command).strip().decode()
    elif platform.system() == "Linux":
        command = "cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq"
        return subprocess.check_output(command, shell=True).strip().decode()
    return ""
import psutil

n_logical = psutil.cpu_count()
n_physical = psutil.cpu_count(logical=False)
n_usable = len(psutil.Process().cpu_affinity())

print("=" * 64, "CPU info:", sep="\n")
print(f"    Name:       {get_processor_name()}")
print(f"    Logical:    {n_logical}")
print(f"    Physical:   {n_physical}")
print(f"    Usable:     {n_usable}")<jupyter_output>================================================================
CPU info:
    Name:       Intel(R) Xeon(R) Gold 5218R CPU @ 2.10GHz
    Logical:    40
    Physical:   20
    Usable:     40<jupyter_text>获取内存信息<jupyter_code>import psutil

mem = psutil.virtual_memory()
unit_GB = 1024**3
mem_total = mem.total / unit_GB
mem_free = mem.free / unit_GB
mem_available = mem.available / unit_GB

print("=" * 64, "Memory info:", sep="\n")
print(f"    Total:      {mem_total:.2f} GB")
print(f"    Free:       {mem_free:.2f} GB")
print(f"    Available:  {mem_available:.2f} GB")<jupyter_output>================================================================
Memory info:
    Total:      31.63 GB
    Free:       24.16 GB
    Available:  24.16 GB<jupyter_text>获取依赖库信息<jupyter_code>print("=" * 64, "Package requirements info:", sep="\n")
for module_name in ["numpy", "scipy", "numba", "joblib"]:
    try:
        module = __import__(module_name)
        version = module.__version__
        print(f"    {module_name + ':':12s}{version}")
    except:
        print(f"    Module {module_name} not found.")<jupyter_output>================================================================
Package requirements info:
    numpy:      1.19.2
    scipy:      1.5.2
    numba:      0.51.2
    joblib:     1.0.0<jupyter_text>获取当前求解器版本信息<jupyter_code>import hmsolver

print("=" * 64, "HMSolver info:", sep="\n")
print(f"    Author:     {hmsolver.__author__}")
print(f"    Email:      {hmsolver.__email__}")
print(f"    Version:    {hmsolver.__version__}")
print(f"    License:    {hmsolver.__license__}")
print("=" * 64)<jupyter_output>================================================================
HMSolver info:
    Author:     <NAME>(polossk)
    Email:      <EMAIL>
    Version:    0.5.0
    License:    GNU General Public License v3.0
================================================================
{'fraction_non_alphanumeric': 0.2437626432906271, 'fraction_numerical': 0.022252191503708697, 'mean_word_length': 3.7095238095238097, 'pattern_counts': {'":': 3, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '518574', 'license': 'MIT', 'n_tokens_mistral': 1041, 'n_tokens_neox': 1007, 'n_words': 204, 'path': 'Chinese-Handbook/Sec00-Introduction/Intro02-check-systeminfo/check-systeminfo.ipynb', 'repo_name': 'polossk/Peridynamics-Example-Using-HMSolver', 'size': '2986'}