# GPU

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

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

**Page:** 3

---

## [Batched Hessian-Vector Product (on the GPU)](https://discourse.julialang.org/t/batched-hessian-vector-product-on-the-gpu/130372)

<div class="topic-metadata">

**Author:** [@eblumen](https://discourse.julialang.org/u/eblumen)\
**Replies:** 0\
**Last updated:** [July 1, 2025, 2:30pm UTC](https://discourse.julialang.org/t/batched-hessian-vector-product-on-the-gpu/130372 "2025-07-01T14:30:38Z")

</div>

Hello, I am trying to implement a sort of ‘batched’ HVP. Here’s the setup: consider some collection of particle positions x\_{i,\\alpha,\\beta,\\gamma} where i = 1,\\ldots, d is a coordinate index, and \\alpha,\\beta,\\gamma in…

---

## [Relation between KernelAbstractions and Adapt](https://discourse.julialang.org/t/relation-between-kernelabstractions-and-adapt/130326)

<div class="topic-metadata">

**Author:** [@bmxam](https://discourse.julialang.org/u/bmxam)\
**Replies:** 1\
**Last updated:** [June 30, 2025, 7:28pm UTC](https://discourse.julialang.org/t/relation-between-kernelabstractions-and-adapt/130326 "2025-06-30T19:28:17Z")

</div>

Hi everyone, I’m trying to move some operations of an existing package on GPU using KernelAbstractions. Since my package defines custom structs, I had to Adapt them, specializing adapt\_structure. Everything works fine …

---

## [Cannot manage to use CUDA.atomic\_add!](https://discourse.julialang.org/t/cannot-manage-to-use-cuda-atomic-add/130328)

<div class="topic-metadata">

**Author:** [@Ludovic\_Dumoulin](https://discourse.julialang.org/u/Ludovic_Dumoulin)\
**Replies:** 4\
**Last updated:** [June 30, 2025, 7:24pm UTC](https://discourse.julialang.org/t/cannot-manage-to-use-cuda-atomic-add/130328 "2025-06-30T19:24:40Z")

</div>

Hello, I want to place particles into a 10x10 grid. To do this, I would like to use CUDA.atomic\_add!() to count how many particles land in each cell. Here is a minimal example: using CUDA function kernel\_test\_atomicad…

---

## [Heterogeneous random seeding](https://discourse.julialang.org/t/heterogeneous-random-seeding/130196)

<div class="topic-metadata">

**Author:** [@0samuraiE](https://discourse.julialang.org/u/0samuraiE)\
**Replies:** 1\
**Last updated:** [June 25, 2025, 3:00pm UTC](https://discourse.julialang.org/t/heterogeneous-random-seeding/130196 "2025-06-25T15:00:20Z")

</div>

Hello all, Is there a unified way to set the random seed across heterogeneous devices, such as CPU and GPU? I’d be happy if GPUArrays.jl or KernelAbstractions.jl provides such a method. julia\> using CUDA julia\> using…

---

## [AMDGPU on AI HX370 versioninfo() crashes](https://discourse.julialang.org/t/amdgpu-on-ai-hx370-versioninfo-crashes/129733)

<div class="topic-metadata">

**Author:** [@jdad](https://discourse.julialang.org/u/jdad)\
**Replies:** 4\
**Last updated:** [June 8, 2025, 5:12pm UTC](https://discourse.julialang.org/t/amdgpu-on-ai-hx370-versioninfo-crashes/129733 "2025-06-08T17:12:12Z")

</div>

I try to use my Asus-Vivobook S16 which has an AMD AI HX370 CPU/GPU (gfx1150) . I installed ROCM under Ubuntu 24.04 davidj@vivoai:~$ rocminfo ROCk module version 6.12.12 is loaded ========== HSA Agents …

---

## [CUDA | custom structs](https://discourse.julialang.org/t/cuda-custom-structs/129579)

<div class="topic-metadata">

**Author:** [@Audrius-St](https://discourse.julialang.org/u/Audrius-St)\
**Replies:** 3\
**Last updated:** [June 6, 2025, 6:45pm UTC](https://discourse.julialang.org/t/cuda-custom-structs/129579 "2025-06-06T18:45:00Z")

</div>

Edit and update: 2025-June-4 Hello, I’m working on converting the following custom struct # test\_struct\_CUDA.jl using FFTW Base.@kwdef struct FourierTransformPlan3D{n\_rows, n\_cols, n\_slices} # FT frequency shif…

---

## [Why is my GPU kernel an order of magnitude slower than my CPU function?](https://discourse.julialang.org/t/why-is-my-gpu-kernel-an-order-of-magnitude-slower-than-my-cpu-function/129596)

<div class="topic-metadata">

**Author:** [@jwtkeeble](https://discourse.julialang.org/u/jwtkeeble)\
**Replies:** 8\
**Last updated:** [June 4, 2025, 1:41pm UTC](https://discourse.julialang.org/t/why-is-my-gpu-kernel-an-order-of-magnitude-slower-than-my-cpu-function/129596 "2025-06-04T13:41:39Z")

</div>

Hi All, I’m relatively new to Julia and I’ve been trying to benchmark a nested-loop function over 2 arrays, on both the CPU and GPU, however, the CPU version is significantly quicker. Now, I’m sure that this is due to …

---

## [KernelAbstractions.get\_backend(::BitArray) causes StackOverflowError](https://discourse.julialang.org/t/kernelabstractions-get-backend-bitarray-causes-stackoverflowerror/129551)

<div class="topic-metadata">

**Author:** [@0samuraiE](https://discourse.julialang.org/u/0samuraiE)\
**Replies:** 1\
**Last updated:** [June 2, 2025, 9:23am UTC](https://discourse.julialang.org/t/kernelabstractions-get-backend-bitarray-causes-stackoverflowerror/129551 "2025-06-02T09:23:57Z")

</div>

Hi all, I’m using KernelAbstractions.jl, and encountered a StackOverflowError when trying to call get\_backend on a BitArray (e.g., from a comparison like .\<): using KernelAbstractions x = rand(10) msk = x .\< 0.5 get\_ba…

---

## [Porting cuda example to rocm amdgpu](https://discourse.julialang.org/t/porting-cuda-example-to-rocm-amdgpu/129545)

<div class="topic-metadata">

**Author:** [@jcbritobr](https://discourse.julialang.org/u/jcbritobr)\
**Replies:** 0\
**Last updated:** [June 2, 2025, 12:35am UTC](https://discourse.julialang.org/t/porting-cuda-example-to-rocm-amdgpu/129545 "2025-06-02T00:35:00Z")

</div>

Hello, good evening. May someone help to show me how to start porting this example to use amdgpu.jl?

---

## [\`check-bounds=no\` causes illegal memory access when using \`rand()\` in CUDA kernel](https://discourse.julialang.org/t/check-bounds-no-causes-illegal-memory-access-when-using-rand-in-cuda-kernel/129455)

<div class="topic-metadata">

**Author:** [@0samuraiE](https://discourse.julialang.org/u/0samuraiE)\
**Replies:** 3\
**Last updated:** [May 31, 2025, 7:38am UTC](https://discourse.julialang.org/t/check-bounds-no-causes-illegal-memory-access-when-using-rand-in-cuda-kernel/129455 "2025-05-31T07:38:44Z")

</div>

I’m encountering an error when running the following minimal example with check-bounds=no. With bounds checking enabled (check-bounds=yes), it works fine. But disabling it causes: ERROR: CUDA error: an illegal memory ac…

---

## [Current state of Metal.jl for ML and SciML](https://discourse.julialang.org/t/current-state-of-metal-jl-for-ml-and-sciml/129476)

<div class="topic-metadata">

**Author:** [@Bizzi](https://discourse.julialang.org/u/Bizzi)\
**Replies:** 2\
**Last updated:** [May 30, 2025, 7:59pm UTC](https://discourse.julialang.org/t/current-state-of-metal-jl-for-ml-and-sciml/129476 "2025-05-30T19:59:28Z")

</div>

How feasible is using Apple Metal and Metal.jl for machine learning work? Metal.jl’s README says The package is a work-in-progress. There are bugs, functionality is missing, and performance hasn’t been optimized. Expec…

---

## [CUDA suddenly crashes with check-bounds=no, used to work fine](https://discourse.julialang.org/t/cuda-suddenly-crashes-with-check-bounds-no-used-to-work-fine/129245)

<div class="topic-metadata">

**Author:** [@0samuraiE](https://discourse.julialang.org/u/0samuraiE)\
**Replies:** 1\
**Last updated:** [May 30, 2025, 9:43am UTC](https://discourse.julialang.org/t/cuda-suddenly-crashes-with-check-bounds-no-used-to-work-fine/129245 "2025-05-30T09:43:52Z")

</div>

Hi all, I have some code that used to work perfectly fine with check-bounds=no, but recently it started crashing with a bounds error. If I run it with check-bounds=yes, it works without any issues. I noticed that the s…

---

## [Unusually Slow First Device-to-Host Copy on A100 GPU](https://discourse.julialang.org/t/unusually-slow-first-device-to-host-copy-on-a100-gpu/129348)

<div class="topic-metadata">

**Author:** [@magicura](https://discourse.julialang.org/u/magicura)\
**Replies:** 6\
**Last updated:** [May 27, 2025, 8:57pm UTC](https://discourse.julialang.org/t/unusually-slow-first-device-to-host-copy-on-a100-gpu/129348 "2025-05-27T20:57:54Z")

</div>

Hi everyone, I’m running into an issue where the first attempt to copy data from the device to the host is extremely slow. This problem persists even after running the function multiple times, so I don’t think it’s rela…

---

## [AdaptiveCpp integration?](https://discourse.julialang.org/t/adaptivecpp-integration/129070)

<div class="topic-metadata">

**Author:** [@Oblomov](https://discourse.julialang.org/u/Oblomov)\
**Replies:** 9\
**Last updated:** [May 20, 2025, 10:34am UTC](https://discourse.julialang.org/t/adaptivecpp-integration/129070 "2025-05-20T10:34:47Z")

</div>

Hi all, I’ve recently started looking at AdaptiveCpp for some of my C++ work, and‌ I’m starting to get a feeling that this would be an excellent fit for Julia’s GPGPU. For those who don’t know, AdaptiveCpp, formerly kn…

---

## [Ragged Tensors with generic GPU code](https://discourse.julialang.org/t/ragged-tensors-with-generic-gpu-code/129134)

<div class="topic-metadata">

**Author:** [@BSchilperoort](https://discourse.julialang.org/u/BSchilperoort)\
**Replies:** 2\
**Last updated:** [May 20, 2025, 10:24am UTC](https://discourse.julialang.org/t/ragged-tensors-with-generic-gpu-code/129134 "2025-05-20T10:24:50Z")

</div>

I am working on porting (parts of) a hydrological model to GPU, to improve performance. This is largely going well because of the KernelAbstractions and AcceleratedKernels packages, which make it quite straightforward to…

---

## [GPU is slower than CPU for findall on a CuArray](https://discourse.julialang.org/t/gpu-is-slower-than-cpu-for-findall-on-a-cuarray/128916)

<div class="topic-metadata">

**Author:** [@jtoledom](https://discourse.julialang.org/u/jtoledom)\
**Replies:** 2\
**Last updated:** [May 14, 2025, 12:02am UTC](https://discourse.julialang.org/t/gpu-is-slower-than-cpu-for-findall-on-a-cuarray/128916 "2025-05-14T00:02:17Z")

</div>

I’m writing a code to generate Von Mises random numbers based on this method which is free of accept/reject. It is based on this paper. This issue appears to be with findall. Anyone can reproduce the behaviour by using…

---

## [CUDA | nested loops kernel](https://discourse.julialang.org/t/cuda-nested-loops-kernel/128812)

<div class="topic-metadata">

**Author:** [@Audrius-St](https://discourse.julialang.org/u/Audrius-St)\
**Replies:** 5\
**Last updated:** [May 12, 2025, 4:25pm UTC](https://discourse.julialang.org/t/cuda-nested-loops-kernel/128812 "2025-05-12T16:25:28Z")

</div>

Hello, As part of learning to use CUDA in Julia, I wrote the following MWE to compare threaded CPU, CUDA array programming, and CUDA kernel programming performance for a simple element by element array multiplication. …

---

## [Warning: Package cuDNN not found in current path](https://discourse.julialang.org/t/warning-package-cudnn-not-found-in-current-path/104242)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 5\
**Last updated:** [May 8, 2025, 10:22pm UTC](https://discourse.julialang.org/t/warning-package-cudnn-not-found-in-current-path/104242 "2025-05-08T22:22:09Z")

</div>

I get this warning while using Flux on a CUDA GPU: ┌ Warning: Package cuDNN not found in current path. │ - Run \`import Pkg; Pkg.add("cuDNN")\` to install the cuDNN package, then restart julia. │ - If cuDNN is not install…

---

## [Errors reported during Pkg.test("CUDA")](https://discourse.julialang.org/t/errors-reported-during-pkg-test-cuda/128316)

<div class="topic-metadata">

**Author:** [@Audrius-St](https://discourse.julialang.org/u/Audrius-St)\
**Replies:** 6\
**Last updated:** [April 28, 2025, 5:45pm UTC](https://discourse.julialang.org/t/errors-reported-during-pkg-test-cuda/128316 "2025-04-28T17:45:17Z")

</div>

Hello, While I’ve been using Julia for a number of years now, this is my first attempt to use CUDA with Julia. I’ve encountered some errors while running the tests. OS: Windows 11 | Version 10.0.26120 Build 26120 juli…

---

## [Getting GPU info](https://discourse.julialang.org/t/getting-gpu-info/30913)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 4\
**Last updated:** [April 24, 2025, 11:41am UTC](https://discourse.julialang.org/t/getting-gpu-info/30913 "2025-04-24T11:41:40Z")

</div>

Hi folks, I’m kinda starting with all this CUDA stuff, and am working with different GPUs on different computers (home, work, etc…). I’m building my first kernels, and one of the things that I need to know is the size o…

---

## [CUDA(.jl) memory errors for very large kernels](https://discourse.julialang.org/t/cuda-jl-memory-errors-for-very-large-kernels/125831)

<div class="topic-metadata">

**Author:** [@AntonReinhard](https://discourse.julialang.org/u/AntonReinhard)\
**Replies:** 24\
**Last updated:** [April 22, 2025, 6:45pm UTC](https://discourse.julialang.org/t/cuda-jl-memory-errors-for-very-large-kernels/125831 "2025-04-22T18:45:39Z")

</div>

I have some questions about what some CUDA errors mean and what I can do about them. I’m dynamically generating code that I can successfully compile for both CPU and GPU targets (the GPU I’m using here is an A30 with 24…

---

## [Val{N} + LinearIndices Causes Massive Compile-Time Unrolling](https://discourse.julialang.org/t/val-n-linearindices-causes-massive-compile-time-unrolling/128248)

<div class="topic-metadata">

**Author:** [@0samuraiE](https://discourse.julialang.org/u/0samuraiE)\
**Replies:** 2\
**Last updated:** [April 20, 2025, 2:47pm UTC](https://discourse.julialang.org/t/val-n-linearindices-causes-massive-compile-time-unrolling/128248 "2025-04-20T14:47:46Z")

</div>

I’m seeing strange behavior when using @code\_warntype on a function that takes a Val{N} parameter and creates a LinearIndices object with size (N, N, N). Here’s a minimal example: function test(::Val{N}) where {N} L…

---

## [Possible to design a compiler for Raspberry Pi GPU?](https://discourse.julialang.org/t/possible-to-design-a-compiler-for-raspberry-pi-gpu/128224)

<div class="topic-metadata">

**Author:** [@mj2984](https://discourse.julialang.org/u/mj2984)\
**Replies:** 0\
**Last updated:** [April 19, 2025, 2:55pm UTC](https://discourse.julialang.org/t/possible-to-design-a-compiler-for-raspberry-pi-gpu/128224 "2025-04-19T14:55:58Z")

</div>

I came across this blog post, of bare metal GPU assembly on Raspberry Pi. Programming a GPU on bare metal I am curious if it is possible to make a compiler that could transform generic Julia code (or SIMD optimized Jul…

---

## [How to avoid "unsupported dynamic function invocation" in CUDA with nested gradients](https://discourse.julialang.org/t/how-to-avoid-unsupported-dynamic-function-invocation-in-cuda-with-nested-gradients/127982)

<div class="topic-metadata">

**Author:** [@andrewrosemberg](https://discourse.julialang.org/u/andrewrosemberg)\
**Replies:** 2\
**Last updated:** [April 15, 2025, 2:58pm UTC](https://discourse.julialang.org/t/how-to-avoid-unsupported-dynamic-function-invocation-in-cuda-with-nested-gradients/127982 "2025-04-15T14:58:32Z")

</div>

I am trying to train a model in Flux in which the loss has a nested gradient. I know I should avoid dynamic function invocation, but I am unsure how. The following code works on CPU but not on CUDA/GPU: using Flux using…

---

## [Is there a way to use @allowscalar in a heterogeneous manner using KernelAbstractions?](https://discourse.julialang.org/t/is-there-a-way-to-use-allowscalar-in-a-heterogeneous-manner-using-kernelabstractions/127828)

<div class="topic-metadata">

**Author:** [@0samuraiE](https://discourse.julialang.org/u/0samuraiE)\
**Replies:** 3\
**Last updated:** [April 10, 2025, 6:33am UTC](https://discourse.julialang.org/t/is-there-a-way-to-use-allowscalar-in-a-heterogeneous-manner-using-kernelabstractions/127828 "2025-04-10T06:33:57Z")

</div>

Hi all, Is it correct that scalar indexing like Out\[1\] is not allowed with KernelAbstractions.jl alone, and that we need GPUArrays.@allowscalar for this? Should we always use GPUArrays together with KernelAbstractions f…

---

## [With ParallelStencil, is it possible to launch multiple kernels and sync later?](https://discourse.julialang.org/t/with-parallelstencil-is-it-possible-to-launch-multiple-kernels-and-sync-later/127843)

<div class="topic-metadata">

**Author:** [@pchaubal](https://discourse.julialang.org/u/pchaubal)\
**Replies:** 7\
**Last updated:** [April 9, 2025, 12:04pm UTC](https://discourse.julialang.org/t/with-parallelstencil-is-it-possible-to-launch-multiple-kernels-and-sync-later/127843 "2025-04-09T12:04:40Z")

</div>

I have written a code to run on GPUs with ParallelStencil but I don’t see a significant speedup by moving to GPUs. I am not sure whether I am using the framework as intended and there exists an easy fix for this. So, any…

---

## [Track function on profiler to CUDA documentation](https://discourse.julialang.org/t/track-function-on-profiler-to-cuda-documentation/127654)

<div class="topic-metadata">

**Author:** [@victor\_vhrn](https://discourse.julialang.org/u/victor_vhrn)\
**Replies:** 1\
**Last updated:** [April 3, 2025, 6:38am UTC](https://discourse.julialang.org/t/track-function-on-profiler-to-cuda-documentation/127654 "2025-04-03T06:38:11Z")

</div>

Below, I have a profile report for a experiment I’m trying. The most expensive device function is cusparse::csrmv\_v3\_transpose\_kernel, so I tried to google the function name to read more but couldn’t find it. From CUDA.v…

---

## [Optimize loss calculation on gpu](https://discourse.julialang.org/t/optimize-loss-calculation-on-gpu/127458)

<div class="topic-metadata">

**Author:** [@Fabrice\_Rosay](https://discourse.julialang.org/u/Fabrice_Rosay)\
**Replies:** 0\
**Last updated:** [March 28, 2025, 2:41pm UTC](https://discourse.julialang.org/t/optimize-loss-calculation-on-gpu/127458 "2025-03-28T14:41:24Z")

</div>

Is there anything i can do to speed up this loss calculation ? (Trajectory Balanced loss for Flow Network from \[2310.02779\] Expected flow networks in stochastic environments and two-player zero-sum games) function gpu\_t…

---

## [CUDA.jl write to global memory in PTX](https://discourse.julialang.org/t/cuda-jl-write-to-global-memory-in-ptx/127426)

<div class="topic-metadata">

**Author:** [@daniwipes](https://discourse.julialang.org/u/daniwipes)\
**Replies:** 4\
**Last updated:** [March 27, 2025, 9:31pm UTC](https://discourse.julialang.org/t/cuda-jl-write-to-global-memory-in-ptx/127426 "2025-03-27T21:31:18Z")

</div>

I am developing a transpiler for a uni project, that takes an Expr and converts that into PTX code which can then be called to evaluate that expression (in the context of symbolic regression, meaning a lot different valu…

---

## [Calculate associated Legendre polynomials on the GPU](https://discourse.julialang.org/t/calculate-associated-legendre-polynomials-on-the-gpu/127418)

<div class="topic-metadata">

**Author:** [@PetrosStefanou](https://discourse.julialang.org/u/PetrosStefanou)\
**Replies:** 3\
**Last updated:** [March 27, 2025, 7:15pm UTC](https://discourse.julialang.org/t/calculate-associated-legendre-polynomials-on-the-gpu/127418 "2025-03-27T19:15:55Z")

</div>

Hi everyone, I would like to evaluate the associated Legendre polynomials P\_l^m (\\cos{\\theta}) on the GPU. I tried the packages AssociatedLegendrePolynomials.jl and LegendrePolynomials.jl, both of which work as intended…

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

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