# GPU

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

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

**Page:** 16

---

## [KernelAbstractions is slower than CUDA](https://discourse.julialang.org/t/kernelabstractions-is-slower-than-cuda/76473)

<div class="topic-metadata">

**Author:** [@fedoroff](https://discourse.julialang.org/u/fedoroff)\
**Replies:** 8\
**Last updated:** [November 10, 2022, 8:01pm UTC](https://discourse.julialang.org/t/kernelabstractions-is-slower-than-cuda/76473 "2022-11-10T20:01:42Z")

</div>

Hello, For a simple multiplication as in the example below I see that the kernel written with KernelAbstractions is almost twice slower than the one written with pure CUDA. Am I doing something wrong, or KA indeed intro…

---

## [Problem with running Julia 1.6.7 with CUDA 11.7](https://discourse.julialang.org/t/problem-with-running-julia-1-6-7-with-cuda-11-7/87596)

<div class="topic-metadata">

**Author:** [@hpaldan](https://discourse.julialang.org/u/hpaldan)\
**Replies:** 8\
**Last updated:** [October 14, 2022, 3:19pm UTC](https://discourse.julialang.org/t/problem-with-running-julia-1-6-7-with-cuda-11-7/87596 "2022-10-14T15:19:31Z")

</div>

I have a problem with running CUDA on Julia and can’t figure out what is going wrong. Allocating seems to work fine but any kind of operation creates large bug reports. using CUDA CUDA.functional() # returns true N = 2^…

---

## [Cub library functions in cuda.jl](https://discourse.julialang.org/t/cub-library-functions-in-cuda-jl/88476)

<div class="topic-metadata">

**Author:** [@nethaji8](https://discourse.julialang.org/u/nethaji8)\
**Replies:** 5\
**Last updated:** [October 11, 2022, 5:02pm UTC](https://discourse.julialang.org/t/cub-library-functions-in-cuda-jl/88476 "2022-10-11T17:02:02Z")

</div>

Hi everyone, I am trying to implement block-level reduction operations in the Cuda Julia kernel. Does Julia has “cub” kind of device-level functions…? How can I use the cub library device intrinsics for the following …

---

## [Comprehensive list of functions (maths, etc) available in CUDA.jl](https://discourse.julialang.org/t/comprehensive-list-of-functions-maths-etc-available-in-cuda-jl/88459)

<div class="topic-metadata">

**Author:** [@taxodium](https://discourse.julialang.org/u/taxodium)\
**Replies:** 3\
**Last updated:** [October 10, 2022, 11:58am UTC](https://discourse.julialang.org/t/comprehensive-list-of-functions-maths-etc-available-in-cuda-jl/88459 "2022-10-10T11:58:35Z")

</div>

Hi, After a bit of search, I haven’t been able to find a complete list of functions (particularly, maths functions) natively implemented in CUDA.jl. Sure, obvious ones like cos, sin, sqrt, exp are there, but the only an…

---

## [Rotr90 of a CUDA.CuArray](https://discourse.julialang.org/t/rotr90-of-a-cuda-cuarray/88308)

<div class="topic-metadata">

**Author:** [@leifdenby](https://discourse.julialang.org/u/leifdenby)\
**Replies:** 5\
**Last updated:** [October 6, 2022, 10:16am UTC](https://discourse.julialang.org/t/rotr90-of-a-cuda-cuarray/88308 "2022-10-06T10:16:38Z")

</div>

I’m trying to implement a neural network which rotates the image within the layers of the network. My question is: is there a way to use something like Base.rotr90 on a CUDA.CuArray while disabling scalar indexing (CUDA.…

---

## [Neural Nets training with multiple Chains Lux.jl and CUDA.jl](https://discourse.julialang.org/t/neural-nets-training-with-multiple-chains-lux-jl-and-cuda-jl/88167)

<div class="topic-metadata">

**Author:** [@LeoCott](https://discourse.julialang.org/u/LeoCott)\
**Replies:** 5\
**Last updated:** [October 5, 2022, 10:30am UTC](https://discourse.julialang.org/t/neural-nets-training-with-multiple-chains-lux-jl-and-cuda-jl/88167 "2022-10-05T10:30:51Z")

</div>

Hi all, I am a GPU beginner so I probably ask something obvious. I defined a neural net with four Lux.jl chains: input\_ = 2 n = 20 chain1 = Lux.Chain(Dense(input\_,n,Lux.σ),Dense(n,n,Lux.σ),Dense(n,n,Lux.σ),Dense(n,n,L…

---

## [Create static vector of variable lenght in gpu kernel](https://discourse.julialang.org/t/create-static-vector-of-variable-lenght-in-gpu-kernel/87863)

<div class="topic-metadata">

**Author:** [@ykkan](https://discourse.julialang.org/u/ykkan)\
**Replies:** 2\
**Last updated:** [September 27, 2022, 8:59pm UTC](https://discourse.julialang.org/t/create-static-vector-of-variable-lenght-in-gpu-kernel/87863 "2022-09-27T20:59:10Z")

</div>

Are there any ways to create a static vector of variable length for each thread in a gpu kernel? I tried this but it didn’t work. function dosomething(n) vec = @MVector zeros(n) end @cuda threads=5 dosomething(n) …

---

## [Calling Flux.gpu downloads CUDNN artifact every first call in REPL/script](https://discourse.julialang.org/t/calling-flux-gpu-downloads-cudnn-artifact-every-first-call-in-repl-script/87784)

<div class="topic-metadata">

**Author:** [@linkz](https://discourse.julialang.org/u/linkz)\
**Replies:** 6\
**Last updated:** [September 27, 2022, 8:58am UTC](https://discourse.julialang.org/t/calling-flux-gpu-downloads-cudnn-artifact-every-first-call-in-repl-script/87784 "2022-09-27T08:58:40Z")

</div>

Pretty much as the title says. Whenever I call e.g. Import Flux d\_gpu = Flux.gpu(Flux.Dense(10, 10)) ┌ Warning: The NVIDIA driver on this system only supports up to CUDA 11.0.0. │ For performance reasons, it is recommen…

---

## [Demo: Example of CUDA/OpenGL interop in Julia](https://discourse.julialang.org/t/demo-example-of-cuda-opengl-interop-in-julia/87830)

<div class="topic-metadata">

**Author:** [@erikedin](https://discourse.julialang.org/u/erikedin)\
**Replies:** 0\
**Last updated:** [September 26, 2022, 6:30pm UTC](https://discourse.julialang.org/t/demo-example-of-cuda-opengl-interop-in-julia/87830 "2022-09-26T18:30:44Z")

</div>

Hello! I’m working to learn a bit about graphics and CUDA programming in Julia. I made an effort to use GLFW and OpenGL to open create a window, and render graphics to that window from a CUDA kernel. I’ve seen that othe…

---

## [Kernel fails when number of blocks exceeds number of SM's (?)](https://discourse.julialang.org/t/kernel-fails-when-number-of-blocks-exceeds-number-of-sms/87800)

<div class="topic-metadata">

**Author:** [@lodygaw](https://discourse.julialang.org/u/lodygaw)\
**Replies:** 3\
**Last updated:** [September 26, 2022, 2:11pm UTC](https://discourse.julialang.org/t/kernel-fails-when-number-of-blocks-exceeds-number-of-sms/87800 "2022-09-26T14:11:40Z")

</div>

Hi, I want to write a kernel that will filter values in input arrays of predefined length based on some condition. Also, I would like to have “good” values (which fulfill the condition) at the beginning of this arrays. …

---

## [Vulkan.jl crashes with ERROR\_INCOMPATIBLE\_DRIVER](https://discourse.julialang.org/t/vulkan-jl-crashes-with-error-incompatible-driver/87742)

<div class="topic-metadata">

**Author:** [@minetest2048](https://discourse.julialang.org/u/minetest2048)\
**Replies:** 0\
**Last updated:** [September 24, 2022, 12:42pm UTC](https://discourse.julialang.org/t/vulkan-jl-crashes-with-error-incompatible-driver/87742 "2022-09-24T12:42:41Z")

</div>

I’m on Arch Linux with Julia installed from official source through AUR (not through pacman), and I have RX 6700 XT with definitely working drivers (I played several hundred hours of Steam games through DXVK) When I tri…

---

## [Dreaded CuArray only supports element types that are stored inline](https://discourse.julialang.org/t/dreaded-cuarray-only-supports-element-types-that-are-stored-inline/87100)

<div class="topic-metadata">

**Author:** [@Allan\_Baker](https://discourse.julialang.org/u/Allan_Baker)\
**Replies:** 10\
**Last updated:** [September 22, 2022, 8:37pm UTC](https://discourse.julialang.org/t/dreaded-cuarray-only-supports-element-types-that-are-stored-inline/87100 "2022-09-22T20:37:33Z")

</div>

GPU noob. I’ve simplified my problem here. I have a compression type which basically has information that yields the correct phase adjustment. But it is an abstract composite type which could have various memory footp…

---

## [Failed to compile PTX code when using NSight on Win11](https://discourse.julialang.org/t/failed-to-compile-ptx-code-when-using-nsight-on-win11/87607)

<div class="topic-metadata">

**Author:** [@jamblejoe](https://discourse.julialang.org/u/jamblejoe)\
**Replies:** 1\
**Last updated:** [September 22, 2022, 8:33pm UTC](https://discourse.julialang.org/t/failed-to-compile-ptx-code-when-using-nsight-on-win11/87607 "2022-09-22T20:33:22Z")

</div>

A = CUDA.rand(100,100) sin.(A) works for normally started Julia process but errors when started in NVIDIA NSight 22.4.1 on Windows 11 julia\> sin.(A) ERROR: Failed to compile PTX code (ptxas exited with code 3221225477)…

---

## [CSR matrices in CUDA.jl](https://discourse.julialang.org/t/csr-matrices-in-cuda-jl/87388)

<div class="topic-metadata">

**Author:** [@jamblejoe](https://discourse.julialang.org/u/jamblejoe)\
**Replies:** 2\
**Last updated:** [September 21, 2022, 8:41pm UTC](https://discourse.julialang.org/t/csr-matrices-in-cuda-jl/87388 "2022-09-21T20:41:41Z")

</div>

I can create CSC matrices on the GPU, e.g. via cu(sprand(10,10,0.1)). How do I create CSR matrices? How do I convert a CSC into a CSR matrix on the CPU or GPU? I want to use csreigvsi, which requires CSR storage structu…

---

## [Custom CUDA kernel for nontrivial sum calculations](https://discourse.julialang.org/t/custom-cuda-kernel-for-nontrivial-sum-calculations/87466)

<div class="topic-metadata">

**Author:** [@fedoroff](https://discourse.julialang.org/u/fedoroff)\
**Replies:** 2\
**Last updated:** [September 20, 2022, 11:11am UTC](https://discourse.julialang.org/t/custom-cuda-kernel-for-nontrivial-sum-calculations/87466 "2022-09-20T11:11:49Z")

</div>

Suppose I want to calculate the following sum: C\_{nm}=\\sum\_i A\_{ni}B\_{im} (in reality, something more complicated). The corresponding code could be function cpu\_add!(C, A, B) @. C = 0 for i in axes(A,1) …

---

## [GPU-Kernel Profiling](https://discourse.julialang.org/t/gpu-kernel-profiling/87468)

<div class="topic-metadata">

**Author:** [@Julien\_A](https://discourse.julialang.org/u/Julien_A)\
**Replies:** 1\
**Last updated:** [September 20, 2022, 6:47am UTC](https://discourse.julialang.org/t/gpu-kernel-profiling/87468 "2022-09-20T06:47:10Z")

</div>

Hello, i’m currently profiling a Julia deep learning project, mainly executed on the GPU. Using nvprof i get following profiling result: ==7880== Profiling result: Type Time(%) Time Calls Avg…

---

## [Broadcast question](https://discourse.julialang.org/t/broadcast-question/87210)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 2\
**Last updated:** [September 19, 2022, 3:09am UTC](https://discourse.julialang.org/t/broadcast-question/87210 "2022-09-19T03:09:04Z")

</div>

I got this off CUDA.jl…/test/texture.jl (altered a bit) Tex = @pipe rand(Float32,10) |\> CuTextureArray |\> CuTexture(\_, interpolation=CUDA.LinearInterpolation()) Idx = rand(Float32,10) .+1 |\> CuArray …

---

## [Mapslices very slow](https://discourse.julialang.org/t/mapslices-very-slow/86826)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 3\
**Last updated:** [September 13, 2022, 11:56am UTC](https://discourse.julialang.org/t/mapslices-very-slow/86826 "2022-09-13T11:56:53Z")

</div>

new to CUDA mapsilces seems to run very slow. reduce is very fast but requires an accumulator (e.g. +) instead of a function (e.g. sum). I’d like to apply the linear\_interpolation function to slices of a matrix (or t…

---

## [BitVector Adapt GPUs](https://discourse.julialang.org/t/bitvector-adapt-gpus/86500)

<div class="topic-metadata">

**Author:** [@Allan\_Baker](https://discourse.julialang.org/u/Allan_Baker)\
**Replies:** 25\
**Last updated:** [September 11, 2022, 9:52pm UTC](https://discourse.julialang.org/t/bitvector-adapt-gpus/86500 "2022-09-11T21:52:54Z")

</div>

I have a custom type which contains a BitVector. struct customType{T\<:AbstractFloat} code::BitVector s\_chipLength::T … end I’m trying to use Adapt.@adapt\_structure customType{Float64} It still fails with isbitstyp…

---

## [Usage of CUDA.CUFFT.cufftPlanMany](https://discourse.julialang.org/t/usage-of-cuda-cufft-cufftplanmany/86403)

<div class="topic-metadata">

**Author:** [@gerhardu](https://discourse.julialang.org/u/gerhardu)\
**Replies:** 1\
**Last updated:** [August 30, 2022, 6:32pm UTC](https://discourse.julialang.org/t/usage-of-cuda-cufft-cufftplanmany/86403 "2022-08-30T18:32:41Z")

</div>

Hi, I need to calculate approx 600 FFT’s of 3 dimensional arrays (e.g. 128^3). I know how to do this on CPUs and also how to do this sequentially on a GPU. By sequentially I mean that I copy one of the 600 arrays to t…

---

## [Converting an image rotation demo from JuliaCon 2021 (AMD -\> NVIDIA)](https://discourse.julialang.org/t/converting-an-image-rotation-demo-from-juliacon-2021-amd-nvidia/86365)

<div class="topic-metadata">

**Author:** [@aaron\_pung](https://discourse.julialang.org/u/aaron_pung)\
**Replies:** 3\
**Last updated:** [August 29, 2022, 7:32pm UTC](https://discourse.julialang.org/t/converting-an-image-rotation-demo-from-juliacon-2021-amd-nvidia/86365 "2022-08-29T19:32:02Z")

</div>

I’ve been trying to convert the rotate\_kernel function from the 2021 JuliaCon GPU Workshop to work with CUDA, but I’m having trouble. I’m new to building kernels on the GPU, but my current implementation of these functi…

---

## [Error using CuIterator with Flux.train!](https://discourse.julialang.org/t/error-using-cuiterator-with-flux-train/86436)

<div class="topic-metadata">

**Author:** [@taotree](https://discourse.julialang.org/u/taotree)\
**Replies:** 2\
**Last updated:** [August 29, 2022, 1:54pm UTC](https://discourse.julialang.org/t/error-using-cuiterator-with-flux-train/86436 "2022-08-29T13:54:59Z")

</div>

I’m trying to use CuIterator and Flux.train!. Attempting to do so gives an error because train! tries to get the length of the CuIterator. So this: iter = CuIterator(batch(i) for i in 1:BATCH\_COUNT) Flux.train!(loss, ps…

---

## [Custom backpropagation rule on GPU](https://discourse.julialang.org/t/custom-backpropagation-rule-on-gpu/86459)

<div class="topic-metadata">

**Author:** [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Replies:** 2\
**Last updated:** [August 29, 2022, 8:23am UTC](https://discourse.julialang.org/t/custom-backpropagation-rule-on-gpu/86459 "2022-08-29T08:23:37Z")

</div>

Hello I am trying to define the custom Chainrules rrule to be able to use Enzyme on selected functions for backpropagation done generally with Zygote . Kernel and taking derivatives using enzyme works. However, taking ja…

---

## [Simple CuArray conversion, reverse, and transpose taking too long?](https://discourse.julialang.org/t/simple-cuarray-conversion-reverse-and-transpose-taking-too-long/86337)

<div class="topic-metadata">

**Author:** [@aaron\_pung](https://discourse.julialang.org/u/aaron_pung)\
**Replies:** 3\
**Last updated:** [August 29, 2022, 7:57am UTC](https://discourse.julialang.org/t/simple-cuarray-conversion-reverse-and-transpose-taking-too-long/86337 "2022-08-29T07:57:03Z")

</div>

I am ingesting a NetCDF file using the NCDatasets package; the resulting array of type Matrix{Float32} has size (32768,1000). Afterwards, I’m converting the array to a CuArray: \`\`\`using CUDA using NCDatasets CUDA.allow…

---

## [Enzyme.jl plus parallelstencil.jl?](https://discourse.julialang.org/t/enzyme-jl-plus-parallelstencil-jl/84310)

<div class="topic-metadata">

**Author:** [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Replies:** 5\
**Last updated:** [August 22, 2022, 6:09am UTC](https://discourse.julialang.org/t/enzyme-jl-plus-parallelstencil-jl/84310 "2022-08-22T06:09:25Z")

</div>

Anybody tried parallelstencil.jl cuda kernels differentiation with enzyme.jl ? Since python 1.7 enzyme supports Cuda.jl kernels so in pronciple I suppose it should be possible ?

---

## [Best way to use CuSparseMatrixBSR](https://discourse.julialang.org/t/best-way-to-use-cusparsematrixbsr/86075)

<div class="topic-metadata">

**Author:** [@April-Hannah-Lena](https://discourse.julialang.org/u/April-Hannah-Lena)\
**Replies:** 7\
**Last updated:** [August 21, 2022, 9:42am UTC](https://discourse.julialang.org/t/best-way-to-use-cusparsematrixbsr/86075 "2022-08-21T09:42:12Z")

</div>

I’ve been writing a set of kernels in which I calculate many small (mostly on the order of ~10x10) square matrices column by column, like in this toy example using CUDA # each slice L\[:, :, j\] is a matrix of interest L…

---

## [AMDGPU.jl has made such amazing progress over the last year!](https://discourse.julialang.org/t/amdgpu-jl-has-made-such-amazing-progress-over-the-last-year/75333)

<div class="topic-metadata">

**Author:** [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Replies:** 16\
**Last updated:** [August 18, 2022, 2:43pm UTC](https://discourse.julialang.org/t/amdgpu-jl-has-made-such-amazing-progress-over-the-last-year/75333 "2022-08-18T14:43:07Z")

</div>

I tried AMDGPU.jl last year for my 580 Radeon GPU and it was a chore to set everything up, even for a competent sysadmin. I tried it today, and I am amazed how great it is! I have a moderately recent Linux kernel (update…

---

## [How to run many copies of a random function in parallel on GPU?](https://discourse.julialang.org/t/how-to-run-many-copies-of-a-random-function-in-parallel-on-gpu/85602)

<div class="topic-metadata">

**Author:** [@GeekyPeas](https://discourse.julialang.org/u/GeekyPeas)\
**Replies:** 5\
**Last updated:** [August 11, 2022, 7:02am UTC](https://discourse.julialang.org/t/how-to-run-many-copies-of-a-random-function-in-parallel-on-gpu/85602 "2022-08-11T07:02:25Z")

</div>

Consider this “embarrassingly parallel” and fairly general problem: You have a random function f (such as a random number generator, or a sampling procedure, or a run of a Markov Chain, or a Jump Process) that is imple…

---

## [Help setting up CUDA.jl and cuTENSORS](https://discourse.julialang.org/t/help-setting-up-cuda-jl-and-cutensors/85505)

<div class="topic-metadata">

**Author:** [@apateonas](https://discourse.julialang.org/u/apateonas)\
**Replies:** 1\
**Last updated:** [August 9, 2022, 8:21am UTC](https://discourse.julialang.org/t/help-setting-up-cuda-jl-and-cutensors/85505 "2022-08-09T08:21:03Z")

</div>

Hi all, I am having trouble using CUDA.jl and cuTENSOR and would appreciate your help. I’m looking to use the ITensors.jl library with GPU acceleration (via ITensorGPU), which uses CUDA and cuTENSORS. I am running this …

---

## [Significant CUDA.jl memory allocations outside of main pool?](https://discourse.julialang.org/t/significant-cuda-jl-memory-allocations-outside-of-main-pool/59991)

<div class="topic-metadata">

**Author:** [@jpdoane](https://discourse.julialang.org/u/jpdoane)\
**Replies:** 2\
**Last updated:** [August 6, 2022, 7:35pm UTC](https://discourse.julialang.org/t/significant-cuda-jl-memory-allocations-outside-of-main-pool/59991 "2022-08-06T19:35:53Z")

</div>

I have been benchmarking various CUDA.jl kernels with large CuArrays, and have been experiencing out of GPU memory errors after running the same function repeatedly. CUDA.jl seems to be holding onto significant amounts o…

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

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