Skip to content

Vector dot is much slower than build-in operation #69

Closed

Description

@learning-chip

I can get decent parallel speed-up for sparse matmul and sparse matvec, but the dot product between two vectors seems very slow:

using SuiteSparseGraphBLAS
using BenchmarkTools

gbset(:nthreads, 16)

b = ones(10000)
b_gb = GBVector(b)

@btime b' * b  #  1 μs
@btime b_gb' * b_gb  # 15 μs

Is this expected? Or it can be tuned to be faster?

Version: SuiteSparseGraphBLAS@0.7.0

Activity

  1. rayegun commented on Apr 20, 2022

    @rayegun
    Member

    I do see this behavior (although more like 10x on my device). The big thing is that SuiteSparse:GraphBLAS is not a replacement for BLAS1 operations. It's a sparse matrix library, so it will always be a bit slow for simple BLAS operations.

    That being said we can probably do better here. Perhaps by unpacking and repacking the result and actually doing BLAS1. For the basic arithmetic semiring.

    We could also not be at O3 for some reason, I'll check on that. As well as talk to Tim Davis.

  2. ViralBShah commented on Oct 27, 2026

    @ViralBShah
    Member

    As explained above, this is expected: SuiteSparse:GraphBLAS isn't a replacement for BLAS1 operations on dense vectors, so a dense dot will be faster with plain Vectors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions