-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbench.py
57 lines (46 loc) · 1.18 KB
/
bench.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
import numpy as np
try:
from mymod import (
myfunc as myfunc_py,
myfunc_loops2d as myfunc_loops2d_py,
myfunc_loops3d as myfunc_loops3d_py)
except ImportError:
pass
try:
from mymod_default import (
myfunc as myfunc_default,
myfunc_loops2d as myfunc_loops2d_default,
myfunc_loops3d as myfunc_loops3d_default)
except ImportError:
pass
try:
from mymod_native import (
myfunc as myfunc_native,
myfunc_loops2d as myfunc_loops2d_native,
myfunc_loops3d as myfunc_loops3d_native)
except ImportError:
pass
# try:
# from mymod_omp import (
# myfunc as myfunc_omp,
# myfunc_loops2d as myfunc_loops2d_omp,
# myfunc_loops3d as myfunc_loops3d_omp)
# except ImportError:
# pass
try:
from mymod_simd import (
myfunc as myfunc_simd,
myfunc_loops2d as myfunc_loops2d_simd,
myfunc_loops3d as myfunc_loops3d_simd)
except ImportError:
pass
n2d = 1024
n3d = 128
def rand2d():
return np.random.rand(n2d, n2d)
def rand3d():
return np.random.rand(n3d, n3d, n3d)
f2d = rand2d()
f3d = rand3d()
f2d = rand2d() + 1j * rand2d()
f3d = rand3d() + 1j * rand3d()