
import time
import numpy as np
import sys


n = int(sys.argv[1])
x = np.random.randn(n,n)
y = np.random.randn(n,n)

t0 = time.time()
z = np.dot(x, y)
print "Time for {} by {} matmul: {} s".format(n,n, time.time() - t0)


import time
import numpy as np
import sys
from __future__ import print_function


n = int(sys.argv[1])
x = np.random.randn(n,n)
y = np.random.randn(n,n)

t0 = time.time()
z = np.dot(x, y)
print("Time for {} by {} matmul: {} s".format(n,n, time.time() - t0))

Make bechmark compatible with python3
Make bechmark compatible with python3

  
  import time
  import numpy as np
  import sys
+ from __future__ import print_function
  
  
  n = int(sys.argv[1])
  x = np.random.randn(n,n)
  y = np.random.randn(n,n)
  
  t0 = time.time()
  z = np.dot(x, y)
- print "Time for {} by {} matmul: {} s".format(n,n, time.time() - t0)
+ print("Time for {} by {} matmul: {} s".format(n,n, time.time() - t0))
  
Make bechmark compatible with python3
## Code Before:

import time
import numpy as np
import sys


n = int(sys.argv[1])
x = np.random.randn(n,n)
y = np.random.randn(n,n)

t0 = time.time()
z = np.dot(x, y)
print "Time for {} by {} matmul: {} s".format(n,n, time.time() - t0)

## Instruction:
Make bechmark compatible with python3
## Code After:

import time
import numpy as np
import sys
from __future__ import print_function


n = int(sys.argv[1])
x = np.random.randn(n,n)
y = np.random.randn(n,n)

t0 = time.time()
z = np.dot(x, y)
print("Time for {} by {} matmul: {} s".format(n,n, time.time() - t0))
