Skip to content

Commit

Permalink
updated the alain counter example
Browse files Browse the repository at this point in the history
  • Loading branch information
madsbk committed Mar 1, 2016
1 parent 6ab5dc1 commit 6bac1a8
Showing 1 changed file with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,25 @@
from numpy.lib.stride_tricks import as_strided
import numpy_force as numpy

def mshare(T,S,R):
A = np.ones_like(T)
C = A + 43
E = C + T + np.gather(S,R) + A
D = C[::-1] + np.gather(S,R) + T
return (C,E,D)

def main():
B = util.Benchmark()
N = B.size[0]
I = B.size[1]
U = util.Benchmark()
N = U.size[0]
I = U.size[1]

T = np.ones(N)
S = np.ones(N)
R = np.array(numpy.random.random_integers(0,N,N), dtype=np.uint64)
B.start()
U.start()
for _ in xrange(I):
t = mshare(T,S,R)
B.flush()
B.stop()
B.pprint()
A = np.ones_like(T)
B = A + 43
C = B + T + np.gather(S,R) + A
D = B[::-1] + np.gather(S,R)
E = D + T + C
del A
U.flush()
U.stop()
U.pprint()

if __name__ == "__main__":
main()

0 comments on commit 6bac1a8

Please sign in to comment.