-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbench.py
More file actions
51 lines (43 loc) · 1.26 KB
/
bench.py
File metadata and controls
51 lines (43 loc) · 1.26 KB
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
from charmnumeric.array import connect, ndarray
from charmnumeric.ast import set_max_depth
from charmnumeric.ccs import enable_debug
import charmnumeric.linalg as lg
import numpy as np
import time
set_max_depth(10)
def f():
b = ndarray(1, 10, np.float64, init_value=10)
v = ndarray(1, 10, np.float64, init_value=20)
c = ndarray(1, 10, np.float64, init_value=20)
v1 = (b + v) - c * 3
v2 = b.scale(3) + c.add_constant(10)
v3 = (b + c) @ v
v1.get()
v2.get()
v3.get()
start = time.time()
for i in range(100):
v1 = (b + v) - c * 3
v2 = b.scale(3) + c.add_constant(10)
v3 = (b + c) @ v
v1.get()
v2.get()
v3.get()
end = time.time()
print("VECTOR BENCH ", end-start)
start = time.time()
b = ndarray(2, [10,10], np.float64, init_value=10)
v = ndarray(2, [10,10], np.float64, init_value=20)
c = ndarray(2, [10,10], np.float64, init_value=20)
for i in range(100):
v1 = (b + v) - c * 3
v2 = b.exp() + c.add_constant(10)
v3 = (b + c) @ v
v1.get()
v2.get()
v3.get()
end = time.time()
print("MARIX BENCH ", end-start)
if __name__ == '__main__':
connect("172.17.0.1", 10000)
s = f()