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
functionmy_mul_lv!(y::Vector{Float64}, A::SparseMatrixCSC{Float64,Int64}, x::Vector{Float64})
@turbofor i ineachindex(y) # for each branch
tmp =0.0
nzrange =nzrange(A, i) # non zero bus indicesfor j in nzrange
tmp += A.nzval[j] * x[A.rowval[j]]
end
y[i] = tmp
endreturnend
I get the error
ERROR: LoadError: ArgumentError:`@turbo` only supports loops iterating over ranges, and not objects of type `typeof(nzrange)`.
It looks like sparse arrays are currently not supported. This is not surprising, as they lead to irregular memory access.
However, once the random access loads have been performed, the computation (in this case, a multiplication) can still be performed using SIMD instructions.
It would be great to have a special macro for loops over columns of a sparse matrix , that can parallelize those parts that can be. And also send each column to a different thread, if using @tturbo.
This is something I'd like to work on eventually in LoopModels, but it'd be a long time. LoopModels is currently very coupled with affine representations of loop nests and indices.
I am trying to use turbo in this function to multiply
A'x
when A is sparseThe function works without the
@turbo
macro but when I add it, it throws this an error thati
isn't defined:UndefVarError: i not defined
The text was updated successfully, but these errors were encountered: