Skip to content

Commit d3de917

Browse files
qwe
1 parent 3ce5ff0 commit d3de917

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

perf.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import dpnp
2+
import numpy as np
3+
from dpnp.tests.helper import generate_random_numpy_array
4+
import time
5+
from IPython import get_ipython
6+
7+
ipython = get_ipython()
8+
if ipython is None:
9+
from IPython.terminal.interactiveshell import TerminalInteractiveShell
10+
ipython = TerminalInteractiveShell()
11+
12+
13+
dtypes = ['f4', 'f8', 'c8', 'c16']
14+
n = 256
15+
print(f"size: ({n},{n},{n}) ")
16+
for dtype in dtypes:
17+
print(f"\n=== dtype: {dtype} ===")
18+
a = generate_random_numpy_array((n,n,n), dtype=dtype, seed_value=81)
19+
20+
# dpnp arrays on GPU
21+
a_dp = dpnp.array(a, device='gpu')
22+
exec_q = a_dp.sycl_queue
23+
24+
# Cold run
25+
_ = dpnp.linalg.slogdet(a_dp)
26+
exec_q.wait()
27+
28+
time.sleep(1)
29+
print("DPNP (GPU, Old):")
30+
ipython.run_line_magic('timeit', 'dpnp.linalg.slogdet(a_dp); exec_q.wait()')

0 commit comments

Comments
 (0)