ParRes / Kernels

This is a set of simple programs that can be used to explore the features of a parallel platform.
https://groups.google.com/forum/#!forum/parallel-research-kernels
Other
409 stars 107 forks source link

fix Numba p2p #493

Open jeffhammond opened 4 years ago

jeffhammond commented 4 years ago

Apply this patch from @dalcinl...

diff --git a/PYTHON/p2p-numba.py b/PYTHON/p2p-numba.py
index 82ff99be..5fd8cecd 100755
--- a/PYTHON/p2p-numba.py
+++ b/PYTHON/p2p-numba.py
@@ -61,12 +61,15 @@ import numpy
 print('Numpy version  = ', numpy.version.version)
 import numba
 
-@jit
+@numba.jit
 def iterate_over_grid(grid, m, n):
     for i in range(1,m):
         for j in range(1,n):
             grid[i][j] = grid[i-1][j] + grid[i][j-1] - grid[i-1][j-1]
 
+    # copy top right corner value to bottom left corner to create dependency
+    grid[0,0] = -grid[m-1,n-1]
+
 def main():
 
     # ********************************************************************
@@ -106,9 +109,6 @@ def main():
 
         iterate_over_grid(grid, m, n)
 
-        # copy top right corner value to bottom left corner to create dependency
-        grid[0,0] = -grid[m-1,n-1]
-
 
     t1 = timer()
     pipeline_time = t1 - t0