# Using cuBLASDx in Julia

**URL:** <https://discourse.julialang.org/t/using-cublasdx-in-julia/125527>\
**Category:** GPU\
**Created:** [February 4, 2025, 10:53am UTC](https://discourse.julialang.org/t/using-cublasdx-in-julia/125527 "2025-02-04T10:53:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![CaG21](https://avatars.discourse-cdn.com/v4/letter/c/c2a13f/32.png) [@CaG21](https://discourse.julialang.org/u/CaG21)\
**Post date:** [February 4, 2025, 10:53am UTC](https://discourse.julialang.org/t/using-cublasdx-in-julia/125527/1 "2025-02-04T10:53:02Z")

</div>

I am really interested in using cuBLASDx, that is the CUDA API set to perform BLAS calculations inside CUDA kernels. However, since it is not provided in the CUDA Toolkit, but it should be downloaded separately, it seems that there is not an interface in CUDA.jl.  
Is there an alternative way to use it in Julia?  
And what about the other libraries in the MathDx package (e.g., cuSolverDx)?

---

<div class="post-metadata">

**Author:** ![vchuravy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vchuravy/32/8_2.png) [@vchuravy](https://discourse.julialang.org/u/vchuravy)\
**Post date:** [February 4, 2025, 1:39pm UTC](https://discourse.julialang.org/t/using-cublasdx-in-julia/125527/2 "2025-02-04T13:39:22Z")

</div>

> cuBLASDx is a CUDA C++ header only library

Sadly, that makes it inaccessible from CUDA.jl  
I would recommend looking at GemmKernels.jl and maybe you can write an API that provides a device side BLAS in pure Julia?

---

<div class="post-metadata">

**Author:** ![CaG21](https://avatars.discourse-cdn.com/v4/letter/c/c2a13f/32.png) [@CaG21](https://discourse.julialang.org/u/CaG21)\
**Post date:** [February 4, 2025, 1:47pm UTC](https://discourse.julialang.org/t/using-cublasdx-in-julia/125527/3 "2025-02-04T13:47:35Z")

</div>

What about cuSolverDx, that is part of the MathDx package, but it is not a header only library?

---

<div class="post-metadata">

**Author:** ![vchuravy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vchuravy/32/8_2.png) [@vchuravy](https://discourse.julialang.org/u/vchuravy)\
**Post date:** [February 4, 2025, 1:57pm UTC](https://discourse.julialang.org/t/using-cublasdx-in-julia/125527/4 "2025-02-04T13:57:23Z")

</div>

[https://docs.nvidia.com/cuda/cusolverdx/get\_started/installation.html](https://docs.nvidia.com/cuda/cusolverdx/get_started/installation.html)

It is implemented as a header + a static library.

The closest thing we currently support is `libcudadevrt` [CUDA.jl/src/compiler/compilation.jl at f3b3f8bff81d94b028abd92a0004971febd8dc87 · JuliaGPU/CUDA.jl · GitHub](https://github.com/JuliaGPU/CUDA.jl/blob/f3b3f8bff81d94b028abd92a0004971febd8dc87/src/compiler/compilation.jl#L373)

So yes, it’s technically feasible to access that functionality, but you will need to get your hands dirty and prototype a suitable Julia binding.

---

<div class="post-metadata">

**Author:** ![llukas](https://avatars.discourse-cdn.com/v4/letter/l/d07c76/32.png) [@llukas](https://discourse.julialang.org/u/llukas)\
**Post date:** [February 7, 2025, 8:57pm UTC](https://discourse.julialang.org/t/using-cublasdx-in-julia/125527/5 "2025-02-07T20:57:12Z")

</div>

What could it make it easier to work with cuBLASDx/cuSolverDx? I assume dealing with C++ is not optimal. Would C-API that generates pieces you can link be better?

---

<div class="post-metadata">

**Author:** ![CaG21](https://avatars.discourse-cdn.com/v4/letter/c/c2a13f/32.png) [@CaG21](https://discourse.julialang.org/u/CaG21)\
**Post date:** [February 8, 2025, 10:33am UTC](https://discourse.julialang.org/t/using-cublasdx-in-julia/125527/6 "2025-02-08T10:33:58Z")

</div>

I would say that anything will work as long as it can be called inside a kernel written in Julia to perform linear algebra routines and linear system solving.

NVIDIA has started to make available a lot of device-side extensions to perform mathematical operations (see the whole MathDx package, that has also FFT and RNG), even though they are not available in the CUDA Toolkit. Having them also in the Julia environment could be a great plus.

---

<div class="post-metadata">

**Author:** ![vchuravy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vchuravy/32/8_2.png) [@vchuravy](https://discourse.julialang.org/u/vchuravy)\
**Post date:** [February 9, 2025, 2:54pm UTC](https://discourse.julialang.org/t/using-cublasdx-in-julia/125527/7 "2025-02-09T14:54:39Z")

</div>

@llukas yeah that would make things certainly easier. Then I at least don’t have to worry about the ABI and can generate wrappers easily.
