# GPU

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

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

**Page:** 15

---

## [Multi-Threading with GPU](https://discourse.julialang.org/t/multi-threading-with-gpu/93542)

<div class="topic-metadata">

**Author:** [@frog](https://discourse.julialang.org/u/frog)\
**Replies:** 3\
**Last updated:** [January 28, 2023, 2:42am UTC](https://discourse.julialang.org/t/multi-threading-with-gpu/93542 "2023-01-28T02:42:46Z")

</div>

Attempting to create a program that gets the maximum number of threads available for a system GPU ( CUDA ) and runs a function per thread. First the program gets the total number of available threads and adds a slight b…

---

## [Multi-GPU single host training example](https://discourse.julialang.org/t/multi-gpu-single-host-training-example/73689)

<div class="topic-metadata">

**Author:** [@avilay](https://discourse.julialang.org/u/avilay)\
**Replies:** 9\
**Last updated:** [January 24, 2023, 8:53pm UTC](https://discourse.julialang.org/t/multi-gpu-single-host-training-example/73689 "2023-01-24T20:53:38Z")

</div>

Hello - I am completely new to Julia and just started playing around with it in the last couple of days over my winter break. Its a great language :slight\_smile: Thank you for building/maintaining it! Can somebody point…

---

## [Cuda makes Julia freeze](https://discourse.julialang.org/t/cuda-makes-julia-freeze/92040)

<div class="topic-metadata">

**Author:** [@J.J.sakurai](https://discourse.julialang.org/u/J.J.sakurai)\
**Replies:** 8\
**Last updated:** [January 20, 2023, 5:01am UTC](https://discourse.julialang.org/t/cuda-makes-julia-freeze/92040 "2023-01-20T05:01:33Z")

</div>

I want to use julia on GPU. So I installed CUDA by add CUDA and wrote the following code. julia\> using CUDA julia\> y = CUDA.fill(2.0, 3) I have been waiting more than an hour but still no response. It seems to freeze…

---

## [Converting entire custom structure from cpu to gpu and viceversa](https://discourse.julialang.org/t/converting-entire-custom-structure-from-cpu-to-gpu-and-viceversa/93203)

<div class="topic-metadata">

**Author:** [@carlogalli](https://discourse.julialang.org/u/carlogalli)\
**Replies:** 2\
**Last updated:** [January 19, 2023, 2:40pm UTC](https://discourse.julialang.org/t/converting-entire-custom-structure-from-cpu-to-gpu-and-viceversa/93203 "2023-01-19T14:40:56Z")

</div>

Hi! I am looking for a good way to convert a custom structure of Arrays to CuArrays and viceversa. I suspect the answer is related to them and to this topic, but I am not well versed in the usage of convert and adapt so…

---

## [Use of linear operators on a GPU](https://discourse.julialang.org/t/use-of-linear-operators-on-a-gpu/92899)

<div class="topic-metadata">

**Author:** [@shakedregev](https://discourse.julialang.org/u/shakedregev)\
**Replies:** 3\
**Last updated:** [January 18, 2023, 7:12am UTC](https://discourse.julialang.org/t/use-of-linear-operators-on-a-gpu/92899 "2023-01-18T07:12:19Z")

</div>

Say I have a sparse matrices $A$ and $B=D\*A^T$ and their product is dense. I want to solve systems with them using an iterative method from Krylov.jl. On a CPU, I can do opC =LinearOperator(A)\*LinearOperator(B) cg(opC,…

---

## [Flux on gpu and inference optimization](https://discourse.julialang.org/t/flux-on-gpu-and-inference-optimization/93016)

<div class="topic-metadata">

**Author:** [@Fabrice\_Rosay](https://discourse.julialang.org/u/Fabrice_Rosay)\
**Replies:** 2\
**Last updated:** [January 17, 2023, 7:38am UTC](https://discourse.julialang.org/t/flux-on-gpu-and-inference-optimization/93016 "2023-01-17T07:38:59Z")

</div>

Hi, I’m currently running an Alphazero replica with Flux. As you may know most of the time is spent during selfplay and essentially doing neural network inferences. I’m currently using a batchsize of 512 and when mesuri…

---

## [How do I make sure that GPU functions use the maximum potential config for performance?](https://discourse.julialang.org/t/how-do-i-make-sure-that-gpu-functions-use-the-maximum-potential-config-for-performance/92989)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 3\
**Last updated:** [January 16, 2023, 3:13pm UTC](https://discourse.julialang.org/t/how-do-i-make-sure-that-gpu-functions-use-the-maximum-potential-config-for-performance/92989 "2023-01-16T15:13:07Z")

</div>

Hello! I am doing some programming on GPU using CUDA. Instead of writing kernels I am doing the recommended approach of using commonly available functions for GPU programming in CUDA.jl such as “.”, “map” etc. I notic…

---

## [Calling cublas within a kernel?](https://discourse.julialang.org/t/calling-cublas-within-a-kernel/92852)

<div class="topic-metadata">

**Author:** [@bcsj](https://discourse.julialang.org/u/bcsj)\
**Replies:** 0\
**Last updated:** [January 12, 2023, 8:39am UTC](https://discourse.julialang.org/t/calling-cublas-within-a-kernel/92852 "2023-01-12T08:39:24Z")

</div>

Hi, I’m working on speeding up an iterative algorithm by running it on the gpu. Being iterative, depending on the problem structure it may at times take on the other of 10^6 iterations to reach a good solution, and I’d l…

---

## [Multiple GPUs - One GPU per Process - Only one GPU works on four](https://discourse.julialang.org/t/multiple-gpus-one-gpu-per-process-only-one-gpu-works-on-four/92611)

<div class="topic-metadata">

**Author:** [@quantiota](https://discourse.julialang.org/u/quantiota)\
**Replies:** 1\
**Last updated:** [January 8, 2023, 8:07am UTC](https://discourse.julialang.org/t/multiple-gpus-one-gpu-per-process-only-one-gpu-works-on-four/92611 "2023-01-08T08:07:57Z")

</div>

hey, After checking nvidia-smi command, only one GPU works on four when running this code. It seems that the processes are not distributed to the workers, Am I missing something? using Plots using Flux:params using F…

---

## [Compute only specific cells in 3D Matrix](https://discourse.julialang.org/t/compute-only-specific-cells-in-3d-matrix/92476)

<div class="topic-metadata">

**Author:** [@Bozaga\_Murat](https://discourse.julialang.org/u/Bozaga_Murat)\
**Replies:** 2\
**Last updated:** [January 5, 2023, 2:22pm UTC](https://discourse.julialang.org/t/compute-only-specific-cells-in-3d-matrix/92476 "2023-01-05T14:22:07Z")

</div>

Hey everybody, I have a 3D Matrix and a array with 3D coordinates. My target is to compute die differences with the neighbour cells. Yes, its called finite difference. So, I know how I can compute a range in this 3D Mat…

---

## [CUDA test random failure](https://discourse.julialang.org/t/cuda-test-random-failure/92399)

<div class="topic-metadata">

**Author:** [@jinfreedom](https://discourse.julialang.org/u/jinfreedom)\
**Replies:** 4\
**Last updated:** [January 4, 2023, 2:50pm UTC](https://discourse.julialang.org/t/cuda-test-random-failure/92399 "2023-01-04T14:50:01Z")

</div>

Hi, I am new to Julia gpu computation. I recently installed CUDA.jl, with the following status: (julia) pkg\> st Status \`~/julia/Project.toml\` \[6e4b80f9\] BenchmarkTools v1.3.2 \[052768ef\] CUDA v3.12.0 \[7a1cc6ca\] FFT…

---

## [CuArray local scope memory issue](https://discourse.julialang.org/t/cuarray-local-scope-memory-issue/92421)

<div class="topic-metadata">

**Author:** [@rmsmsgood](https://discourse.julialang.org/u/rmsmsgood)\
**Replies:** 4\
**Last updated:** [January 4, 2023, 2:30am UTC](https://discourse.julialang.org/t/cuarray-local-scope-memory-issue/92421 "2023-01-04T02:30:20Z")

</div>

Hi, recently i’m interested in GPU programming, not purpose on deep learning. In my case, i have quite large boolean vectors and have to get the intersect of them. I think these .== and .&& are very simple operations so …

---

## [Auto-diff Friendly GPU Stencils](https://discourse.julialang.org/t/auto-diff-friendly-gpu-stencils/92126)

<div class="topic-metadata">

**Author:** [@Dreycen\_Foiles](https://discourse.julialang.org/u/Dreycen_Foiles)\
**Replies:** 3\
**Last updated:** [January 2, 2023, 9:16pm UTC](https://discourse.julialang.org/t/auto-diff-friendly-gpu-stencils/92126 "2023-01-02T21:16:34Z")

</div>

I’m solving a semi-discretized PDE on my GPU and one of the steps involves performing the Laplacian via a 5-point stencil. My current method does this with a CUDA kernel, but I also want to perform automatic differentiat…

---

## [CUSPARSE matrix-matrix multiplication not using GPU](https://discourse.julialang.org/t/cusparse-matrix-matrix-multiplication-not-using-gpu/92082)

<div class="topic-metadata">

**Author:** [@tsc25](https://discourse.julialang.org/u/tsc25)\
**Replies:** 2\
**Last updated:** [January 2, 2023, 12:25am UTC](https://discourse.julialang.org/t/cusparse-matrix-matrix-multiplication-not-using-gpu/92082 "2023-01-02T00:25:30Z")

</div>

I’m trying to perform sparse matrix-matrix multiplication on the GPU, which looks like it should be supported by CUSPARSE via cusparseSpmm. But it doesn’t seem to be working using Julia’s CUDA.CUSPARSE: using CUDA, CUDA…

---

## [Memory usage problem when using findmax/min](https://discourse.julialang.org/t/memory-usage-problem-when-using-findmax-min/92241)

<div class="topic-metadata">

**Author:** [@FujiwaraTakumiEH](https://discourse.julialang.org/u/FujiwaraTakumiEH)\
**Replies:** 9\
**Last updated:** [December 29, 2022, 5:42pm UTC](https://discourse.julialang.org/t/memory-usage-problem-when-using-findmax-min/92241 "2022-12-29T17:42:00Z")

</div>

Hello, In my case I need to continuously get the max/min values from the Array and it looks like this: using BenchmarkTools using CUDA n = 1000000 a = CUDA.rand(n) b = CUDA.rand(n) function test(a, b) rst = Float…

---

## [Extend findmin/findmax functions in CUDA](https://discourse.julialang.org/t/extend-findmin-findmax-functions-in-cuda/92184)

<div class="topic-metadata">

**Author:** [@fedoroff](https://discourse.julialang.org/u/fedoroff)\
**Replies:** 0\
**Last updated:** [December 27, 2022, 1:09pm UTC](https://discourse.julialang.org/t/extend-findmin-findmax-functions-in-cuda/92184 "2022-12-27T13:09:41Z")

</div>

Currently the findmin/findmax functions in CUDA are defined for cases where one passes in them only a single CuArray (link), e.g. findmin(a). However, findmin/findmax functions in Base allow to pass in them an additional…

---

## [Bug in CUDA, CuArray, or something I just don't know?](https://discourse.julialang.org/t/bug-in-cuda-cuarray-or-something-i-just-dont-know/92059)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 3\
**Last updated:** [December 25, 2022, 12:03pm UTC](https://discourse.julialang.org/t/bug-in-cuda-cuarray-or-something-i-just-dont-know/92059 "2022-12-25T12:03:33Z")

</div>

Hello! When I run this code to convert a vector of ints into a CuArray, I see something extremely weird… julia\> ListOfInts = collect(1:1\*10^6) 1000000-element Vector{Int64}: 1 2 3 4 5…

---

## [Best practices to reduce startup time for CUDA.jl?](https://discourse.julialang.org/t/best-practices-to-reduce-startup-time-for-cuda-jl/92102)

<div class="topic-metadata">

**Author:** [@parthe](https://discourse.julialang.org/u/parthe)\
**Replies:** 2\
**Last updated:** [December 25, 2022, 9:54am UTC](https://discourse.julialang.org/t/best-practices-to-reduce-startup-time-for-cuda-jl/92102 "2022-12-25T09:54:47Z")

</div>

Github Discussion Hi, I am looking for best practices to load the CUDA.jl package and the first usage of methods such as CUDA.randn from this package. I am running CUDA.jl on a cluster node. I am not sure if I am usin…

---

## [GPU kernel?](https://discourse.julialang.org/t/gpu-kernel/92010)

<div class="topic-metadata">

**Author:** [@sim](https://discourse.julialang.org/u/sim)\
**Replies:** 9\
**Last updated:** [December 22, 2022, 11:31pm UTC](https://discourse.julialang.org/t/gpu-kernel/92010 "2022-12-22T23:31:31Z")

</div>

Hi everyone, I need help for understanding well how to take the most out of my GPU. I have a large Hermitian matrix A, but very sparse (zeroes everywhere except exactly 3 entries equal to 1 on each row, so total number …

---

## [Question about garbage collection, AD, and CUDA](https://discourse.julialang.org/t/question-about-garbage-collection-ad-and-cuda/91718)

<div class="topic-metadata">

**Author:** [@kcqpo](https://discourse.julialang.org/u/kcqpo)\
**Replies:** 1\
**Last updated:** [December 19, 2022, 9:05pm UTC](https://discourse.julialang.org/t/question-about-garbage-collection-ad-and-cuda/91718 "2022-12-19T21:05:40Z")

</div>

I encountered an issue that is in this thread Allocator very slow to reclaim memory after running for sufficiently long · Issue #137 · JuliaGPU/CUDA.jl · GitHub. For a machine learning workload, I noticed that if I don’t…

---

## [Prioritising GPU Primitives from Vendor-Specialised Libraries](https://discourse.julialang.org/t/prioritising-gpu-primitives-from-vendor-specialised-libraries/91700)

<div class="topic-metadata">

**Author:** [@anicusan](https://discourse.julialang.org/u/anicusan)\
**Replies:** 1\
**Last updated:** [December 15, 2022, 3:49pm UTC](https://discourse.julialang.org/t/prioritising-gpu-primitives-from-vendor-specialised-libraries/91700 "2022-12-15T15:49:39Z")

</div>

Hi, and thank you for the amazing Julia GPGPU ecosystem you’re building! I’d like to hear your thoughts on GPU primitives on our platforms. Julia - with multiple dispatch, homoiconicity and libraries like GPUCompiler a…

---

## [Easiest way to get CUDA.jl up and running](https://discourse.julialang.org/t/easiest-way-to-get-cuda-jl-up-and-running/91446)

<div class="topic-metadata">

**Author:** [@Yly](https://discourse.julialang.org/u/Yly)\
**Replies:** 1\
**Last updated:** [December 9, 2022, 8:33am UTC](https://discourse.julialang.org/t/easiest-way-to-get-cuda-jl-up-and-running/91446 "2022-12-09T08:33:41Z")

</div>

I have a Dell Inspiron 5558 with a Nvidia GeForce 920M running Linux Mint 18.2. I’m trying to get CUDA.jl running so I can use the GPU for Flux.jl. However, I’ve run into several issues. Calling CUDA.versioninfo() yie…

---

## [InvalidIRError with CuArray broadcast when complex values are involved in Bessel functions](https://discourse.julialang.org/t/invalidirerror-with-cuarray-broadcast-when-complex-values-are-involved-in-bessel-functions/91312)

<div class="topic-metadata">

**Author:** [@jinml](https://discourse.julialang.org/u/jinml)\
**Replies:** 2\
**Last updated:** [December 8, 2022, 12:47am UTC](https://discourse.julialang.org/t/invalidirerror-with-cuarray-broadcast-when-complex-values-are-involved-in-bessel-functions/91312 "2022-12-08T00:47:51Z")

</div>

Hi, I’m receiving runtime errors from julia when playing with the following simple code \> \> julia\> using CUDA, SpecialFunctions \> \> julia\> function cutest(x::Float64,f::Float64) \> c=besselj0(f); \> return…

---

## [CUDA adapter for FFTW plan](https://discourse.julialang.org/t/cuda-adapter-for-fftw-plan/91353)

<div class="topic-metadata">

**Author:** [@fedoroff](https://discourse.julialang.org/u/fedoroff)\
**Replies:** 0\
**Last updated:** [December 7, 2022, 9:55am UTC](https://discourse.julialang.org/t/cuda-adapter-for-fftw-plan/91353 "2022-12-07T09:55:26Z")

</div>

I am writing a code where I want to use a custom structure inside CUDA kernel. Following the CUDA.jl manual (https://cuda.juliagpu.org/stable/tutorials/custom\_structs/), I need to write an Adapt.jl adapter for my struct…

---

## [CUDA How to limit the gpu memory available?](https://discourse.julialang.org/t/cuda-how-to-limit-the-gpu-memory-available/90599)

<div class="topic-metadata">

**Author:** [@Ludovic\_Dumoulin](https://discourse.julialang.org/u/Ludovic_Dumoulin)\
**Replies:** 7\
**Last updated:** [November 25, 2022, 9:56am UTC](https://discourse.julialang.org/t/cuda-how-to-limit-the-gpu-memory-available/90599 "2022-11-25T09:56:12Z")

</div>

Hello, With other lab members we share a jupyter hub server with a single gpu (A30). The problem is that when one is using FFTW or CuArray operations he fills the entire memory. When one runs a code with only low leve…

---

## [CUDA.jl - A Clear Example of Dynamic Parallelism](https://discourse.julialang.org/t/cuda-jl-a-clear-example-of-dynamic-parallelism/78856)

<div class="topic-metadata">

**Author:** [@moukann](https://discourse.julialang.org/u/moukann)\
**Replies:** 6\
**Last updated:** [November 18, 2022, 8:24am UTC](https://discourse.julialang.org/t/cuda-jl-a-clear-example-of-dynamic-parallelism/78856 "2022-11-18T08:24:38Z")

</div>

Hello all, I am not so experienced with CUDA.jl and I cannot find examples on concepts of GPU programming. Dynamic parallelism is a wonderful feature but I could not find an example to learn and apply to my program. Le…

---

## [Continuous callback does not work correctly with Ensemble GPUArray()](https://discourse.julialang.org/t/continuous-callback-does-not-work-correctly-with-ensemble-gpuarray/90254)

<div class="topic-metadata">

**Author:** [@mabrudsky](https://discourse.julialang.org/u/mabrudsky)\
**Replies:** 0\
**Last updated:** [November 14, 2022, 6:43pm UTC](https://discourse.julialang.org/t/continuous-callback-does-not-work-correctly-with-ensemble-gpuarray/90254 "2022-11-14T18:43:12Z")

</div>

Hello, I am solving a central potential problem with EnsembleGPUArray() for multiple initial conditions, when I add the ContinuousCallback the first 800 trajectories ignore the affect!(integrator) and the last 200 do the…

---

## [Fast tile search](https://discourse.julialang.org/t/fast-tile-search/89821)

<div class="topic-metadata">

**Author:** [@00shiv](https://discourse.julialang.org/u/00shiv)\
**Replies:** 6\
**Last updated:** [November 11, 2022, 10:56pm UTC](https://discourse.julialang.org/t/fast-tile-search/89821 "2022-11-11T22:56:49Z")

</div>

The following code (using Tullio.jl): @tullio dists\[u,v,n\] := abs( query\[i, j, ch\] - images\[u+i-1, v+j-1, ch, n\] ) is very fast on my AVX512 capable 4-core CPU. I would like to run this even faster on my CUDA capable …

---

## [Using GPU with NeuralPDE on M1 Mac](https://discourse.julialang.org/t/using-gpu-with-neuralpde-on-m1-mac/90112)

<div class="topic-metadata">

**Author:** [@MilesCB](https://discourse.julialang.org/u/MilesCB)\
**Replies:** 2\
**Last updated:** [November 11, 2022, 10:53am UTC](https://discourse.julialang.org/t/using-gpu-with-neuralpde-on-m1-mac/90112 "2022-11-11T10:53:29Z")

</div>

I’m currently using NeuralPDE.jl to learn the solution to various PDEs. Everything is working well, however I would like to train on GPUs to speed up some of my processing. For building the neural networks I am using Lux…

---

## [Launch\_configuration() equivalent for AMDGPU.jl](https://discourse.julialang.org/t/launch-configuration-equivalent-for-amdgpu-jl/85464)

<div class="topic-metadata">

**Author:** [@torrance](https://discourse.julialang.org/u/torrance)\
**Replies:** 4\
**Last updated:** [November 10, 2022, 8:32pm UTC](https://discourse.julialang.org/t/launch-configuration-equivalent-for-amdgpu-jl/85464 "2022-11-10T20:32:18Z")

</div>

CUDA has a great feature for sizing threads and blocks, namely launch\_configuration(). I rarely manually size my kernel, instead something like: kernel = @cuda launch=false myfunc(args...) config = launch\_configuration(…

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

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