-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.py
48 lines (30 loc) · 1015 Bytes
/
test.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
import vkdispatch as vd
import vkdispatch.codegen as vc
from vkdispatch.codegen.abreviations import *
import numpy as np
import tqdm
from matplotlib import pyplot as plt
import sys
vd.initialize(log_level=vd.LogLevel.INFO)
print("Initializing...")
vd.make_context(devices=[0], queue_families=[[0, 2, 2]])
print("Context created")
shape = (512, 512)
arr = np.random.rand(shape[0], shape[1]) + 1j * np.random.rand(shape[0], shape[1])
buffer = vd.asbuffer(arr.astype(np.complex64))
buffer2 = vd.asbuffer(np.zeros(shape, dtype=np.complex64))
cmd_list = vd.CommandList()
fft_count = 20
submit_count = 100000
for _ in range(fft_count):
vd.fft(buffer, cmd_list=cmd_list)
print("FFT commands generated")
status_bar = tqdm.tqdm(total=fft_count * submit_count * 100)
for i in range(submit_count):
cmd_list.submit_any(instance_count=100) #data=data_buff.tobytes())
status_bar.update(fft_count * 100)
#if i % 10 == 0:
# buffer.read()
# buffer2.read()
buffer.read()
buffer2.read()