Skip to content

More remarks on the code #3

@gdalle

Description

@gdalle

include("algebra.jl")

include("graphBLAS.jl")

These files don't exist. #2 would have caught it.

We don't need to store the backend, we can retrieve it when we need it with get_backend.

and checking backend consistency between vectors at construction time.

function SparseGPUVector(
n::Int,
::Type{Tv},
::Type{Ti},
backend::Backend,
) where {Tv,Ti<:Integer}
nzind = allocate(backend, Ti, 0)
nzval = allocate(backend, Tv, 0)
SparseGPUVector(n, nzind, nzval, backend)
end

Why allocate 0 instead of n?

Base.size(V::SparseGPUVector) = V.n

Base.size returns a tuple, even on vectors.

pos = findfirst(V.nzind .== i)

You can replace this with a functional variant to avoid allocation (at least on CPUs it's more efficient):

findfirst(==(i), V.nzind)

SparseGPUMatrixCSR{Tv,Ti<:Integer} <: AbstractSparseMatrixCSC{Tv,Ti}

Not a CSC matrix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions