# GPU

**URL:** https://discourse.julialang.org/c/domain/gpu/11.md?page=5

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 6

---

## [Restarting CUDA](https://discourse.julialang.org/t/restarting-cuda/122163)

<div class="topic-metadata">

**Author:** [@Fabrice\_Rosay](https://discourse.julialang.org/u/Fabrice_Rosay)\
**Replies:** 1\
**Last updated:** [November 4, 2024, 4:30pm UTC](https://discourse.julialang.org/t/restarting-cuda/122163 "2024-11-04T16:30:24Z")

</div>

Is there a way to reset CUDA without restarting julia and be sure everything in memory related to gpu is wiped ? (multiple call to GC.gc and CUDA.reclaim or unsafe\_free! seems to miss some objects, leading to increase m…

---

## [Fastest way to compute adjoint(x)\*A\*x in CUDA?](https://discourse.julialang.org/t/fastest-way-to-compute-adjoint-x-a-x-in-cuda/122160)

<div class="topic-metadata">

**Author:** [@joseph-t-lee](https://discourse.julialang.org/u/joseph-t-lee)\
**Replies:** 19\
**Last updated:** [November 2, 2024, 9:28pm UTC](https://discourse.julialang.org/t/fastest-way-to-compute-adjoint-x-a-x-in-cuda/122160 "2024-11-02T21:28:54Z")

</div>

I am trying to compute an expectation value of an observable, which just comes down to computing: adjoint(x) \* A \* x, where x is an N dimendional vector with ComplexF32 entries and A in an N by N matrix. Initially A and…

---

## [Sparse LU factorization on GPU](https://discourse.julialang.org/t/sparse-lu-factorization-on-gpu/122012)

<div class="topic-metadata">

**Author:** [@IvanBioli](https://discourse.julialang.org/u/IvanBioli)\
**Replies:** 12\
**Last updated:** [November 2, 2024, 5:26pm UTC](https://discourse.julialang.org/t/sparse-lu-factorization-on-gpu/122012 "2024-11-02T17:26:39Z")

</div>

Hi, I am working with a CuSparseMatrixCSR{Float64, Int32} matrix A on the GPU to solve a linear system multiple times during the training of an ML model. I’m hoping to perform a sparse LU factorization (with optional re…

---

## [Can I use CuSpareMatrixCSC with Complex entries for ODE solving?](https://discourse.julialang.org/t/can-i-use-cusparematrixcsc-with-complex-entries-for-ode-solving/122080)

<div class="topic-metadata">

**Author:** [@joseph-t-lee](https://discourse.julialang.org/u/joseph-t-lee)\
**Replies:** 1\
**Last updated:** [October 31, 2024, 6:02pm UTC](https://discourse.julialang.org/t/can-i-use-cusparematrixcsc-with-complex-entries-for-ode-solving/122080 "2024-10-31T18:02:47Z")

</div>

(Apologies if this is confusing - this is my first post, and first time I haven’t been able to find my answer already on the forum!) I have been trying to rewrite some old CPU code that used Sparse Matrices with Complex…

---

## [Running CUDA.jl test results in my PC with Ubuntu 22.04 to freeze and become unresponsive\`](https://discourse.julialang.org/t/running-cuda-jl-test-results-in-my-pc-with-ubuntu-22-04-to-freeze-and-become-unresponsive/118434)

<div class="topic-metadata">

**Author:** [@Mend-Amar\_Badral](https://discourse.julialang.org/u/Mend-Amar_Badral)\
**Replies:** 12\
**Last updated:** [October 30, 2024, 4:03pm UTC](https://discourse.julialang.org/t/running-cuda-jl-test-results-in-my-pc-with-ubuntu-22-04-to-freeze-and-become-unresponsive/118434 "2024-10-30T16:03:00Z")

</div>

I have a PC that runs Ubuntu that has nvidia gpu(3080ti). I’ve installed CUDA.jl recently, and I believe pc has met all the requirements. It has Nvidia drivers installed. But when I enter pkg\> test CUDA There was an er…

---

## [Error returned from CUDA function in CUDA-aware MPI multi-GPU test](https://discourse.julialang.org/t/error-returned-from-cuda-function-in-cuda-aware-mpi-multi-gpu-test/121331)

<div class="topic-metadata">

**Author:** [@luciano-drozda](https://discourse.julialang.org/u/luciano-drozda)\
**Replies:** 1\
**Last updated:** [October 23, 2024, 12:59pm UTC](https://discourse.julialang.org/t/error-returned-from-cuda-function-in-cuda-aware-mpi-multi-gpu-test/121331 "2024-10-23T12:59:45Z")

</div>

Hi! I’m coming from this issue here, which seems to not relate to CUDA.jl specifically. Do you think it comes from my openmpi, cuda drivers installations ? Otherwise, could it come from MPI.jl ?

---

## [CUDA tests failing in WSL](https://discourse.julialang.org/t/cuda-tests-failing-in-wsl/121545)

<div class="topic-metadata">

**Author:** [@dfenn](https://discourse.julialang.org/u/dfenn)\
**Replies:** 2\
**Last updated:** [October 22, 2024, 2:00pm UTC](https://discourse.julialang.org/t/cuda-tests-failing-in-wsl/121545 "2024-10-22T14:00:58Z")

</div>

I’m running into errors running the CUDA.jl tests using WSL and Julia 1.11.1. Is WSL a supported platform? I’ve set export LD\_LIBRARY\_PATH="/usr/lib/wsl/lib/:$LD\_LIBRARY\_PATH", as suggested here: How to make CUDA.jl wor…

---

## [Result of inner product of two CuArray with views is incorrect](https://discourse.julialang.org/t/result-of-inner-product-of-two-cuarray-with-views-is-incorrect/121539)

<div class="topic-metadata">

**Author:** [@TzuYaoHuang](https://discourse.julialang.org/u/TzuYaoHuang)\
**Replies:** 2\
**Last updated:** [October 22, 2024, 11:33am UTC](https://discourse.julialang.org/t/result-of-inner-product-of-two-cuarray-with-views-is-incorrect/121539 "2024-10-22T11:33:09Z")

</div>

Hello, I am encountering a discrepancy when taking the inner product of two CUDA matrices, with and without the use of @view. The results differ by approximately 1% in Float32. Could someone kindly explain what might b…

---

## [Device RNG - Passes BigCrush](https://discourse.julialang.org/t/device-rng-passes-bigcrush/120976)

<div class="topic-metadata">

**Author:** [@MrBelette](https://discourse.julialang.org/u/MrBelette)\
**Replies:** 21\
**Last updated:** [October 18, 2024, 8:33pm UTC](https://discourse.julialang.org/t/device-rng-passes-bigcrush/120976 "2024-10-18T20:33:38Z")

</div>

I resurrected the SharedTauswortheGenerator device RNG from CUDA.jl v3.0.0 and, after some adjustment, it appears to pass the TestU01 BigCrush battery of tests! It would be nice if this can be independently tested. The…

---

## [How to copy view of CuArray to Array efficiently?](https://discourse.julialang.org/t/how-to-copy-view-of-cuarray-to-array-efficiently/120960)

<div class="topic-metadata">

**Author:** [@0samuraiE](https://discourse.julialang.org/u/0samuraiE)\
**Replies:** 4\
**Last updated:** [October 6, 2024, 11:08am UTC](https://discourse.julialang.org/t/how-to-copy-view-of-cuarray-to-array-efficiently/120960 "2024-10-06T11:08:53Z")

</div>

Hi all. For some reason, I encountered a GPU allocation problem when I copied a CuArray view. I tried several copying methods, but the third result was much slower. Should I avoid copying the CuArray view to the host? …

---

## [Best Practice for Type Declarations in CUDA Kernels](https://discourse.julialang.org/t/best-practice-for-type-declarations-in-cuda-kernels/119968)

<div class="topic-metadata">

**Author:** [@jamesmulhern](https://discourse.julialang.org/u/jamesmulhern)\
**Replies:** 3\
**Last updated:** [September 27, 2024, 4:40pm UTC](https://discourse.julialang.org/t/best-practice-for-type-declarations-in-cuda-kernels/119968 "2024-09-27T16:40:10Z")

</div>

I am writing a number of CUDA kernels for my optimization project. In the rest of my code I am using parametric type declarations so that the code can be run using different types. An example of an existing function is…

---

## [Non-intuitive difference of copyto! between CuArray and Array](https://discourse.julialang.org/t/non-intuitive-difference-of-copyto-between-cuarray-and-array/119904)

<div class="topic-metadata">

**Author:** [@0samuraiE](https://discourse.julialang.org/u/0samuraiE)\
**Replies:** 3\
**Last updated:** [September 26, 2024, 2:43pm UTC](https://discourse.julialang.org/t/non-intuitive-difference-of-copyto-between-cuarray-and-array/119904 "2024-09-26T14:43:01Z")

</div>

Hi all. I trapped an error when using copyto! to CuArray. Error is ERROR: CUDA error: invalid argument (code 1, ERROR\_INVALID\_VALUE) Stacktrace: \[1\] throw\_api\_error(res::CUDA.cudaError\_enum) @ CUDA ~/.julia/packa…

---

## [Good to copy GPU arrays back to CPU?](https://discourse.julialang.org/t/good-to-copy-gpu-arrays-back-to-cpu/119778)

<div class="topic-metadata">

**Author:** [@huiyuxie](https://discourse.julialang.org/u/huiyuxie)\
**Replies:** 6\
**Last updated:** [September 25, 2024, 7:51pm UTC](https://discourse.julialang.org/t/good-to-copy-gpu-arrays-back-to-cpu/119778 "2024-09-25T19:51:27Z")

</div>

I was wondering if it’s a good practice to always copy GPU arrays back to the CPU before a program ends. I’m running a large program that performs simulations with a large amount of data on the GPU. I know that some res…

---

## [CUDA performing scalar indexing when used along with Distributed](https://discourse.julialang.org/t/cuda-performing-scalar-indexing-when-used-along-with-distributed/119470)

<div class="topic-metadata">

**Author:** [@Paulo\_Refosco](https://discourse.julialang.org/u/Paulo_Refosco)\
**Replies:** 5\
**Last updated:** [September 23, 2024, 3:28pm UTC](https://discourse.julialang.org/t/cuda-performing-scalar-indexing-when-used-along-with-distributed/119470 "2024-09-23T15:28:07Z")

</div>

Hello all! I am running a series of nested functions, some of which using CUDA.jl at high level CuArrays processing (dot products and/or matrix multiplications). When I run it single threaded it works perfectly (even if…

---

## [GPU slower than CPU for simple benchmarks](https://discourse.julialang.org/t/gpu-slower-than-cpu-for-simple-benchmarks/119687)

<div class="topic-metadata">

**Author:** [@billmclean](https://discourse.julialang.org/u/billmclean)\
**Replies:** 7\
**Last updated:** [September 23, 2024, 6:50am UTC](https://discourse.julialang.org/t/gpu-slower-than-cpu-for-simple-benchmarks/119687 "2024-09-23T06:50:09Z")

</div>

I recently updated the CPU on my desktop: julia\> versioninfo() Julia Version 1.10.5 Commit 6f3fdf7b362 (2024-08-27 14:19 UTC) Build Info: Official https://julialang.org/ release Platform Info: OS: Linux (x86\_64-linu…

---

## [Where to run CI on GPUs?](https://discourse.julialang.org/t/where-to-run-ci-on-gpus/119619)

<div class="topic-metadata">

**Author:** [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Replies:** 3\
**Last updated:** [September 20, 2024, 6:16am UTC](https://discourse.julialang.org/t/where-to-run-ci-on-gpus/119619 "2024-09-20T06:16:43Z")

</div>

I have several packages whose tests would benefit from GPUs, but I don’t have funding to pay for dedicated servers. What are the best ways to run CI on GPUs with zero to low costs? My needs in terms of minutes are rather…

---

## [Caveats to reusing CuArray memory by changing .dims?](https://discourse.julialang.org/t/caveats-to-reusing-cuarray-memory-by-changing-dims/119429)

<div class="topic-metadata">

**Author:** [@eldee](https://discourse.julialang.org/u/eldee)\
**Replies:** 6\
**Last updated:** [September 18, 2024, 7:35am UTC](https://discourse.julialang.org/t/caveats-to-reusing-cuarray-memory-by-changing-dims/119429 "2024-09-18T07:35:37Z")

</div>

Hi, I have a situation where I’m creating and processing some data on the GPU in a loop. This data is a 3D tensor whose size (nx, ny, nz) can change every iteration, but there are clear upper bounds for the size of each…

---

## [CUDA and NVTX fail to precompile on cluster](https://discourse.julialang.org/t/cuda-and-nvtx-fail-to-precompile-on-cluster/119434)

<div class="topic-metadata">

**Author:** [@bulbul](https://discourse.julialang.org/u/bulbul)\
**Replies:** 7\
**Last updated:** [September 16, 2024, 1:43pm UTC](https://discourse.julialang.org/t/cuda-and-nvtx-fail-to-precompile-on-cluster/119434 "2024-09-16T13:43:27Z")

</div>

I am trying to use CUDA on my university cluster. If I try ‘’’ using CUDA ‘’’ I get the following error(s) (I have removed the Stacktraces): ‘’’ ERROR: LoadError: InitError: could not load library “/path-to-home/.jul…

---

## [Extra memory allocation when using closure with CUDA](https://discourse.julialang.org/t/extra-memory-allocation-when-using-closure-with-cuda/119407)

<div class="topic-metadata">

**Author:** [@0samuraiE](https://discourse.julialang.org/u/0samuraiE)\
**Replies:** 2\
**Last updated:** [September 15, 2024, 3:51pm UTC](https://discourse.julialang.org/t/extra-memory-allocation-when-using-closure-with-cuda/119407 "2024-09-15T15:51:47Z")

</div>

Hi all. I’ve been wondering about this for a long time, so I’m asking here. I show 2 benchmark functions. The only difference is former’s closure do not receive A as an argument while latter’s receive A. And the res…

---

## [Any function like \`push!\` for \`CuArray\`](https://discourse.julialang.org/t/any-function-like-push-for-cuarray/119181)

<div class="topic-metadata">

**Author:** [@huiyuxie](https://discourse.julialang.org/u/huiyuxie)\
**Replies:** 2\
**Last updated:** [September 8, 2024, 9:54pm UTC](https://discourse.julialang.org/t/any-function-like-push-for-cuarray/119181 "2024-09-08T21:54:51Z")

</div>

I was wondering if there is any function like push! that works for CuArray? Thanks!

---

## [AMDGPUBackend is missing](https://discourse.julialang.org/t/amdgpubackend-is-missing/119096)

<div class="topic-metadata">

**Author:** [@Hector\_Yaker](https://discourse.julialang.org/u/Hector_Yaker)\
**Replies:** 5\
**Last updated:** [September 8, 2024, 4:38pm UTC](https://discourse.julialang.org/t/amdgpubackend-is-missing/119096 "2024-09-08T16:38:19Z")

</div>

I don’t really know what’s happening, I have reinstalled the AMDGPU package many times and it’s really missing. I’ve got the latest RoCM and Julia versions and nothing works. Could you help me import it? I am in a Jupyt…

---

## [Slice the type CuSparseMatrixCSC matrix](https://discourse.julialang.org/t/slice-the-type-cusparsematrixcsc-matrix/119189)

<div class="topic-metadata">

**Author:** [@automaticvehiclerook](https://discourse.julialang.org/u/automaticvehiclerook)\
**Replies:** 2\
**Last updated:** [September 8, 2024, 1:36pm UTC](https://discourse.julialang.org/t/slice-the-type-cusparsematrixcsc-matrix/119189 "2024-09-08T13:36:15Z")

</div>

I have a doubt regarding slicing the sparse matrix on GPU.I don’t know why does the result matrix start assigning values from the second row.This is an unexpected result for me.How can i fix the error? using CUDA using …

---

## [Batch matrix/vector operations with CUDA.jl](https://discourse.julialang.org/t/batch-matrix-vector-operations-with-cuda-jl/117869)

<div class="topic-metadata">

**Author:** [@TimHargreaves](https://discourse.julialang.org/u/TimHargreaves)\
**Replies:** 5\
**Last updated:** [September 4, 2024, 1:34pm UTC](https://discourse.julialang.org/t/batch-matrix-vector-operations-with-cuda-jl/117869 "2024-09-04T13:34:39Z")

</div>

I’m trying to perform various operations such as multiplication, inversion, solving, Cholesky decomposition in batches with CUDA.jl. As far as I’m aware, there is no high-level API for doing this, as is the case with Te…

---

## [Testing GPU compatability in CI](https://discourse.julialang.org/t/testing-gpu-compatability-in-ci/119021)

<div class="topic-metadata">

**Author:** [@AntonReinhard](https://discourse.julialang.org/u/AntonReinhard)\
**Replies:** 2\
**Last updated:** [September 4, 2024, 11:10am UTC](https://discourse.julialang.org/t/testing-gpu-compatability-in-ci/119021 "2024-09-04T11:10:41Z")

</div>

I have a package in which I want to add support for some GPU types via package extensions and weak dependencies to them. Now I want to set up tests that conditionally only run when those GPU packages are installed, th…

---

## [Writing a Metal Kernel](https://discourse.julialang.org/t/writing-a-metal-kernel/100891)

<div class="topic-metadata">

**Author:** [@matthieu](https://discourse.julialang.org/u/matthieu)\
**Replies:** 9\
**Last updated:** [September 1, 2024, 3:35pm UTC](https://discourse.julialang.org/t/writing-a-metal-kernel/100891 "2024-09-01T15:35:54Z")

</div>

I have the following kernel in CUDA function inv!(scale, nthreads) nblocks = cld(length(scale), nthreads) @cuda threads=nthreads blocks=nblocks inv\_kernel!(scale) end function inv\_kernel!(scale) index = (blockIdx()…

---

## [Need a basic example on using custom structs in CUDA.jl with Adapt.jl](https://discourse.julialang.org/t/need-a-basic-example-on-using-custom-structs-in-cuda-jl-with-adapt-jl/118829)

<div class="topic-metadata">

**Author:** [@NonDairyNeutrino](https://discourse.julialang.org/u/NonDairyNeutrino)\
**Replies:** 2\
**Last updated:** [August 31, 2024, 7:11pm UTC](https://discourse.julialang.org/t/need-a-basic-example-on-using-custom-structs-in-cuda-jl-with-adapt-jl/118829 "2024-08-31T19:11:26Z")

</div>

I’m having a hard time understanding both the purpose of and how to use Adapt.jl to pass custom structs to CUDA kernels (that might not even be right). I’ve tried reading the CUDA.jl documentation and implementing a tri…

---

## [Float16 with AMDGPU](https://discourse.julialang.org/t/float16-with-amdgpu/118805)

<div class="topic-metadata">

**Author:** [@snowgum](https://discourse.julialang.org/u/snowgum)\
**Replies:** 10\
**Last updated:** [August 30, 2024, 8:14pm UTC](https://discourse.julialang.org/t/float16-with-amdgpu/118805 "2024-08-30T20:14:46Z")

</div>

Does AMDGPU support optimised Float16 or BFloat16 operations? I am testing in a AMD Instinct MI100, which theoretically has much better performance for Float16 (and BFloat16). However, when I try the sample vadd!() funct…

---

## [Source code annotation using NVTX in CUDA.jl](https://discourse.julialang.org/t/source-code-annotation-using-nvtx-in-cuda-jl/118730)

<div class="topic-metadata">

**Author:** [@Cibin\_Joseph](https://discourse.julialang.org/u/Cibin_Joseph)\
**Replies:** 2\
**Last updated:** [August 28, 2024, 7:07pm UTC](https://discourse.julialang.org/t/source-code-annotation-using-nvtx-in-cuda-jl/118730 "2024-08-28T19:07:50Z")

</div>

I’ve been able to get source code annotation working with the CUDA.jl source code but not with my own kernels. For example, the following MWE does not seem to work and complains with unsupported call to unknown functio…

---

## [Matrix Multiplication Using oneAPI.jl Fails on Second Invocation](https://discourse.julialang.org/t/matrix-multiplication-using-oneapi-jl-fails-on-second-invocation/118567)

<div class="topic-metadata">

**Author:** [@Marcelo\_Simas](https://discourse.julialang.org/u/Marcelo_Simas)\
**Replies:** 3\
**Last updated:** [August 26, 2024, 3:16pm UTC](https://discourse.julialang.org/t/matrix-multiplication-using-oneapi-jl-fails-on-second-invocation/118567 "2024-08-26T15:16:27Z")

</div>

Been playing with oneAPI.jl to run matrix x vector multiplication using the integrated Intel GPU on my Windows laptop (WSL2) and came across a strange behavior. The first time mul!() is invoked I get a reasonable result…

---

## [Questions about CUDA.dot() function](https://discourse.julialang.org/t/questions-about-cuda-dot-function/99315)

<div class="topic-metadata">

**Author:** [@fred\_wu](https://discourse.julialang.org/u/fred_wu)\
**Replies:** 4\
**Last updated:** [August 25, 2024, 5:05pm UTC](https://discourse.julialang.org/t/questions-about-cuda-dot-function/99315 "2024-08-25T17:05:54Z")

</div>

Hi, I encountered two doubts when using the CUDA.dot() function. My understanding is that the CUDA.dot() function returns a CPU scalar after performing calculations on the GPU. I tested the running time of the CUDA.dot(…

[Previous page](https://discourse.julialang.org/c/domain/gpu/11.md?page=4)

[Next page](https://discourse.julialang.org/c/domain/gpu/11.md?page=6)
