IntelLabs / numba

NumPy aware dynamic Python compiler using LLVM
http://numba.pydata.org/
BSD 2-Clause "Simplified" License
12 stars 2 forks source link

Add pyStencil, an AST based @stencil for use in testing. #39

Closed stuartarchibald closed 6 years ago

stuartarchibald commented 6 years ago

This adds pyStencil, a function that provides functionality similar to @stencil but in a much more reduced sense. It is used for testing the StencilFunc implementation and to aid reasoning about kernels and behaviours.

Some 80+ tests are written that compare:

stuartarchibald commented 6 years ago

@DrTodd13 @ehsantn Please could this be reviewed for suitability to merge into https://github.com/numba/numba/pull/2457? I've manually tested on Python 2.7, 3.5 and 3.6. The only failure at present is test_basic73 where the parfors output does not match the other implementations. Thanks.

DrTodd13 commented 6 years ago

@stuartarchibald The problem with test73 is the semantics of neighborhood. The documentation says it specifies the minimum and maximum index offsets used in a dimension. So, there's nothing wrong with (5,10) but that doesn't preclude being able to generate element 0 in the output array. So, the parfor test is correct and the others are wrong. Testing a fix at the moment.

stuartarchibald commented 6 years ago

@DrTodd13 thanks for the clarification. I think I understand the problem and where to fix it in pyStencil. Essentially the loop bound computation needs to be run when in neighborhood mode and loop ranges subsequently adjusted, whereas at present the code simply pushes the kernel into the inner loop and adds induction variables. Will fix.