Guest User

Untitled

a guest
Nov 20th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. from numpy import array
  2. from numpy import zeros
  3. from numpy.random import rand
  4. from numba import njit, prange
  5.  
  6. # @njit()
  7. @njit(parallel=True)
  8. def prange_test(A):
  9. s = 0
  10. z = zeros((3, 3))
  11. for i in prange(A.shape[0]):
  12. s += A[i]
  13. return s
  14.  
  15. A = rand(10)
  16.  
  17. test = prange_test(A)
  18.  
  19. from numpy import array
  20. from numpy.random import rand
  21. from numba import njit, prange
  22. import numpy as np
  23.  
  24. @njit(parallel=True)
  25. def prange_test(A):
  26. s = 0
  27. z = np.zeros((3, 3))
  28. for i in prange(A.shape[0]):
  29. s += A[i]
  30. return s
  31.  
  32. A = rand(10)
  33.  
  34. test = prange_test(A)
Add Comment
Please, Sign In to add comment