A simple package used for getting gpu information.
Project description
NGPUInfo
Install
pip install ngpuinfo
Description
This package uses nvidia-smi
to get gpu information, so it only support nvidia gpus, and the nvidia-smi
must be in
system path.
Get start
from ngpuinfo import NGPUInfo
print(NGPUInfo.NUMBERS)
print(NGPUInfo.CUDA_VERSION)
gpus = NGPUInfo.list_gpus()
for g in gpus:
print()
print(g.id)
print(g.name)
print(g.mem_info())
Usage
gpu = NGPUInfo.list_gpus()[0]
gpu.mem_total() # total mem of gpu, realtime refresh, the unit is Byte
gpu.mem_used() # used mem of gpu, realtime refresh, the unit is Byte
gpu.mem_free() # free mem of gpu, realtime refresh, the unit is Byte
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ngpuinfo-0.1.0.tar.gz
(4.1 kB
view hashes)