Hello,
total newbie with GPU computing here.
I have seen that is possible to use sparse matrices with CuArrays.jl, but I have not found a way to initialize them. I tried to with the example described at https://github.com/JuliaAttic/CUSPARSE.jl but did not worked.
The used command and the error are shown below. Does anyone has a MWE with sparse matrices?
Thank you!
julia> CuArrays.allowscalar(true);
julia> a = CuArrays.CUSPARSE.CuSparseMatrixCSR(sprand(10,10,0.1));
julia> a
10×10 CuArrays.CUSPARSE.CuSparseMatrixCSR{Float64}:
Error showing value of type CuArrays.CUSPARSE.CuSparseMatrixCSR{Float64}:
ERROR: getindex not defined for CuArrays.CUSPARSE.CuSparseMatrixCSR{Float64}
Stacktrace:
[1] error(::String, ::Type) at ./error.jl:42
[2] error_if_canonical_getindex(::IndexCartesian, ::CuArrays.CUSPARSE.CuSparseMatrixCSR{Float64}, ::Int64, ::Int64) at ./abstractarray.jl:937
[3] getindex at ./abstractarray.jl:926 [inlined]
[4] isassigned(::CuArrays.CUSPARSE.CuSparseMatrixCSR{Float64}, ::Int64, ::Int64) at ./abstractarray.jl:351
[5] alignment(::IOContext{REPL.Terminals.TTYTerminal}, ::CuArrays.CUSPARSE.CuSparseMatrixCSR{Float64}, ::UnitRange{Int64}, ::UnitRange{Int64}, ::Int64, ::Int64, ::Int64) at ./arrayshow.jl:67
[6] print_matrix(::IOContext{REPL.Terminals.TTYTerminal}, ::CuArrays.CUSPARSE.CuSparseMatrixCSR{Float64}, ::String, ::String, ::String, ::String, ::String, ::String, ::Int64, ::Int64) at ./arrayshow.jl:186
[7] print_matrix at ./arrayshow.jl:159 [inlined]
[8] print_array at ./arrayshow.jl:308 [inlined]
[9] show(::IOContext{REPL.Terminals.TTYTerminal}, ::MIME{Symbol("text/plain")}, ::CuArrays.CUSPARSE.CuSparseMatrixCSR{Float64}) at ./arrayshow.jl:345
[10] display(::REPL.REPLDisplay, ::MIME{Symbol("text/plain")}, ::Any) at /home/zurdo/Software/Julia_Git/julia/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:131
[11] display(::REPL.REPLDisplay, ::Any) at /home/zurdo/Software/Julia_Git/julia/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:135
[12] display(::Any) at ./multimedia.jl:287
[13] #invokelatest#1 at ./essentials.jl:742 [inlined]
[14] invokelatest at ./essentials.jl:741 [inlined]
[15] print_response(::IO, ::Any, ::Any, ::Bool, ::Bool, ::Any) at /home/zurdo/Software/Julia_Git/julia/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:155
[16] print_response(::REPL.AbstractREPL, ::Any, ::Any, ::Bool, ::Bool) at /home/zurdo/Software/Julia_Git/julia/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:140
[17] (::getfield(REPL, Symbol("#do_respond#38")){Bool,getfield(REPL, Symbol("##48#57")){REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /home/zurdo/Software/Julia_Git/julia/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:714
[18] #invokelatest#1 at ./essentials.jl:742 [inlined]
[19] invokelatest at ./essentials.jl:741 [inlined]
[20] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /home/zurdo/Software/Julia_Git/julia/usr/share/julia/stdlib/v1.1/REPL/src/LineEdit.jl:2273
[21] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /home/zurdo/Software/Julia_Git/julia/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:1035
[22] run_repl(::REPL.AbstractREPL, ::Any) at /home/zurdo/Software/Julia_Git/julia/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:192
[23] (::getfield(Base, Symbol("##734#736")){Bool,Bool,Bool,Bool})(::Module) at ./client.jl:362
[24] #invokelatest#1 at ./essentials.jl:742 [inlined]
[25] invokelatest at ./essentials.jl:741 [inlined]
[26] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:346
[27] exec_options(::Base.JLOptions) at ./client.jl:284
[28] _start() at ./client.jl:436
EDIT: update of command used