# GPU

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

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

**Page:** 10

---

## [Using mapreduce on GPU with CUDA.jl](https://discourse.julialang.org/t/using-mapreduce-on-gpu-with-cuda-jl/108023)

<div class="topic-metadata">

**Author:** [@huguesmp](https://discourse.julialang.org/u/huguesmp)\
**Replies:** 1\
**Last updated:** [December 25, 2023, 7:50pm UTC](https://discourse.julialang.org/t/using-mapreduce-on-gpu-with-cuda-jl/108023 "2023-12-25T19:50:47Z")

</div>

Hello, I’m trying to get acquainted with GPU programming with CUDA.jl, and to start off I’m trying to stick to Array operations to keep things simple. In this MWE, the GPU version will not compile because of “dynamic f…

---

## [Calling another library from CUDA.jl](https://discourse.julialang.org/t/calling-another-library-from-cuda-jl/107981)

<div class="topic-metadata">

**Author:** [@AshtonSBradley](https://discourse.julialang.org/u/AshtonSBradley)\
**Replies:** 1\
**Last updated:** [December 25, 2023, 7:46pm UTC](https://discourse.julialang.org/t/calling-another-library-from-cuda-jl/107981 "2023-12-25T19:46:09Z")

</div>

Hi all, I want to call another library on the GPU (external to CUDA.jl) and have the rest of the code use the high level CUDA.jl array interface. It this possible to call an external library from CUDA.jl? Any advice g…

---

## [KernelAbstractions Autotuning](https://discourse.julialang.org/t/kernelabstractions-autotuning/108013)

<div class="topic-metadata">

**Author:** [@smartalecH](https://discourse.julialang.org/u/smartalecH)\
**Replies:** 1\
**Last updated:** [December 25, 2023, 11:48am UTC](https://discourse.julialang.org/t/kernelabstractions-autotuning/108013 "2023-12-25T11:48:29Z")

</div>

I’m going through the recent paper comparing batched KernelAbstractions kernels to standard array batching in jax and pytorch. In section 5.1.2, I found this interesting tidbit: KernelAbstractions.jl performs a limited…

---

## [Not sure where function is going wrong](https://discourse.julialang.org/t/not-sure-where-function-is-going-wrong/107881)

<div class="topic-metadata">

**Author:** [@bdas123](https://discourse.julialang.org/u/bdas123)\
**Replies:** 8\
**Last updated:** [December 22, 2023, 7:23am UTC](https://discourse.julialang.org/t/not-sure-where-function-is-going-wrong/107881 "2023-12-22T07:23:16Z")

</div>

Here is my code: using CUDA, Optimization, OptimizationNLopt function calc(x0,p) a = x0\[1:293\] # Convert tau to a CUDA array b = x0\[293+1:2\*293\] # Convert q0 to a CUDA array c = CUDA.zeros(293) # Create…

---

## [CUDA could not find an appropiate CUDA runtime to use](https://discourse.julialang.org/t/cuda-could-not-find-an-appropiate-cuda-runtime-to-use/97201)

<div class="topic-metadata">

**Author:** [@lepton01](https://discourse.julialang.org/u/lepton01)\
**Replies:** 7\
**Last updated:** [December 21, 2023, 7:33pm UTC](https://discourse.julialang.org/t/cuda-could-not-find-an-appropiate-cuda-runtime-to-use/97201 "2023-12-21T19:33:31Z")

</div>

Hello there. Haven’t used CUDA.jl before. I am working with some NN and wanted to see how it would perform on my GPU, if that makes any sense. After adding CUDA through the Julia Package Manager, using CUDA gives the t…

---

## [CUDA.jl - MethodError: no method matching CUDA.CuArray](https://discourse.julialang.org/t/cuda-jl-methoderror-no-method-matching-cuda-cuarray/107717)

<div class="topic-metadata">

**Author:** [@maria96](https://discourse.julialang.org/u/maria96)\
**Replies:** 0\
**Last updated:** [December 16, 2023, 9:03pm UTC](https://discourse.julialang.org/t/cuda-jl-methoderror-no-method-matching-cuda-cuarray/107717 "2023-12-16T21:03:36Z")

</div>

I’m training a Neural Network using NeuralEstimators.jl in julia, and I’m submitting my code in my slurm high performance computer. For some reason, it is not working now using GPUs (it was working before) but it is work…

---

## [GPU Synchronization Issue - using KernelAbstraction](https://discourse.julialang.org/t/gpu-synchronization-issue-using-kernelabstraction/106601)

<div class="topic-metadata">

**Author:** [@erasedbird](https://discourse.julialang.org/u/erasedbird)\
**Replies:** 5\
**Last updated:** [December 13, 2023, 8:51pm UTC](https://discourse.julialang.org/t/gpu-synchronization-issue-using-kernelabstraction/106601 "2023-12-13T20:51:30Z")

</div>

@synchronize is not working consistently for this function I am trying to write, here is what is happening. This function is supposed to first divide everything in the first column by the topmost element of column 1 (3),…

---

## [AMDGPU: Very aggressive allocation? And what tools to monitor vram usage?](https://discourse.julialang.org/t/amdgpu-very-aggressive-allocation-and-what-tools-to-monitor-vram-usage/107458)

<div class="topic-metadata">

**Author:** [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Replies:** 15\
**Last updated:** [December 12, 2023, 5:22pm UTC](https://discourse.julialang.org/t/amdgpu-very-aggressive-allocation-and-what-tools-to-monitor-vram-usage/107458 "2023-12-12T17:22:35Z")

</div>

So I was able to train my first network outside of a tutorial. It was very satisfying to get the 100-1000x improvement over cpu. I tried using multiple linux tools to monitor vram (that apparently get their info from th…

---

## [UndefVarError: 'N' not defined when solving ODE on GPU](https://discourse.julialang.org/t/undefvarerror-n-not-defined-when-solving-ode-on-gpu/107347)

<div class="topic-metadata">

**Author:** [@ian](https://discourse.julialang.org/u/ian)\
**Replies:** 3\
**Last updated:** [December 9, 2023, 1:19am UTC](https://discourse.julialang.org/t/undefvarerror-n-not-defined-when-solving-ode-on-gpu/107347 "2023-12-09T01:19:23Z")

</div>

Hi. I’m experimenting with using GPUs to solve large systems of ODEs. As an intial test I am running the following using DifferentialEquations, CUDA, LinearAlgebra function dynamics!(du, u, p, t) mul!(du, p, u) end…

---

## [CUDA.jl testing errors](https://discourse.julialang.org/t/cuda-jl-testing-errors/107238)

<div class="topic-metadata">

**Author:** [@AshtonSBradley](https://discourse.julialang.org/u/AshtonSBradley)\
**Replies:** 1\
**Last updated:** [December 6, 2023, 11:55pm UTC](https://discourse.julialang.org/t/cuda-jl-testing-errors/107238 "2023-12-06T23:55:21Z")

</div>

Hi all, I have a problem with the CUDA.jl setup for Titan V cards, each in its own Redhat linux box. Previously everything was fine in Ubuntu. So here is the error (same on julia 1.9): (@v1.10) pkg\> test CUDA Test…

---

## [@synchronize causing silent failures in function](https://discourse.julialang.org/t/synchronize-causing-silent-failures-in-function/106919)

<div class="topic-metadata">

**Author:** [@erasedbird](https://discourse.julialang.org/u/erasedbird)\
**Replies:** 4\
**Last updated:** [December 4, 2023, 9:41pm UTC](https://discourse.julialang.org/t/synchronize-causing-silent-failures-in-function/106919 "2023-12-04T21:41:28Z")

</div>

Hello! I’ve been having this strange issue. Running the following code in a Jupyter notebook causes it to be forever stuck on the last line: using KernelAbstractions using CUDA @kernel function tile\_lu\_factor!(A, n) …

---

## [Can't get gpu recognized: AMDGPU.functional(:MIOpen) returns false](https://discourse.julialang.org/t/cant-get-gpu-recognized-amdgpu-functional-miopen-returns-false/107032)

<div class="topic-metadata">

**Author:** [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Replies:** 3\
**Last updated:** [December 2, 2023, 4:46am UTC](https://discourse.julialang.org/t/cant-get-gpu-recognized-amdgpu-functional-miopen-returns-false/107032 "2023-12-02T04:46:02Z")

</div>

I got the FastAI example from the readme running on cpu, so now tried to move to gpu after installing ROCm 5.7.1. It still reverted to CPU: fitonecycle!(learner, 1) ┌ Info: The GPU function is being called but the GPU i…

---

## [Using sparse matrix in CUDA kernel](https://discourse.julialang.org/t/using-sparse-matrix-in-cuda-kernel/106704)

<div class="topic-metadata">

**Author:** [@joel](https://discourse.julialang.org/u/joel)\
**Replies:** 1\
**Last updated:** [November 27, 2023, 5:05pm UTC](https://discourse.julialang.org/t/using-sparse-matrix-in-cuda-kernel/106704 "2023-11-27T17:05:24Z")

</div>

Hi, I’m trying to call nonzeros on a sparse matrix in my CUDA kernel but I’m getting a dynamic function invocation error: unsupported dynamic function invocation (call to nonzeros). Is this simply not supported or am I…

---

## [Error when implementing multidimensional kernel](https://discourse.julialang.org/t/error-when-implementing-multidimensional-kernel/106738)

<div class="topic-metadata">

**Author:** [@albertomercurio](https://discourse.julialang.org/u/albertomercurio)\
**Replies:** 6\
**Last updated:** [November 27, 2023, 5:01pm UTC](https://discourse.julialang.org/t/error-when-implementing-multidimensional-kernel/106738 "2023-11-27T17:01:07Z")

</div>

Hello, I was implementing a very simple example of kernel programming with CUDA.jl. As an example, I took the addition of two matrices. The used code is the following: function \_add\_kernel!(C, A, B, m, n) index\_i =…

---

## [CuSparseMatrixCSC constructor](https://discourse.julialang.org/t/cusparsematrixcsc-constructor/62480)

<div class="topic-metadata">

**Author:** [@zhiwei](https://discourse.julialang.org/u/zhiwei)\
**Replies:** 2\
**Last updated:** [June 7, 2021, 2:30am UTC](https://discourse.julialang.org/t/cusparsematrixcsc-constructor/62480 "2021-06-07T02:30:24Z")

</div>

Hello, I am trying to use the CuSparseMatrixCSC constructor as defined here, but it throws an error. I’m wondering what’s gone wrong. julia\> using CUDA julia\> I = CuArray(\[1,1\]); julia\> J = CuArray(\[1,2\]); julia\> V …

---

## [CUDA/GPU compatible discretization from MethodOfLines.jl](https://discourse.julialang.org/t/cuda-gpu-compatible-discretization-from-methodoflines-jl/106506)

<div class="topic-metadata">

**Author:** [@NonDairyNeutrino](https://discourse.julialang.org/u/NonDairyNeutrino)\
**Replies:** 2\
**Last updated:** [November 21, 2023, 7:46pm UTC](https://discourse.julialang.org/t/cuda-gpu-compatible-discretization-from-methodoflines-jl/106506 "2023-11-21T19:46:03Z")

</div>

MethodOfLines.jl (MOL) exports discretize which gives an ODEProblem that can then be directly passed to OrdinaryDiffEq.solve() to get a solution. This works great if you want a CPU evaluation, but it seems not so much i…

---

## [Why Julia is much slower than MATLAB on GPU computing?](https://discourse.julialang.org/t/why-julia-is-much-slower-than-matlab-on-gpu-computing/106450)

<div class="topic-metadata">

**Author:** [@DennisFang](https://discourse.julialang.org/u/DennisFang)\
**Replies:** 30\
**Last updated:** [November 20, 2023, 12:44pm UTC](https://discourse.julialang.org/t/why-julia-is-much-slower-than-matlab-on-gpu-computing/106450 "2023-11-20T12:44:29Z")

</div>

Hello, I use a local computer, consisting of an NVIDIA RTX 3090 GPU, with a Windows 10 system to run models in different programming languages and compare their performance. When comparing Julia (v1.9.3) and MATLAB (202…

---

## [GPU kernel that is ~20x slower than corresponding CPU version](https://discourse.julialang.org/t/gpu-kernel-that-is-20x-slower-than-corresponding-cpu-version/105998)

<div class="topic-metadata">

**Author:** [@Dale\_James\_Black](https://discourse.julialang.org/u/Dale_James_Black)\
**Replies:** 9\
**Last updated:** [November 10, 2023, 9:35pm UTC](https://discourse.julialang.org/t/gpu-kernel-that-is-20x-slower-than-corresponding-cpu-version/105998 "2023-11-10T21:35:39Z")

</div>

I have a 2D distance transform algorithm on the GPU that is around ~20x slower than its corresponding CPU version. I don’t know if this is an issue with the way the kernel was written or potentially to be expected on Met…

---

## [Emulate GPU on CPU with CUDA.jl](https://discourse.julialang.org/t/emulate-gpu-on-cpu-with-cuda-jl/105961)

<div class="topic-metadata">

**Author:** [@A112s](https://discourse.julialang.org/u/A112s)\
**Replies:** 2\
**Last updated:** [November 8, 2023, 7:56pm UTC](https://discourse.julialang.org/t/emulate-gpu-on-cpu-with-cuda-jl/105961 "2023-11-08T19:56:40Z")

</div>

Pretty much as in the title. I am almost sure I heard about such option in one of the lectures on CUDA.jl, however I can’t find a way to achieve it. I want to run my unit tests in github actions, but having to use actua…

---

## [Last slots available for "GPU programming with Julia" course with Tim Besard and Sam Omlin](https://discourse.julialang.org/t/last-slots-available-for-gpu-programming-with-julia-course-with-tim-besard-and-sam-omlin/105953)

<div class="topic-metadata">

**Author:** [@samo](https://discourse.julialang.org/u/samo)\
**Replies:** 0\
**Last updated:** [November 8, 2023, 2:41pm UTC](https://discourse.julialang.org/t/last-slots-available-for-gpu-programming-with-julia-course-with-tim-besard-and-sam-omlin/105953 "2023-11-08T14:41:08Z")

</div>

---

## [Convert a non-allocating distance transform algorithm to GPU using KernelAbstractions.jl](https://discourse.julialang.org/t/convert-a-non-allocating-distance-transform-algorithm-to-gpu-using-kernelabstractions-jl/105726)

<div class="topic-metadata">

**Author:** [@Dale\_James\_Black](https://discourse.julialang.org/u/Dale_James_Black)\
**Replies:** 7\
**Last updated:** [November 7, 2023, 7:21pm UTC](https://discourse.julialang.org/t/convert-a-non-allocating-distance-transform-algorithm-to-gpu-using-kernelabstractions-jl/105726 "2023-11-07T19:21:33Z")

</div>

Hello. I have been hacking away at this for a few weeks now and still can’t figure out what is going on. I have a non-allocating 1D distance transform (Felzenswalb algorithm) that is easy to parallelize, as you can see …

---

## [Peculiar GPU behavior: zero performance cost for math functions?](https://discourse.julialang.org/t/peculiar-gpu-behavior-zero-performance-cost-for-math-functions/105764)

<div class="topic-metadata">

**Author:** [@bremez](https://discourse.julialang.org/u/bremez)\
**Replies:** 5\
**Last updated:** [November 4, 2023, 4:24am UTC](https://discourse.julialang.org/t/peculiar-gpu-behavior-zero-performance-cost-for-math-functions/105764 "2023-11-04T04:24:15Z")

</div>

I have a use case where the performance bottleneck is in computing trigonometric functions. I thought that maybe it would benefit from some more parallelism, and realized that having access to a university computing clus…

---

## [Kernel random numbers generation entropy / randomness issues](https://discourse.julialang.org/t/kernel-random-numbers-generation-entropy-randomness-issues/105637)

<div class="topic-metadata">

**Author:** [@ReWoP](https://discourse.julialang.org/u/ReWoP)\
**Replies:** 25\
**Last updated:** [November 3, 2023, 4:19pm UTC](https://discourse.julialang.org/t/kernel-random-numbers-generation-entropy-randomness-issues/105637 "2023-11-03T16:19:05Z")

</div>

Hi all! I’m implementing with some algorithms in the GPU (CUDA) that are stochastic in nature, meaning that they rely on random numbers (namely uniformly distributed random numbers in \[0,1\]) to achieve results. When pr…

---

## [Correct implementation of CuArray's slicing operations](https://discourse.julialang.org/t/correct-implementation-of-cuarrays-slicing-operations/90600)

<div class="topic-metadata">

**Author:** [@FujiwaraTakumiEH](https://discourse.julialang.org/u/FujiwaraTakumiEH)\
**Replies:** 3\
**Last updated:** [October 31, 2023, 10:29am UTC](https://discourse.julialang.org/t/correct-implementation-of-cuarrays-slicing-operations/90600 "2023-10-31T10:29:10Z")

</div>

Hello, sometimes I need slicing operations on CuArray. I would like to know the correct (and efficient) way to achieve this. I made 4 benchmarks: Datasets: using BenchmarkTools using CUDA CUDA.allowscalar(true) # size o…

---

## [Input data for main simulation with ParallelStencil.jl](https://discourse.julialang.org/t/input-data-for-main-simulation-with-parallelstencil-jl/105385)

<div class="topic-metadata">

**Author:** [@chloisu](https://discourse.julialang.org/u/chloisu)\
**Replies:** 3\
**Last updated:** [October 25, 2023, 7:38pm UTC](https://discourse.julialang.org/t/input-data-for-main-simulation-with-parallelstencil-jl/105385 "2023-10-25T19:38:16Z")

</div>

Hello, I have a question regarding the use of ParallelStencil.jl. I would like to initialize a simulation or load a previous solution and assign these input fields like temperature or so to the ParallelStencil Arrays be…

---

## [NVLink's Compatibility with KernalAbstractions](https://discourse.julialang.org/t/nvlinks-compatibility-with-kernalabstractions/105267)

<div class="topic-metadata">

**Author:** [@TzuYaoHuang](https://discourse.julialang.org/u/TzuYaoHuang)\
**Replies:** 3\
**Last updated:** [October 22, 2023, 7:17pm UTC](https://discourse.julialang.org/t/nvlinks-compatibility-with-kernalabstractions/105267 "2023-10-22T19:17:14Z")

</div>

I am planning to build a workstation with two NVIDIA GPUs (A6000-ish) connected with NVLink since we would like to run some memory-intensive tasks – high-resolution CFD simulation (WaterLily.jl parallelized by KernalAbst…

---

## [Batched CUDA FFT Plans](https://discourse.julialang.org/t/batched-cuda-fft-plans/105187)

<div class="topic-metadata">

**Author:** [@MaximilianGelbrecht](https://discourse.julialang.org/u/MaximilianGelbrecht)\
**Replies:** 2\
**Last updated:** [October 20, 2023, 6:50am UTC](https://discourse.julialang.org/t/batched-cuda-fft-plans/105187 "2023-10-20T06:50:21Z")

</div>

CUDA.jl PR1903 added support for FFTs along more directions with CUDA.jl v5. I am a bit confused how this works in practice, as I can’t find it documented. The PR states This is achieved by allowing fft-plans to have f…

---

## [Inconsitent gradients of BachNorm on GPU in testmode](https://discourse.julialang.org/t/inconsitent-gradients-of-bachnorm-on-gpu-in-testmode/105189)

<div class="topic-metadata">

**Author:** [@Phypix](https://discourse.julialang.org/u/Phypix)\
**Replies:** 0\
**Last updated:** [October 19, 2023, 2:49pm UTC](https://discourse.julialang.org/t/inconsitent-gradients-of-bachnorm-on-gpu-in-testmode/105189 "2023-10-19T14:49:11Z")

</div>

I encountered an issue with the gradient of the BatchNorm on the GPU in testmode. If the shape of the input array is either 2, 4 or 5, the gradients will differ from the result of any other sized array. The results on t…

---

## [Using MVector in CUDA without memory errors](https://discourse.julialang.org/t/using-mvector-in-cuda-without-memory-errors/105016)

<div class="topic-metadata">

**Author:** [@snowgum](https://discourse.julialang.org/u/snowgum)\
**Replies:** 3\
**Last updated:** [October 17, 2023, 2:46am UTC](https://discourse.julialang.org/t/using-mvector-in-cuda-without-memory-errors/105016 "2023-10-17T02:46:19Z")

</div>

I have an application where allocating a small fixed-sized vector for temporary storage inside a kernel is very beneficial. From reading this forum, issue 340 on CUDAnative.jl and an issue 38 comment, I am assuming it is…

---

## [Generic array code that works with CUDA and Zygote?](https://discourse.julialang.org/t/generic-array-code-that-works-with-cuda-and-zygote/104295)

<div class="topic-metadata">

**Author:** [@mchitre](https://discourse.julialang.org/u/mchitre)\
**Replies:** 0\
**Last updated:** [September 27, 2023, 7:22am UTC](https://discourse.julialang.org/t/generic-array-code-that-works-with-cuda-and-zygote/104295 "2023-09-27T07:22:22Z")

</div>

I am interested in writing a generic function that operates on an AbstractArray and produces some output. In doing so, it needs to create an intermediate array. The function should work with CPU arrays and GPU arrays, an…

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

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