-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfloatrix.py
More file actions
39 lines (30 loc) · 959 Bytes
/
Copy pathfloatrix.py
File metadata and controls
39 lines (30 loc) · 959 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
32
33
34
35
36
37
38
import boto3
import json
import aws
import time
from collections import namedtuple
### NUMPY, SCIPY, SKLEARN MAGIC
import os
import ctypes
import platform
if platform.system() != 'Darwin': # don't do this on my local machine
for d, _, files in os.walk('lib'):
for f in files:
if f.endswith('.a'):
continue
ctypes.cdll.LoadLibrary(os.path.join(d, f))
import numpy as np
### NUMPY, SCIPY, SKLEARN MAGIC END
def handler(event, context):
columns = event['columns']
rows = event['rows']
generation_start_time = time.time()
matA = np.random.random_sample((columns, rows))
matB = np.random.random_sample((columns, rows))
generation_time = time.time() - generation_start_time
calc_start_time = time.time()
matA.dot(matB)
calc_time = time.time() - calc_start_time
event["generating matrices"] = int(generation_time * 1000)
event["calculation"] = int(calc_time * 1000)
return event