-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
31 lines (25 loc) · 724 Bytes
/
test.py
File metadata and controls
31 lines (25 loc) · 724 Bytes
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
import threading
import time
import pandas as pd
import numpy as np
m = 3
X = pd.read_csv("mA.csv", sep=',', header=None).to_numpy()
Y = pd.read_csv("mB.csv", sep=',', header=None).to_numpy()
print(len(X[0]))
print(len(Y))
def mult(X, Y):
result = [[0]*m]
for z in range(len(Y[0])):
for k in range(len(Y)):
result[0][z] += X[0] * Y[k][z]
print(f" {result}")
threads = list()
start = time.perf_counter()
for i in range(len(X[0])):
x = threading.Thread(target = mult, args=(X[i], Y))
threads.append(x)
x.start()
for index, thread in enumerate(threads):
thread.join()
end = time.perf_counter()
print(f"Time taken to complete mult() {m}x{m}: {round(end - start, 5)} seconds(s)")