forked from nicolargo/nvidia-ml-py3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mig_tests.py
35 lines (33 loc) · 1.09 KB
/
mig_tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from pynvml3.enums import GpuInstanceProfile
from pynvml3.errors import NVMLErrorNotSupported
from pynvml3.pynvml import NVMLLib
with NVMLLib() as lib:
device = lib.device.from_index(1)
print(device.get_name())
print(device.get_mig_mode())
supported_profiles = device.get_supported_gpu_instance_profiles(version=1)
print(supported_profiles.keys())
for key, value in supported_profiles.items():
print(key)
print(value)
print(
device.get_gpu_instance_remaining_capacity(
GpuInstanceProfile.PROFILE_1_SLICE, version=1
)
)
gpu_instance = device.create_gpu_instance(
GpuInstanceProfile.PROFILE_1_SLICE, version=1
)
print(
device.get_gpu_instance_remaining_capacity(
GpuInstanceProfile.PROFILE_1_SLICE, version=1
)
)
info = gpu_instance.get_info()
print(info.id, info.profileId, info.placement.start, info.placement.size)
gpu_instance.destroy()
print(
device.get_gpu_instance_remaining_capacity(
GpuInstanceProfile.PROFILE_1_SLICE, version=1
)
)