forked from oneapi-src/SYCLomatic
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinput.py
63 lines (47 loc) · 1.51 KB
/
input.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from torch import cuda
cuda_ver = torch.version.cuda
#init
torch.cuda.init()
cuda.init()
is_init = torch.cuda.is_initialized()
is_init = cuda.is_initialized()
# device APIs
devs = torch.cuda.device_count()
devs = cuda.device_count()
dev = torch.cuda.current_device()
dev = cuda.current_device()
torch.cuda.set_device(dev)
cuda.set_device(dev)
d_props = torch.cuda.get_device_properties(dev)
d_props = cuda.get_device_properties(dev)
curr_d_name = torch.cuda.get_device_name()
curr_d_name = cuda.get_device_name()
d_name = torch.cuda.get_device_name(dev)
d_name = cuda.get_device_name(dev)
d_cap = torch.cuda.get_device_capability()
d_cap = cuda.get_device_capability()
d0_cap = torch.cuda.get_device_capability(devs[0])
d0_cap = cuda.get_device_capability(devs[0])
dev_of_obj = torch.cuda.device_of(obj)
dev_of_obj = cuda.device_of(obj)
arch_list = torch.cuda.get_arch_list()
arch_list = cuda.get_arch_list()
torch.cuda.synchronize()
cuda.synchronize()
torch.cuda.synchronize(dev)
cuda.synchronize(dev)
# stream APIs
curr_st = torch.cuda.current_stream()
curr_st = cuda.current_stream()
curr_d_st = torch.cuda.current_stream(dev)
curr_d_st = cuda.current_stream(dev)
st = torch.cuda.StreamContext(curr_st)
st = cuda.StreamContext(curr_st)
stS = torch.cuda.stream(st)
stS = cuda.stream(st)
torch.cuda.set_stream(st)
cuda.set_stream(st)
if torch.cuda.current_stream() != torch.cuda.default_stream():
print("Not default stream")
device = torch.device('cuda')
extra_cuda_cflags=['--use_fast_math', '--allow-unsupported-compiler']