File size: 622 Bytes
360d274
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import platform
from constants import DEVICE
import torch
import openvino as ov

core = ov.Core()


def is_openvino_device() -> bool:
    if DEVICE.lower() == "cpu" or DEVICE.lower()[0] == "g":
        return True
    else:
        return False


def get_device_name() -> str:
    if DEVICE == "cuda" or DEVICE == "mps":
        default_gpu_index = torch.cuda.current_device()
        return torch.cuda.get_device_name(default_gpu_index)
    elif platform.system().lower() == "darwin":
        return platform.processor()
    elif is_openvino_device():
        return core.get_property(DEVICE.upper(), "FULL_DEVICE_NAME")