Skip to content

Instantly share code, notes, and snippets.

@omegahm
Created February 21, 2017 10:06
Show Gist options
  • Save omegahm/97900e43b7e42b54b4bc5f83848d49f5 to your computer and use it in GitHub Desktop.
Save omegahm/97900e43b7e42b54b4bc5f83848d49f5 to your computer and use it in GitHub Desktop.
Testing BLAS extension for Bohrium
a = np.random.rand(2000, 3000).astype(np.float32)
b = np.random.rand(3000, 4000).astype(np.float32)
t0 = time()
c = np.dot(a, b)
t1 = time()
print "[Numpy] It took {}s".format(t1-t0)
print c
#print
a = bh.array(a)
b = bh.array(b)
bh.flush()
bh.flush()
t0 = time()
c = bh.blas.gemm(a, b)
bh.flush()
t1 = time()
print "[Bohrium EXT] It took {}s".format(t1-t0)
print c
#print
bh.flush()
t0 = time()
c = bh.dot(a, b)
bh.flush()
t1 = time()
print "[Bohrium DOT] It took {}s".format(t1-t0)
#print c
#print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment