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
Using mm! with a type T = ComplexF64 returns the following error.
using LinearAlgebra
using SparseArrays
using CUDA
T = ComplexF64
N =100
A =cu(sprand(T, N, N, 0.1))
X =cu(rand(T, N, N))
Y =cu(zeros(T, N, N))
println(typeof(A))
println(typeof(X))
println(typeof(Y))
CUSPARSE.mm!('N', 'N', T(1.0), A, X, T(0.0), Y, 'O')
> julia benchmark_mul_GPU.jl
CUDA.CUSPARSE.CuSparseMatrixCSC{ComplexF64, Int32}
CuArray{ComplexF32, 2, CUDA.Mem.DeviceBuffer}
CuArray{ComplexF32, 2, CUDA.Mem.DeviceBuffer}
ERROR: LoadError: MethodError: no method matching mm!(::Char, ::Char, ::ComplexF64, ::CUDA.CUSPARSE.CuSparseMatrixCSC{ComplexF64, Int32}, ::CuArray{ComplexF32, 2, CUDA.Mem.DeviceBuffer}, ::ComplexF64, ::CuArray{ComplexF32, 2, CUDA.Mem.DeviceBuffer}, ::Char)
Closest candidates are:mm!(::Char, ::Char, ::Number, ::CUDA.CUSPARSE.CuSparseMatrixBSR{ComplexF32}, ::StridedCuMatrix{ComplexF32}, ::Number, ::StridedCuMatrix{ComplexF32}, ::Char) at ~/.julia/packages/CUDA/BbliS/lib/cusparse/level3.jl:21mm!(::Char, ::Char, ::Number, ::CUDA.CUSPARSE.CuSparseMatrixCSR{T}, ::CuArray{T, 2}, ::Number, ::CuArray{T, 2}, ::Char) where T at ~/.julia/packages/CUDA/BbliS/lib/cusparse/generic.jl:197mm!(::Char, ::Char, ::Number, ::CUDA.CUSPARSE.CuSparseMatrixCSR{T}, ::CuArray{T, 2}, ::Number, ::CuArray{T, 2}, ::Char, ::CUDA.CUSPARSE.cusparseSpMMAlg_t) where T at ~/.julia/packages/CUDA/BbliS/lib/cusparse/generic.jl:197...
Stacktrace:
[1] top-level scope
For T = Float32 instead, the error returned is
ERROR: LoadError: Scalar indexing is disallowed.
Invocation of getindex resulted in scalar indexing of a GPU array.
This is typically caused by calling an iterating implementation of a method.
Such implementations *do not* execute on the GPU, but very slowly on the CPU,
and therefore are only permitted from the REPL for prototyping purposes.
If you did intend to index this array, annotate the caller with @allowscalar.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] assertscalar(op::String)
@ GPUArraysCore ~/.julia/packages/GPUArraysCore/B3xv7/src/GPUArraysCore.jl:100
[3] getindex(xs::CuArray{Int32, 1, CUDA.Mem.DeviceBuffer}, I::Int64)
@ GPUArrays ~/.julia/packages/GPUArrays/w0b6Z/src/host/indexing.jl:9
[4] getindex(A::CUDA.CUSPARSE.CuSparseMatrixCSC{Float32, Int32}, i0::Int64, i1::Int64)
@ CUDA.CUSPARSE ~/.julia/packages/CUDA/BbliS/lib/cusparse/array.jl:311
[5] isassigned(::CUDA.CUSPARSE.CuSparseMatrixCSC{Float32, Int32}, ::Int64, ::Int64)
@ Base ./abstractarray.jl:565
[6] _show_nonempty(io::IOContext{IOBuffer}, X::AbstractMatrix, prefix::String, drop_brackets::Bool, axs::Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}})
@ Base ./arrayshow.jl:441
[7] _show_nonempty(io::IOContext{IOBuffer}, X::CUDA.CUSPARSE.CuSparseMatrixCSC{Float32, Int32}, prefix::String)
@ Base ./arrayshow.jl:413
[8] show
@ ./arrayshow.jl:489 [inlined]
[9] print(io::IOBuffer, x::CUDA.CUSPARSE.CuSparseMatrixCSC{Float32, Int32})
@ Base ./strings/io.jl:35
[10] print_to_string(::String, ::Vararg{Any})
@ Base ./strings/io.jl:144
[11] string(::String, ::CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, ::Vararg{Any})
@ Base ./strings/io.jl:185
[12] top-level scope
The text was updated successfully, but these errors were encountered:
You are mixing types, ComplexF32 and ComplexF64. mm! and friends are low-level methods that do not convert arguments. cu auto-promotes to 32-bits float, see the docstring (so here you just want to use the CuArray constructor).
Using
mm!
with a typeT = ComplexF64
returns the following error.For
T = Float32
instead, the error returned isThe text was updated successfully, but these errors were encountered: