JuliaSIMD / JuliaSIMD/LoopVectorization.jl
@turbo can't find index when looping over sparse arrays
- Lingua principale
- Julia
- Stelle
- 789
- Fork
- 73
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
I am trying to use turbo in this function to multiply `A'x` when A is sparse
```Julia
function my_mul_lv!(y::Vector{Float64}, A::SparseMatrixCSC{Float64,Int64}, x::Vector{Float64})
@turbo for i in eachindex(y)
tmp = 0.0
for j in nzrange(A, i)
tmp += A.nzval[j] * x[A.rowval[j]]
end
y[i] = tmp
end
return
end
```
The function works without the `@turbo` macro but when I add it, it throws this an error that `i` isn't defined: `UndefVarError: i not defined`
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Reproduce the reported Julia function with `@turbo`, `SparseMatrixCSC`, `nzrange`, and the nested loop, then inspect how the macro handles `eachindex(y)` and the loop variable `i`. Compare the behavior with the same function without `@turbo`; done means the sparse-array loop no longer raises `UndefVarError: i not defined`.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- julia
- Ambito
- performance
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100