You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The apply_difussion() function in these two modules (day1/stencil2d.py, day5/stencil2d-gt4py-v0.py) do not work as expected when num_iter is even. This is because the swapping inside the function is only valid within the scope of the function. When num_iter is even, the swapping happens an odd number of times, so outside the function, the actual result is stored in in_field array and not in out_field. This means that when num_iter is even, out_field corresponds to num_iter - 1 iterations of the diffusion.
The bug was found by @dymastery when working on the correctness checks in our project: #46.
A possible solution is to return out_field as we have done in our modified stencil2d and stencil2d_gt4py modules. This does not impact performance, as only a pointer is returned and no extra copies are made, and ensures that we keep track of the right field no matter the value of num_iter.
The text was updated successfully, but these errors were encountered:
The
apply_difussion()
function in these two modules (day1/stencil2d.py
,day5/stencil2d-gt4py-v0.py
) do not work as expected whennum_iter
is even. This is because the swapping inside the function is only valid within the scope of the function. Whennum_iter
is even, the swapping happens an odd number of times, so outside the function, the actual result is stored inin_field
array and not inout_field
. This means that whennum_iter
is even,out_field
corresponds tonum_iter - 1
iterations of the diffusion.The following block code demonstrates this:
The bug was found by @dymastery when working on the correctness checks in our project: #46.
A possible solution is to return
out_field
as we have done in our modifiedstencil2d
andstencil2d_gt4py
modules. This does not impact performance, as only a pointer is returned and no extra copies are made, and ensures that we keep track of the right field no matter the value ofnum_iter
.The text was updated successfully, but these errors were encountered: