# GPU

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

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

**Page:** 23

---

## [Explanation of Error related to memory](https://discourse.julialang.org/t/explanation-of-error-related-to-memory/60111)

<div class="topic-metadata">

**Author:** [@Sumanshekhar17](https://discourse.julialang.org/u/Sumanshekhar17)\
**Replies:** 0\
**Last updated:** [April 27, 2021, 3:19pm UTC](https://discourse.julialang.org/t/explanation-of-error-related-to-memory/60111 "2021-04-27T15:19:31Z")

</div>

Hi all, I am learning GPU programming and wanted to know what maximum grid size my machine can resolve so I went for a 1000x1000x500 grid and I got this error. Can you please explain what it is saying in easy words ERR…

---

## [CUDA.jl tex2DLayered support?](https://discourse.julialang.org/t/cuda-jl-tex2dlayered-support/59625)

<div class="topic-metadata">

**Author:** [@jpdoane](https://discourse.julialang.org/u/jpdoane)\
**Replies:** 2\
**Last updated:** [April 25, 2021, 1:25pm UTC](https://discourse.julialang.org/t/cuda-jl-tex2dlayered-support/59625 "2021-04-25T13:25:16Z")

</div>

Is there a plan to integrate Layered Textures support into CUDA.jl? I am currently using a 3D texture for my application, but I suspect I am getting sub-optimal performance since my data structure really is a set of 2D …

---

## [Accessing array elements too slow?](https://discourse.julialang.org/t/accessing-array-elements-too-slow/59856)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 10\
**Last updated:** [April 23, 2021, 3:54pm UTC](https://discourse.julialang.org/t/accessing-array-elements-too-slow/59856 "2021-04-23T15:54:24Z")

</div>

Hi, I think I could use some help here… As a part of a Monte Carlo code I’m developing in julia+CUDA, I have a function that takes several input parameters, performs a calculation with them, and stores the result in a C…

---

## [Multiple CPU threads that use Unified Memory gives a Bus Error](https://discourse.julialang.org/t/multiple-cpu-threads-that-use-unified-memory-gives-a-bus-error/59814)

<div class="topic-metadata">

**Author:** [@barrettp](https://discourse.julialang.org/u/barrettp)\
**Replies:** 5\
**Last updated:** [April 23, 2021, 2:03pm UTC](https://discourse.julialang.org/t/multiple-cpu-threads-that-use-unified-memory-gives-a-bus-error/59814 "2021-04-23T14:03:20Z")

</div>

I’ve have a function that calls a kernel that uses unified memory. The function allocates and frees the unified memory before and after multiple kernel invocations. I call synchronize() after each kernel call. Without sy…

---

## [CUDA.randn! allocation](https://discourse.julialang.org/t/cuda-randn-allocation/59506)

<div class="topic-metadata">

**Author:** [@zhiwei](https://discourse.julialang.org/u/zhiwei)\
**Replies:** 2\
**Last updated:** [April 19, 2021, 5:25pm UTC](https://discourse.julialang.org/t/cuda-randn-allocation/59506 "2021-04-19T17:25:22Z")

</div>

Hello, I’m using CUDA.randn! on a CuArray and CUDA.@allocated reports memory allocations. This doesn’t happen for CUDA.rand!. I wonder if this is normal? julia\> rng = CURAND.default\_rng() julia\> a = CuArray{Float64}(u…

---

## [Notes on \`CUDA.sync\_threads\` and dispatch on \`Union\`](https://discourse.julialang.org/t/notes-on-cuda-sync-threads-and-dispatch-on-union/59375)

<div class="topic-metadata">

**Author:** [@tkf](https://discourse.julialang.org/u/tkf)\
**Replies:** 3\
**Last updated:** [April 16, 2021, 9:11pm UTC](https://discourse.julialang.org/t/notes-on-cuda-sync-threads-and-dispatch-on-union/59375 "2021-04-16T21:11:56Z")

</div>

I’ve been playing with Union-typed objects on CUDA GPU and I found an interesting quirk due to how sync\_threads and Union-splitting interacts. I thought to share this here since it’s not really a CUDA.jl issue. MWE If C…

---

## [CUDA not working after today's update](https://discourse.julialang.org/t/cuda-not-working-after-todays-update/59329)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 2\
**Last updated:** [April 16, 2021, 8:35pm UTC](https://discourse.julialang.org/t/cuda-not-working-after-todays-update/59329 "2021-04-16T20:35:45Z")

</div>

Hi, yesterday I read the message about the new CUDA package. Today I just did an update (julia 1.6.0 on ubuntu mate 20.04) and the CUDA package did upgrade. After that julia\> using CUDA julia\> CUDA.zeros(10) ┌ Error:…

---

## [CUDA atomics on complex-valued arrays](https://discourse.julialang.org/t/cuda-atomics-on-complex-valued-arrays/59054)

<div class="topic-metadata">

**Author:** [@weylspinor](https://discourse.julialang.org/u/weylspinor)\
**Replies:** 3\
**Last updated:** [April 12, 2021, 2:52pm UTC](https://discourse.julialang.org/t/cuda-atomics-on-complex-valued-arrays/59054 "2021-04-12T14:52:57Z")

</div>

Hi, I am curious if there is an way to do atomic operations on complex-valued arrays in CUDA kernel, e.g. using CUDA function kernel!(x::CuDeviceArray{T}, y::CuDeviceArray{T}) where T i = (blockIdx().x-1)\*blockDim…

---

## [oneAPI & FFTW](https://discourse.julialang.org/t/oneapi-fftw/59055)

<div class="topic-metadata">

**Author:** [@fra](https://discourse.julialang.org/u/fra)\
**Replies:** 2\
**Last updated:** [April 12, 2021, 6:12am UTC](https://discourse.julialang.org/t/oneapi-fftw/59055 "2021-04-12T06:12:44Z")

</div>

I’m trying oneAPI.jl with FFTW and I get an error when trying to use complex arrays in the GPU. using oneAPI using FFTW a = randn(1024) .+ im\*randn(1024); b = oneArray(a); fft(a); fft(b); For the oneArray case I get j…

---

## [What is a neutral element (for accumulate on gpu)?](https://discourse.julialang.org/t/what-is-a-neutral-element-for-accumulate-on-gpu/58845)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 8\
**Last updated:** [April 10, 2021, 1:26am UTC](https://discourse.julialang.org/t/what-is-a-neutral-element-for-accumulate-on-gpu/58845 "2021-04-10T01:26:16Z")

</div>

Hello, So I’m trying this simple accumulate function on a CuArray: julia\> using CUDA julia\> d\_d = cu(rand(10,20)); julia\> accumulate((a,d) -\> d + 0.99\*0.95\*a, d\_d, dims = 2, init = 0f0) ERROR: GPUArrays.jl needs to kno…

---

## [Error While adding CuArrays.jl package](https://discourse.julialang.org/t/error-while-adding-cuarrays-jl-package/58387)

<div class="topic-metadata">

**Author:** [@Sumanshekhar17](https://discourse.julialang.org/u/Sumanshekhar17)\
**Replies:** 12\
**Last updated:** [April 2, 2021, 10:02am UTC](https://discourse.julialang.org/t/error-while-adding-cuarrays-jl-package/58387 "2021-04-02T10:02:13Z")

</div>

There are two problems that I am facing first is that- I have tried CUDA.has\_cuda(), and it gave me false. The second is that when I tried to add CuArrays.jl it gave me this error- julia\> import Pkg julia\> Pkg.add("C…

---

## [CUDA : vectorization not working with functions of complex argument](https://discourse.julialang.org/t/cuda-vectorization-not-working-with-functions-of-complex-argument/58375)

<div class="topic-metadata">

**Author:** [@anscoil](https://discourse.julialang.org/u/anscoil)\
**Replies:** 4\
**Last updated:** [April 1, 2021, 6:13pm UTC](https://discourse.julialang.org/t/cuda-vectorization-not-working-with-functions-of-complex-argument/58375 "2021-04-01T18:13:51Z")

</div>

Hi, Before stating my problem, I would like to say that I’m a fully enthusiastic and convinced Julia user, and to thank the developers for their awesome work. The CUDA module is especially of great help to write fast c…

---

## [ForwardDiff of function with internal derivatives using CuArrays](https://discourse.julialang.org/t/forwarddiff-of-function-with-internal-derivatives-using-cuarrays/58178)

<div class="topic-metadata">

**Author:** [@RynoLaubscher](https://discourse.julialang.org/u/RynoLaubscher)\
**Replies:** 8\
**Last updated:** [March 31, 2021, 12:13pm UTC](https://discourse.julialang.org/t/forwarddiff-of-function-with-internal-derivatives-using-cuarrays/58178 "2021-03-31T12:13:06Z")

</div>

Hi All, I am struggling a bit with a ForwardDiff problem on GPU. I would like to determine the gradients of a loss function which internally uses Zygote to calculate gradients. I can get it to work perfectly on CPU but w…

---

## [Julia version/CUDA compatibility with Quadro K4100 compute capbility of 3](https://discourse.julialang.org/t/julia-version-cuda-compatibility-with-quadro-k4100-compute-capbility-of-3/58053)

<div class="topic-metadata">

**Author:** [@wizebt](https://discourse.julialang.org/u/wizebt)\
**Replies:** 1\
**Last updated:** [March 29, 2021, 5:49am UTC](https://discourse.julialang.org/t/julia-version-cuda-compatibility-with-quadro-k4100-compute-capbility-of-3/58053 "2021-03-29T05:49:16Z")

</div>

Hi, I’m really struggling to find a compatible combination of versions: nVidia TK, Julia, CUDA.jl to execute a simple linear shift and add (see fct below) to efficiently run on my old Quadro K4100m GPU with compute capa…

---

## [Array of structures vs. Structures of arrays](https://discourse.julialang.org/t/array-of-structures-vs-structures-of-arrays/56936)

<div class="topic-metadata">

**Author:** [@shiroghost](https://discourse.julialang.org/u/shiroghost)\
**Replies:** 10\
**Last updated:** [March 23, 2021, 12:38pm UTC](https://discourse.julialang.org/t/array-of-structures-vs-structures-of-arrays/56936 "2021-03-23T12:38:19Z")

</div>

Hi all, I am trying my first steps with CUDA.jl and I have a question about memory layout. I have a simple unmutable structure, for example: struct Angles x::SVector{3, Float64} end I have operations like function …

---

## [GPU gradient issues with matrix tranpose](https://discourse.julialang.org/t/gpu-gradient-issues-with-matrix-tranpose/57145)

<div class="topic-metadata">

**Author:** [@JLDC](https://discourse.julialang.org/u/JLDC)\
**Replies:** 0\
**Last updated:** [March 14, 2021, 7:23pm UTC](https://discourse.julialang.org/t/gpu-gradient-issues-with-matrix-tranpose/57145 "2021-03-14T19:23:56Z")

</div>

Hello, I recently stumbled upon the following issue: using Flux m = Chain( Dense(100, 10, relu), Dense(10, 10)) |\> gpu s = (X = gpu(rand(100)), k = 0.99, y = gpu(rand(10))) # Works fine gs = gradient(() -\> log(s.k \*…

---

## [Sampling with replacement on GPU](https://discourse.julialang.org/t/sampling-with-replacement-on-gpu/56121)

<div class="topic-metadata">

**Author:** [@simsurace](https://discourse.julialang.org/u/simsurace)\
**Replies:** 5\
**Last updated:** [March 13, 2021, 8:05pm UTC](https://discourse.julialang.org/t/sampling-with-replacement-on-gpu/56121 "2021-03-13T20:05:51Z")

</div>

I have a CuArray with weights, i.e. each row is a weight vector (not necessarily normalized but this is easy to accomplish if needed). I want to draw number\_of\_column numbers in 1:number\_of\_columns for each of the rows i…

---

## [FFT planning with flags fails for CUDA](https://discourse.julialang.org/t/fft-planning-with-flags-fails-for-cuda/56870)

<div class="topic-metadata">

**Author:** [@roflmaostc](https://discourse.julialang.org/u/roflmaostc)\
**Replies:** 2\
**Last updated:** [March 10, 2021, 12:26pm UTC](https://discourse.julialang.org/t/fft-planning-with-flags-fails-for-cuda/56870 "2021-03-10T12:26:30Z")

</div>

Hey, I was trying to do a FFT plan for a CuArray. The following works: julia\> using CUDA, CUDA.CUFFT julia\> x = CUDA.rand(2, 2) 2×2 CuArray{Float32, 2}: 0.318697 0.144699 0.631969 0.433798 julia\> fft(x) 2×2 CuArr…

---

## [Fast GPU Kernels differentiable with Zygote](https://discourse.julialang.org/t/fast-gpu-kernels-differentiable-with-zygote/56756)

<div class="topic-metadata">

**Author:** [@roflmaostc](https://discourse.julialang.org/u/roflmaostc)\
**Replies:** 7\
**Last updated:** [March 9, 2021, 10:29am UTC](https://discourse.julialang.org/t/fast-gpu-kernels-differentiable-with-zygote/56756 "2021-03-09T10:29:15Z")

</div>

Hey, so far I was using Tullio.jl to generate array based regularizers which are also (very) fast using Zygote.jl. So as an example a Total Variation regularizer: reg(x) = @tullio res = sqrt(abs2(x\[i, j\] - x\[i+1, j\]) …

---

## [Directly applying CuFFT on StructArrays](https://discourse.julialang.org/t/directly-applying-cufft-on-structarrays/55977)

<div class="topic-metadata">

**Author:** [@weylspinor](https://discourse.julialang.org/u/weylspinor)\
**Replies:** 1\
**Last updated:** [February 25, 2021, 7:43am UTC](https://discourse.julialang.org/t/directly-applying-cufft-on-structarrays/55977 "2021-02-25T07:43:43Z")

</div>

I wonder if there is a way to use CuFFT directly on StructArrays{\<:Complex}. Currently, if I write e.g. using CUDA, StructArrays x\_re = rand(Float32, 10); x\_im = rand(Float32, 10); x = StructArray{ComplexF32}((x\_re,x\_im…

---

## [How to use \`copy!\`(or other array operations) inside a CUDA kernel?](https://discourse.julialang.org/t/how-to-use-copy-or-other-array-operations-inside-a-cuda-kernel/55762)

<div class="topic-metadata">

**Author:** [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Replies:** 7\
**Last updated:** [February 23, 2021, 9:34pm UTC](https://discourse.julialang.org/t/how-to-use-copy-or-other-array-operations-inside-a-cuda-kernel/55762 "2021-02-23T21:34:09Z")

</div>

I want to copy a column of matrix Y to another matrix X inside a custom kernel in ONE thread. X = CUDA.rand(10, 5) Y = CUDA.rand(10, 5); The following possible methods have been tried. - Method 1: error function kern…

---

## [Thread local storage is not implemented](https://discourse.julialang.org/t/thread-local-storage-is-not-implemented/46656)

<div class="topic-metadata">

**Author:** [@barrettp](https://discourse.julialang.org/u/barrettp)\
**Replies:** 4\
**Last updated:** [February 22, 2021, 12:53pm UTC](https://discourse.julialang.org/t/thread-local-storage-is-not-implemented/46656 "2021-02-22T12:53:50Z")

</div>

It would be nice to have “thread local storage” implemented at some point. It looks like it might be necessary for recursive kernel calls. I’m not really sure as I’m still rather new to CUDA programming.

---

## [Weird behavior in @cuda kernel dispatch](https://discourse.julialang.org/t/weird-behavior-in-cuda-kernel-dispatch/55724)

<div class="topic-metadata">

**Author:** [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Replies:** 2\
**Last updated:** [February 22, 2021, 2:51am UTC](https://discourse.julialang.org/t/weird-behavior-in-cuda-kernel-dispatch/55724 "2021-02-22T02:51:21Z")

</div>

Consider the following dummy kernel function that accepts an argument of type CuVector. julia\> using CUDA julia\> function my\_kernel(v::CuVector) nothing end my\_kernel (generic function with 1 method) …

---

## [How to make CUDA.jl work in WSL2](https://discourse.julialang.org/t/how-to-make-cuda-jl-work-in-wsl2/42474)

<div class="topic-metadata">

**Author:** [@zwwi](https://discourse.julialang.org/u/zwwi)\
**Replies:** 13\
**Last updated:** [February 21, 2021, 2:30pm UTC](https://discourse.julialang.org/t/how-to-make-cuda-jl-work-in-wsl2/42474 "2021-02-21T14:30:34Z")

</div>

I am using the WSL2 (Ubuntu) with version 4.19.121-microsoft-standard, and have installed the CUDA driver provided here: NVIDIA Drivers for CUDA on WSL. I also have installed nvidia-cuda-toolkit. I’m curious to know ho…

---

## [AMDGPU available for Windows?](https://discourse.julialang.org/t/amdgpu-available-for-windows/55547)

<div class="topic-metadata">

**Author:** [@MatsMor](https://discourse.julialang.org/u/MatsMor)\
**Replies:** 4\
**Last updated:** [February 18, 2021, 9:39pm UTC](https://discourse.julialang.org/t/amdgpu-available-for-windows/55547 "2021-02-18T21:39:40Z")

</div>

Does anyone know when the AMDGPU.jl package will be available for Windows? Right now, it is only available for Linux. Thxs!

---

## [Using GPU via PyCall causes non-reusable memory allocation](https://discourse.julialang.org/t/using-gpu-via-pycall-causes-non-reusable-memory-allocation/55140)

<div class="topic-metadata">

**Author:** [@JosePereiraUA](https://discourse.julialang.org/u/JosePereiraUA)\
**Replies:** 4\
**Last updated:** [February 16, 2021, 6:33pm UTC](https://discourse.julialang.org/t/using-gpu-via-pycall-causes-non-reusable-memory-allocation/55140 "2021-02-16T18:33:14Z")

</div>

My name is José Pereira, I’m a portuguese PhD student currently using Julia to develop a light-weight protein design package. I’m trying to implement TorchANI, a known ML model for molecular energy calculation, developed…

---

## [@cuda threads and blocks confusion](https://discourse.julialang.org/t/cuda-threads-and-blocks-confusion/54816)

<div class="topic-metadata">

**Author:** [@Ribeiro](https://discourse.julialang.org/u/Ribeiro)\
**Replies:** 9\
**Last updated:** [February 10, 2021, 8:20am UTC](https://discourse.julialang.org/t/cuda-threads-and-blocks-confusion/54816 "2021-02-10T08:20:24Z")

</div>

I would really appreciate some help in understanding the threads and blocks options when using @cuda. I read this: https://juliagpu.gitlab.io/CUDA.jl/tutorials/introduction/ and watched this GPU Programming in Julia - Y…

---

## [CUDA kernel: how to pass an array of functions](https://discourse.julialang.org/t/cuda-kernel-how-to-pass-an-array-of-functions/54784)

<div class="topic-metadata">

**Author:** [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Replies:** 7\
**Last updated:** [February 8, 2021, 3:42pm UTC](https://discourse.julialang.org/t/cuda-kernel-how-to-pass-an-array-of-functions/54784 "2021-02-08T15:42:13Z")

</div>

I am working on genetic programming, where I need to pick a function from a set of functions fs by an integer index in each node of the tree. An example demonstrating the difficulty I encountered is given below. using C…

---

## [Optimizing CUDA.jl performance for small array operations](https://discourse.julialang.org/t/optimizing-cuda-jl-performance-for-small-array-operations/54808)

<div class="topic-metadata">

**Author:** [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Replies:** 5\
**Last updated:** [February 8, 2021, 1:02pm UTC](https://discourse.julialang.org/t/optimizing-cuda-jl-performance-for-small-array-operations/54808 "2021-02-08T13:02:58Z")

</div>

Hi, I’m trying to get better GPU performance with CUDA.jl for small array operations. So, I’ve started to port SymbolicRegression.jl to the GPU using CUDA.jl. It seems I’ve gotten the main evaluation part of the code t…

---

## [Elegant kernel for vectors in matrix](https://discourse.julialang.org/t/elegant-kernel-for-vectors-in-matrix/54648)

<div class="topic-metadata">

**Author:** [@Ribeiro](https://discourse.julialang.org/u/Ribeiro)\
**Replies:** 3\
**Last updated:** [February 5, 2021, 12:57pm UTC](https://discourse.julialang.org/t/elegant-kernel-for-vectors-in-matrix/54648 "2021-02-05T12:57:32Z")

</div>

Hello, I’m trying to write a kernel that does some operations on vectors using CUDA.jl and @cuda. My code is essentially this: points = Nx3 matrix with x,y,z coordinates of points elements = Nx4 matrix with integers th…

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

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