|
| 1 | ++++ |
| 2 | +title = "CUDA.jl 5.8: CuSparseVector broadcasting, CUDA 12.9, and more" |
| 3 | +author = "Tim Besard" |
| 4 | +abstract = """ |
| 5 | + CUDA.jl v5.8 brings several enhancements, most notably the introduction of broadcasting |
| 6 | + support for `CuSparseVector`. The release also includes support for CUDA 12.9, |
| 7 | + and updates to key CUDA libraries like cuTENSOR, cuQuantum, and cuDNN. |
| 8 | +""" |
| 9 | ++++ |
| 10 | + |
| 11 | +{{abstract}} |
| 12 | + |
| 13 | + |
| 14 | +## Broadcasting for `CuSparseVector` |
| 15 | + |
| 16 | +A significant enhancement in CUDA.jl v5.8 is the [support for broadcasting |
| 17 | +`CuSparseVector`](https://github.com/JuliaGPU/CUDA.jl/pull/2733). Thanks to |
| 18 | +[@kshyatt](https://github.com/kshyatt), it is now possible to use sparse GPU vectors in |
| 19 | +broadcast expressions just like it was already possible with sparse matrices: |
| 20 | + |
| 21 | +```julia-repl |
| 22 | +julia> using CUDA, .CUSPARSE, SparseArrays |
| 23 | +
|
| 24 | +julia> x = cu(sprand(Float32, 10, 0.3)) |
| 25 | +10-element CuSparseVector{Float32, Int32} with 4 stored entries: |
| 26 | + [2] = 0.459139 |
| 27 | + [3] = 0.964073 |
| 28 | + [8] = 0.904363 |
| 29 | + [9] = 0.721723 |
| 30 | +
|
| 31 | +julia> # a zero-preserving elementwise operation |
| 32 | + x .* 2 |
| 33 | +10-element CuSparseVector{Float32, Int32} with 4 stored entries: |
| 34 | + [2] = 0.918278 |
| 35 | + [3] = 1.928146 |
| 36 | + [8] = 1.808726 |
| 37 | + [9] = 1.443446 |
| 38 | +
|
| 39 | +julia> # a non-zero-preserving elementwise operation |
| 40 | + x .+ 1 |
| 41 | +10-element CuArray{Float32, 1, CUDA.DeviceMemory}: |
| 42 | + 1.0 |
| 43 | + 1.4591388 |
| 44 | + 1.9640732 |
| 45 | + 1.0 |
| 46 | + 1.0 |
| 47 | + 1.0 |
| 48 | + 1.0 |
| 49 | + 1.9043632 |
| 50 | + 1.7217231 |
| 51 | + 1.0 |
| 52 | +
|
| 53 | +julia> # combining multiple sparse inputs |
| 54 | + x .+ cu(sprand(Float32, 10, 0.3)) |
| 55 | +10-element CuSparseVector{Float32, Int32} with 6 stored entries: |
| 56 | + [1] = 0.906 |
| 57 | + [2] = 0.583197 |
| 58 | + [3] = 0.964073 |
| 59 | + [4] = 0.259103 |
| 60 | + [8] = 0.904363 |
| 61 | + [9] = 0.935917 |
| 62 | +``` |
| 63 | + |
| 64 | + |
| 65 | +## Minor Changes |
| 66 | + |
| 67 | +CUDA.jl 5.8 also includes several other useful updates: |
| 68 | + |
| 69 | +- [Added support](https://github.com/JuliaGPU/CUDA.jl/pull/2772) for CUDA 12.9; |
| 70 | +- Subpackages [have been updated](https://github.com/JuliaGPU/CUDA.jl/pull/2776) to CUDNN |
| 71 | + 9.10, cuTensor 2.2, and cuQuantum 25.03; |
| 72 | +- `CUSPARSE.gemm!` [now supports](https://github.com/JuliaGPU/CUDA.jl/pull/2769) additional |
| 73 | + algorithms choices to limit memory usage; |
| 74 | +- Symbols [can now be passed](https://github.com/JuliaGPU/CUDA.jl/pull/2624) to CUDA kernels |
| 75 | + and stored in `CuArray`s; |
| 76 | +- `CuTensor` multiplication [now preserves](https://github.com/JuliaGPU/CUDA.jl/pull/2775) |
| 77 | + the memory type of the input tensors; |
| 78 | +- Sparse CSR matrices [are now interfaced |
| 79 | + with](https://github.com/JuliaGPU/CUDA.jl/pull/2720) the SparseMatricesCSR.jl package. |
| 80 | + |
| 81 | +As always, we encourage users to update to the latest version to benefit from these |
| 82 | +improvements and bug fixes. Check out the |
| 83 | +[changelog](https://github.com/JuliaGPU/CUDA.jl/releases/tag/v5.8.0) for a full list of |
| 84 | +changes. |
0 commit comments