bryancatanzaro / copperhead

Data Parallel Python
Apache License 2.0
207 stars 28 forks source link

[FIXED] some issues running tests (args not flattened and negative array ranges not working well?) #14

Open asterbini opened 10 years ago

asterbini commented 10 years ago

Hi I was trying to run the copperhead tests and I have found that some of them do not run, I suppose mainly for 3 reasons:

[FIX] I think I fixed it by moving the _nametuples step before the inline one

diff --git a/copperhead/compiler/passes.py b/copperhead/compiler/passes.py
index 6d5fa29..672e5bd 100644
--- a/copperhead/compiler/passes.py
+++ b/copperhead/compiler/passes.py
@@ -243,6 +243,7 @@ frontend = Pipeline('frontend', [gather_source,
                                  procedure_flatten,
                                  expression_flatten,
                                  syntax_check,
+                                 name_tuples,    # FIX: moved here to avoid inline errors with nested argument lists
                                  inline,
                                  cast_literals,
--- a/copperhead/prelude_impl.py
+++ b/copperhead/prelude_impl.py
@@ -88,7 +88,7 @@ def shift(x, a, d):
 @cu
 def rotate(x, a):
     def torus_index(i, a, b):
-        return (i + a) % b
+        return (i + a + b) % b       # FIX: to be sure that the resulting value is positive

     def rotate_el(i):
         return x[torus_index(i, a, len(x))]

All the best AndreaS