dace
dace copied to clipboard
Fortran Blas Library Node ignore array ranges
Describe the bug
Given the faulty test from here on the f2dace-windwill branch:
def test_fortran_frontend_dot_range():
sources, main = SourceCodeBuilder().add_file("""
subroutine main(arg1, arg2, res1)
double precision, dimension(5) :: arg1
double precision, dimension(5) :: arg2
double precision, dimension(2) :: res1
res1(1) = dot_product(arg1(1:3), arg2(1:3))
end subroutine main
""").check_with_gfortran().get()
sdfg = create_singular_sdfg_from_string(sources, 'main', normalize_offsets=False)
sdfg.simplify()
size = 5
arg1 = np.full([size], 42, order="F", dtype=np.float64)
arg2 = np.full([size], 42, order="F", dtype=np.float64)
res1 = np.full([2], 0, order="F", dtype=np.float64)
for i in range(size):
arg1[i] = i + 1
arg2[i] = i + 5
sdfg(arg1=arg1, arg2=arg2, res1=res1)
assert res1[0] == np.dot(arg1, arg2)
it shows that the dot product should only be calculated on the first half of the arguments. Instead, the check passes because the assertion is not checking with the correct data and the dot-product is calculated over the entire argument arrays.
To Reproduce Steps to reproduce the behavior:
- Run the test above. The assertion will pass, demonstrating faulty behaviour