The following program gives wrong result. Inspecting the generated C code reveals that the LHS of A[:,i] = ... is only indexed with one integer instead of two. The same problem will not occur when we write A[i,:] instead.
using ParallelAccelerator
@acc function f(n)
A = ones(Int, n, n)
for i = 1:n
A[:,i] = -A[:,i]
end
return A
end
println(f(3))
The following program gives wrong result. Inspecting the generated C code reveals that the LHS of
A[:,i] = ...
is only indexed with one integer instead of two. The same problem will not occur when we writeA[i,:]
instead.