# GPU

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

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

**Page:** 21

---

## [Allocating different arrays on multiple GPUs](https://discourse.julialang.org/t/allocating-different-arrays-on-multiple-gpus/68836)

<div class="topic-metadata">

**Author:** [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Replies:** 8\
**Last updated:** [September 30, 2021, 6:02am UTC](https://discourse.julialang.org/t/allocating-different-arrays-on-multiple-gpus/68836 "2021-09-30T06:02:15Z")

</div>

i’ve read the docs on unified memory, but think that’s overkill for my use case. is it really not possible to simply switch devices, define another CuArray, and then launch a kernel on it? i get ERROR\_INVALID\_VALUE: j…

---

## [Max.(v1,v2) on the GPU](https://discourse.julialang.org/t/max-v1-v2-on-the-gpu/68386)

<div class="topic-metadata">

**Author:** [@gianmariomanca](https://discourse.julialang.org/u/gianmariomanca)\
**Replies:** 5\
**Last updated:** [September 30, 2021, 3:19am UTC](https://discourse.julialang.org/t/max-v1-v2-on-the-gpu/68386 "2021-09-30T03:19:14Z")

</div>

What’s the best way to implement the element wise maximum of for 2 vectors of the same length on the GPU using CUDA.jl or any other package? julia\> v1 = \[1, 2, 3\] 3-element Vector{Int64}: 1 2 3 julia\> v2 = \[4, 3, 2\]…

---

## [Anyone experimented with Jetson Nano's?](https://discourse.julialang.org/t/anyone-experimented-with-jetson-nanos/68738)

<div class="topic-metadata">

**Author:** [@skypuppy](https://discourse.julialang.org/u/skypuppy)\
**Replies:** 2\
**Last updated:** [September 25, 2021, 10:10am UTC](https://discourse.julialang.org/t/anyone-experimented-with-jetson-nanos/68738 "2021-09-25T10:10:12Z")

</div>

Before I buy half a dozen more Nano’s :slight\_smile: has anyone tested Julia with the GPU’s on the Nano’s? Or Xaviers?

---

## [How to ignore 1 of the 2 GPUs on my machine](https://discourse.julialang.org/t/how-to-ignore-1-of-the-2-gpus-on-my-machine/68697)

<div class="topic-metadata">

**Author:** [@JosePereiraUA](https://discourse.julialang.org/u/JosePereiraUA)\
**Replies:** 7\
**Last updated:** [September 24, 2021, 4:05pm UTC](https://discourse.julialang.org/t/how-to-ignore-1-of-the-2-gpus-on-my-machine/68697 "2021-09-24T16:05:39Z")

</div>

I’m trying to run a piece of code on a different machine than it was written on. On this new machine, there are two GPUs: a Teska K40c and an NVIDIA GeForce GTX 650. The problem seems to be with the second one. Running \]…

---

## [Code review: Mandelbrot set with CUDA.jl](https://discourse.julialang.org/t/code-review-mandelbrot-set-with-cuda-jl/68673)

<div class="topic-metadata">

**Author:** [@vini-fda](https://discourse.julialang.org/u/vini-fda)\
**Replies:** 4\
**Last updated:** [September 24, 2021, 3:40pm UTC](https://discourse.julialang.org/t/code-review-mandelbrot-set-with-cuda-jl/68673 "2021-09-24T15:40:32Z")

</div>

Hello there! I’ve been experimenting with CUDA.jl and it has been a fantastic experience so far. Recently, I’ve made two simple implementations of the Mandelbrot Fractal using CUDA.jl(repository: https://github.com/vini-…

---

## [AlphaZero.jl throwing CUDNNError (code 8)](https://discourse.julialang.org/t/alphazero-jl-throwing-cudnnerror-code-8/68367)

<div class="topic-metadata">

**Author:** [@victorromeo](https://discourse.julialang.org/u/victorromeo)\
**Replies:** 11\
**Last updated:** [September 22, 2021, 4:12am UTC](https://discourse.julialang.org/t/alphazero-jl-throwing-cudnnerror-code-8/68367 "2021-09-22T04:12:26Z")

</div>

Currently getting an error when trying the Connect Four example project using Julia v1.6.1 May I please get someone’s expertise to suggest where I’m going wrong. AlphaZero.jl was installed via Pkg, not source. julia\> …

---

## [Cuprint makes CUDA kernell Work well](https://discourse.julialang.org/t/cuprint-makes-cuda-kernell-work-well/67821)

<div class="topic-metadata">

**Author:** [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Replies:** 1\
**Last updated:** [September 9, 2021, 5:31pm UTC](https://discourse.julialang.org/t/cuprint-makes-cuda-kernell-work-well/67821 "2021-09-09T17:31:09Z")

</div>

I am developing kernel that is comparing two boolean 1 dimensional arrays looking for true positives, false positives and false negatives (details in function incr\_shmem below). And I have one bizarre error when I inc…

---

## [Same random sequence on GPU and CPU?](https://discourse.julialang.org/t/same-random-sequence-on-gpu-and-cpu/67881)

<div class="topic-metadata">

**Author:** [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Replies:** 8\
**Last updated:** [September 8, 2021, 5:47pm UTC](https://discourse.julialang.org/t/same-random-sequence-on-gpu-and-cpu/67881 "2021-09-08T17:47:35Z")

</div>

is there a way to generate the same random sequence of numbers on a GPU as on the CPU? i was hoping i could just use rng = Random.default\_rng() as the generator for both GPU and CPU vectors, but while it doesn’t emit an…

---

## [Trying to understand 3d indexing](https://discourse.julialang.org/t/trying-to-understand-3d-indexing/67525)

<div class="topic-metadata">

**Author:** [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Replies:** 3\
**Last updated:** [September 6, 2021, 9:51am UTC](https://discourse.julialang.org/t/trying-to-understand-3d-indexing/67525 "2021-09-06T09:51:53Z")

</div>

I prepared kernel with thread dimensions 4, 4,1 and iterating over array of dimensionality 16,16,2 and 32 blocks as far as my calculations all should work - all divides without remainder but I get constantly ERROR: Ou…

---

## [CUDAnative: register host memory for pinned memory access](https://discourse.julialang.org/t/cudanative-register-host-memory-for-pinned-memory-access/23046)

<div class="topic-metadata">

**Author:** [@samo](https://discourse.julialang.org/u/samo)\
**Replies:** 26\
**Last updated:** [September 3, 2021, 8:42am UTC](https://discourse.julialang.org/t/cudanative-register-host-memory-for-pinned-memory-access/23046 "2021-09-03T08:42:25Z")

</div>

Hi all, how do I register host memory with CUDAnative in order to enable pinned memory access directly from a GPU kernel? In other words, I wonder how in Julia one can do the equivalent of the following CUDA code: …

---

## [Error in CUDA.jl](https://discourse.julialang.org/t/error-in-cuda-jl/65197)

<div class="topic-metadata">

**Author:** [@jmmmachado](https://discourse.julialang.org/u/jmmmachado)\
**Replies:** 4\
**Last updated:** [September 2, 2021, 10:34pm UTC](https://discourse.julialang.org/t/error-in-cuda-jl/65197 "2021-09-02T22:34:20Z")

</div>

Hello everyone! I am having some issues with CUDA.jl. At first I thought it was an issue with the drivers from NVIDIA or the CUDA installation on my PC, so I uninstalled the drivers, the cuda toolkits, everything. Howev…

---

## [Failing test CUDA (obviously LLVM issue)](https://discourse.julialang.org/t/failing-test-cuda-obviously-llvm-issue/67555)

<div class="topic-metadata">

**Author:** [@Dieter](https://discourse.julialang.org/u/Dieter)\
**Replies:** 1\
**Last updated:** [September 2, 2021, 10:33pm UTC](https://discourse.julialang.org/t/failing-test-cuda-obviously-llvm-issue/67555 "2021-09-02T22:33:18Z")

</div>

Hello Community, I tried to test CUDA, unfortunately the test failed. Error Message: test CUDA Testing CUDA Status \`/tmp/jl\_rSX9Mb/Project.toml\` \[79e6a3ab\] Adapt v3.3.1 \[ab4f0b2a\] BFloat16s v0.1.0 \[052…

---

## [Flux model with \`SubArray\` parameters don't work on GPU](https://discourse.julialang.org/t/flux-model-with-subarray-parameters-dont-work-on-gpu/60401)

<div class="topic-metadata">

**Author:** [@ArthurW](https://discourse.julialang.org/u/ArthurW)\
**Replies:** 4\
**Last updated:** [August 31, 2021, 12:14pm UTC](https://discourse.julialang.org/t/flux-model-with-subarray-parameters-dont-work-on-gpu/60401 "2021-08-31T12:14:14Z")

</div>

Hi everyone, I’m trying to compute the gradient for a “submodel” of a Flux model. That is, I’m defining layers with SubArrays of the original weights as parameters. julia\> using Flux julia\> X = rand(4, 1000) |\> gpu; …

---

## [How to understand MapReduce](https://discourse.julialang.org/t/how-to-understand-mapreduce/67418)

<div class="topic-metadata">

**Author:** [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Replies:** 1\
**Last updated:** [August 31, 2021, 11:23am UTC](https://discourse.julialang.org/t/how-to-understand-mapreduce/67418 "2021-08-31T11:23:45Z")

</div>

Hello I am analyzing CUDA.jl mapReduce.jl file and I see two things that I do not understand First I see that function shfl\_down\_sync is avoided when type of data is another than Bool, Int32, Int64, Float32, Float64, …

---

## [How to broadcast or batch multiply a "batch" of matrices with another matrix on the GPU?](https://discourse.julialang.org/t/how-to-broadcast-or-batch-multiply-a-batch-of-matrices-with-another-matrix-on-the-gpu/67259)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 1\
**Last updated:** [August 29, 2021, 3:56am UTC](https://discourse.julialang.org/t/how-to-broadcast-or-batch-multiply-a-batch-of-matrices-with-another-matrix-on-the-gpu/67259 "2021-08-29T03:56:06Z")

</div>

I have a 3 dimension tensor, where each “slice” of the tensor is a matrix. I want to multiple each slice by another matrix and store there result in a 3D tensor/array. How do I do that in the most efficient way using t…

---

## [\[CUDA\] Issue with cached\_memory() and Quadro RTX](https://discourse.julialang.org/t/cuda-issue-with-cached-memory-and-quadro-rtx/67102)

<div class="topic-metadata">

**Author:** [@RGerzaguet](https://discourse.julialang.org/u/RGerzaguet)\
**Replies:** 3\
**Last updated:** [August 27, 2021, 8:17pm UTC](https://discourse.julialang.org/t/cuda-issue-with-cached-memory-and-quadro-rtx/67102 "2021-08-27T20:17:48Z")

</div>

I have a new toy to play with (a Quadro RTX) and I want to use CUDA.jl with the GPU. I get a quite simple yet annoying issue associated to the function cached\_memory. The very simple MWE julia\> CUDA.versioninfo() CU…

---

## [\`ConvTranspose\` generates \`CUDNN\_STATUS\_BAD\_PARAM (code 3)\`](https://discourse.julialang.org/t/convtranspose-generates-cudnn-status-bad-param-code-3/66908)

<div class="topic-metadata">

**Author:** [@haberdashPI](https://discourse.julialang.org/u/haberdashPI)\
**Replies:** 8\
**Last updated:** [August 25, 2021, 4:02pm UTC](https://discourse.julialang.org/t/convtranspose-generates-cudnn-status-bad-param-code-3/66908 "2021-08-25T16:02:19Z")

</div>

I’m having an issue when creating a 1D ConvTranspose model in Flux, when I run it on the GPU. The following runs using Flux, CUDA x = rand(Float32, 20, 13, 2) model = ConvTranspose((7,), 13 =\> 5, relu; pad=(3,1), stri…

---

## [ERROR: MethodError: no method matching enable\_finalizers()](https://discourse.julialang.org/t/error-methoderror-no-method-matching-enable-finalizers/66928)

<div class="topic-metadata">

**Author:** [@PharmCat](https://discourse.julialang.org/u/PharmCat)\
**Replies:** 5\
**Last updated:** [August 24, 2021, 6:42pm UTC](https://discourse.julialang.org/t/error-methoderror-no-method-matching-enable-finalizers/66928 "2021-08-24T18:42:04Z")

</div>

I try to use LinearAlgebra.LAPACK.potrf!('U', A) and get: ERROR: MethodError: no method matching enable\_finalizers() Closest candidates are: enable\_finalizers(::Bool) at gcutils.jl:117 Stacktrace: \[1\] (::CUDA.APIUti…

---

## [GPU-Kernel function for fast matrix multiplication using shared memory](https://discourse.julialang.org/t/gpu-kernel-function-for-fast-matrix-multiplication-using-shared-memory/66341)

<div class="topic-metadata">

**Author:** [@DanielZ](https://discourse.julialang.org/u/DanielZ)\
**Replies:** 1\
**Last updated:** [August 13, 2021, 2:08pm UTC](https://discourse.julialang.org/t/gpu-kernel-function-for-fast-matrix-multiplication-using-shared-memory/66341 "2021-08-13T14:08:20Z")

</div>

\[Copied from a Slack-Conversation:\] Me (Daniel): Hello, we try to implement a matrix multiplication in a kernel function using shared memory. However, our code in the kernel\_matmul\_fast function calculates a wrong resu…

---

## [Tips on writing kernels?](https://discourse.julialang.org/t/tips-on-writing-kernels/66074)

<div class="topic-metadata">

**Author:** [@Ribeiro](https://discourse.julialang.org/u/Ribeiro)\
**Replies:** 4\
**Last updated:** [August 10, 2021, 8:40pm UTC](https://discourse.julialang.org/t/tips-on-writing-kernels/66074 "2021-08-10T20:40:45Z")

</div>

Hello! I’m working on a problem where I have structs with big vectors and I have to compute stuff index vs index (N square). Something like this: for i in 1:length(bigVector1) for j in 1:length(bigVector2) bigVe…

---

## [Mixing GPU/CPU in struct definition](https://discourse.julialang.org/t/mixing-gpu-cpu-in-struct-definition/66066)

<div class="topic-metadata">

**Author:** [@Ribeiro](https://discourse.julialang.org/u/Ribeiro)\
**Replies:** 5\
**Last updated:** [August 10, 2021, 9:37am UTC](https://discourse.julialang.org/t/mixing-gpu-cpu-in-struct-definition/66066 "2021-08-10T09:37:23Z")

</div>

Hello, I use big structs in my code with lots of different vectors of integers and floats like so: mutable struct Bodies a:: Vector{StaticArrays.SVector{3,Float64}} b:: Int c:: Vector{StaticArrays.SVector{3…

---

## [Multiple GPUs with Julia](https://discourse.julialang.org/t/multiple-gpus-with-julia/11248)

<div class="topic-metadata">

**Author:** [@jacobcvt12](https://discourse.julialang.org/u/jacobcvt12)\
**Replies:** 8\
**Last updated:** [August 9, 2021, 9:49am UTC](https://discourse.julialang.org/t/multiple-gpus-with-julia/11248 "2021-08-09T09:49:25Z")

</div>

Has anyone every used multiple GPUs with Flux? If so, did you have to modify your code to run on multiple GPUs?

---

## [CUDA requirements](https://discourse.julialang.org/t/cuda-requirements/65355)

<div class="topic-metadata">

**Author:** [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Replies:** 2\
**Last updated:** [July 30, 2021, 9:06am UTC](https://discourse.julialang.org/t/cuda-requirements/65355 "2021-07-30T09:06:50Z")

</div>

First, thanks to Tim & co. for great JuliaCon workshops. I was not able to install CUDA.jl, unfortunately. My PC only has Intel UHD Graphics 620, no NVIDIA card. Am I right in assuming that CUDA.jl requires an NVIDIA …

---

## [CuArray supports bits type error when performing automatic differentiation in sciml\_train (possibly due to array reshaping)](https://discourse.julialang.org/t/cuarray-supports-bits-type-error-when-performing-automatic-differentiation-in-sciml-train-possibly-due-to-array-reshaping/65389)

<div class="topic-metadata">

**Author:** [@timothypraditia](https://discourse.julialang.org/u/timothypraditia)\
**Replies:** 6\
**Last updated:** [July 28, 2021, 8:39pm UTC](https://discourse.julialang.org/t/cuarray-supports-bits-type-error-when-performing-automatic-differentiation-in-sciml-train-possibly-due-to-array-reshaping/65389 "2021-07-28T20:39:36Z")

</div>

Hello everyone, I’m trying to convert my code so that it would run on GPU, but I still encountered some issues. My code is mainly using DiffEqFlux, with some array reshaping required inside the Neural ODE function itse…

---

## [CUDA.@cuStaticSharedMem returning a Structure of Arrays](https://discourse.julialang.org/t/cuda-custaticsharedmem-returning-a-structure-of-arrays/65307)

<div class="topic-metadata">

**Author:** [@shiroghost](https://discourse.julialang.org/u/shiroghost)\
**Replies:** 0\
**Last updated:** [July 26, 2021, 2:13pm UTC](https://discourse.julialang.org/t/cuda-custaticsharedmem-returning-a-structure-of-arrays/65307 "2021-07-26T14:13:30Z")

</div>

Working on the GPU I usually find convenient to use Structure of Arrays. I use GitHub - JuliaArrays/StructArrays.jl: Efficient implementation of struct arrays in Julia For example, I use: struct pt x::Float64 Y::Float6…

---

## [Juliacon21-gpu\_workshop notebook \`could not load library "libcuda.so.1"\`](https://discourse.julialang.org/t/juliacon21-gpu-workshop-notebook-could-not-load-library-libcuda-so-1/65014)

<div class="topic-metadata">

**Author:** [@banksiaboy](https://discourse.julialang.org/u/banksiaboy)\
**Replies:** 11\
**Last updated:** [July 23, 2021, 12:39am UTC](https://discourse.julialang.org/t/juliacon21-gpu-workshop-notebook-could-not-load-library-libcuda-so-1/65014 "2021-07-23T00:39:06Z")

</div>

I am trying to get started on the JuliaCon GPU tutorial. I have tried everything I can think of I’m on Ubuntu 20.04.2 LTS. If I use CUDA from the repl, it is successful. If I try it from a jupyter notebook, launched f…

---

## [Running For loops on GPU](https://discourse.julialang.org/t/running-for-loops-on-gpu/1553)

<div class="topic-metadata">

**Author:** [@deepakagrawal](https://discourse.julialang.org/u/deepakagrawal)\
**Replies:** 11\
**Last updated:** [July 19, 2021, 5:39pm UTC](https://discourse.julialang.org/t/running-for-loops-on-gpu/1553 "2021-07-19T17:39:41Z")

</div>

I am trying to do simulation in which I am repeating same function multiple times Changing several parameters Is there a way I can do any of them via a for loop or some other way on GPU? I am new to Julia. Any help o…

---

## [Kernel optimization and shared memory](https://discourse.julialang.org/t/kernel-optimization-and-shared-memory/64362)

<div class="topic-metadata">

**Author:** [@Fabrice\_Rosay](https://discourse.julialang.org/u/Fabrice_Rosay)\
**Replies:** 1\
**Last updated:** [July 9, 2021, 4:02pm UTC](https://discourse.julialang.org/t/kernel-optimization-and-shared-memory/64362 "2021-07-09T16:02:47Z")

</div>

Hi, I try to optimize the following kernel using CUDA function kernel(A,B) index = (blockIdx().x - 1) \* blockDim().x + threadIdx().x stride = blockDim().x \* gridDim().x for i in index:stride:size(A,…

---

## [Reseting Device](https://discourse.julialang.org/t/reseting-device/63997)

<div class="topic-metadata">

**Author:** [@Fabrice\_Rosay](https://discourse.julialang.org/u/Fabrice_Rosay)\
**Replies:** 20\
**Last updated:** [July 6, 2021, 12:30pm UTC](https://discourse.julialang.org/t/reseting-device/63997 "2021-07-06T12:30:33Z")

</div>

Is there any way to reset device state, or at least wipe memory allocated, but keeping already compiled kernel ? I keep seeing slow down during iterated call to CUDA and those disapear if i stop and rerun the execution.…

---

## [\`CUDA.quicksort\` is not faster than CPU radixsort](https://discourse.julialang.org/t/cuda-quicksort-is-not-faster-than-cpu-radixsort/64036)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 3\
**Last updated:** [July 4, 2021, 7:53pm UTC](https://discourse.julialang.org/t/cuda-quicksort-is-not-faster-than-cpu-radixsort/64036 "2021-07-04T19:53:08Z")

</div>

Here’s my testing code using SortingAlgorithms a32 = rand(Float32, 10\_000\_000) @benchmark sort($a32, alg=RadixSort) using CUDA cua32 = cu(a32) @benchmark CUDA.@sync sort($cua32) So the on my GPU which is RT…

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

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