-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
71 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import math | ||
from dataclasses import dataclass | ||
from enum import IntEnum | ||
from functools import partial | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import psutil | ||
from pydantic import BaseModel | ||
|
||
|
||
class SystemInfo(BaseModel): | ||
cpu: str | ||
min_frequency_mhz: float | ||
max_frequency_mhz: float | ||
current_frequency_mhz: float | ||
physical_cores: int | ||
total_cores: int | ||
ram: int | ||
gpu: str | ||
|
||
|
||
def get_system_info() -> SystemInfo: | ||
with open("/proc/cpuinfo", "r") as f: | ||
for line in f: | ||
if "model name" in line: | ||
cpu = line.strip().split(":")[1].strip() | ||
break | ||
|
||
cpu_frequency = psutil.cpu_freq() | ||
min_frequency = cpu_frequency.min | ||
max_frequency = cpu_frequency.max | ||
current_frequency = cpu_frequency.current | ||
|
||
physical_cores = psutil.cpu_count(logical=False) | ||
total_cores = psutil.cpu_count(logical=True) | ||
|
||
ram = psutil.virtual_memory().total | ||
|
||
import torch | ||
gpu = torch.cuda.get_device_name(0) | ||
|
||
return SystemInfo( | ||
cpu=cpu, | ||
min_frequency_mhz=min_frequency, | ||
max_frequency_mhz=max_frequency, | ||
current_frequency_mhz=current_frequency, | ||
physical_cores=physical_cores, | ||
total_cores=total_cores, | ||
ram=ram, | ||
gpu=gpu, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters