# GPU sparse matrix-vector product with DoubleFloats.jl

**URL:** https://discourse.julialang.org/t/gpu-sparse-matrix-vector-product-with-doublefloats-jl/84008
**Category:** GPU
**Tags:** question
**Created:** [July 10, 2022, 3:45am UTC](https://discourse.julialang.org/t/gpu-sparse-matrix-vector-product-with-doublefloats-jl/84008 "2022-07-10T03:45:06Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![geoffroyleconte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/geoffroyleconte/32/21661_2.png) [@geoffroyleconte](https://discourse.julialang.org/u/geoffroyleconte)
#### Post date: [July 10, 2022, 3:45am UTC](https://discourse.julialang.org/t/gpu-sparse-matrix-vector-product-with-doublefloats-jl/84008/1 "2022-07-10T03:45:06Z")

</div>

Hi,  
Is it possible to use `mul!` with a CUDA sparse array and CuVectors using DoubleFloats.jl?

The following code leads to scalar indexing:

```julia
using CUDA, SparseArrays, LinearAlgebra, DoubleFloats
CUDA.allowscalar(false)
T = Double64
a = CUDA.zeros(T, 10)
b = CUDA.ones(T, 10)
A = sprand(T, 10, 10, 0.2)
Agpu = CUDA.CUSPARSE.CuSparseMatrixCSC(A)
mul!(a, Agpu, b) # error

```

However using a dense array works fine:

```julia
A = CUDA.ones(T, 10, 10)
mul!(a, A, b)

```

---

<div class="post-metadata">

### Author: ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)
#### Post date: [July 10, 2022, 9:40am UTC](https://discourse.julialang.org/t/gpu-sparse-matrix-vector-product-with-doublefloats-jl/84008/2 "2022-07-10T09:40:10Z")

</div>

No, we don’t have a native `mul!` for sparse arrays so you’re only allowed to use types that CUSPARSE supports.

---

<div class="post-metadata">

### Author: ![geoffroyleconte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/geoffroyleconte/32/21661_2.png) [@geoffroyleconte](https://discourse.julialang.org/u/geoffroyleconte)
#### Post date: [July 10, 2022, 6:33pm UTC](https://discourse.julialang.org/t/gpu-sparse-matrix-vector-product-with-doublefloats-jl/84008/3 "2022-07-10T18:33:45Z")

</div>

OK Thank you. Do you know if there is a Julia implementation of `mul!` for CUDA sparse arrays somewhere, even if it is slower?

---

<div class="post-metadata">

### Author: ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)
#### Post date: [July 11, 2022, 7:43am UTC](https://discourse.julialang.org/t/gpu-sparse-matrix-vector-product-with-doublefloats-jl/84008/4 "2022-07-11T07:43:00Z")

</div>

Not that I know.
