File size: 458 Bytes
a103028
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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

from .Common import *

def GetNumberOfPhysicalCores():
    return 4

def GetNumberOfVirtualCores():
    return 8

def CudaGpuAvailable():
    if IsOsMac():
        return False
    else:
        import torch # GetDevice
        return torch.cuda.is_available()

def GetDevice(device):
    if device == "" or device == None:
        if CudaGpuAvailable():
            device = "cuda:0"
        else:
            device = "cpu"
            
    return device