# GPU

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

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

**Page:** 18

---

## [Using Polynomials.jl with CUDA.jl](https://discourse.julialang.org/t/using-polynomials-jl-with-cuda-jl/80580)

<div class="topic-metadata">

**Author:** [@GHRALIMA](https://discourse.julialang.org/u/GHRALIMA)\
**Replies:** 3\
**Last updated:** [May 7, 2022, 10:15am UTC](https://discourse.julialang.org/t/using-polynomials-jl-with-cuda-jl/80580 "2022-05-07T10:15:03Z")

</div>

I’m on my very first trial with CUDA.jl, and I’m trying to use it together with Polynomials.jl to calculate the roots of thousands of polynomials with my NVidia GPU. However, when I try to create a polynomial using CuArr…

---

## [CUDA.jl bimodal SpMM performance](https://discourse.julialang.org/t/cuda-jl-bimodal-spmm-performance/80499)

<div class="topic-metadata">

**Author:** [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)\
**Replies:** 1\
**Last updated:** [May 5, 2022, 9:50am UTC](https://discourse.julialang.org/t/cuda-jl-bimodal-spmm-performance/80499 "2022-05-05T09:50:08Z")

</div>

New to CUDA.jl here, and I’m running a few benchmarks to understand CUDA’s performance on sparse matrices. I observed that SpMM (sparse matrix times dense matrix) seems to have a bimodal histogram when benchmarked: usin…

---

## [Row-wise operation using \`map\`?](https://discourse.julialang.org/t/row-wise-operation-using-map/80339)

<div class="topic-metadata">

**Author:** [@HJW019](https://discourse.julialang.org/u/HJW019)\
**Replies:** 2\
**Last updated:** [May 2, 2022, 8:04am UTC](https://discourse.julialang.org/t/row-wise-operation-using-map/80339 "2022-05-02T08:04:06Z")

</div>

I am translating my CPU code to GPU. One of the things I did in CPU is to apply map to a Vector{Matrix{Real}} data for row-wise operations. For instance: julia\> aa = \[\[1. 2. 3.\], \[4. 5. 6.\]\] 2-element Vecto…

---

## [Edited video of course “GPU Programming with Julia” at the Swiss National Supercomputing Centre (CSCS) now available!](https://discourse.julialang.org/t/edited-video-of-course-gpu-programming-with-julia-at-the-swiss-national-supercomputing-centre-cscs-now-available/80291)

<div class="topic-metadata">

**Author:** [@samo](https://discourse.julialang.org/u/samo)\
**Replies:** 1\
**Last updated:** [May 1, 2022, 6:44pm UTC](https://discourse.julialang.org/t/edited-video-of-course-gpu-programming-with-julia-at-the-swiss-national-supercomputing-centre-cscs-now-available/80291 "2022-05-01T18:44:42Z")

</div>

Edited video of course “GPU Programming with Julia” at the Swiss National Supercomputing Centre (CSCS) now available

---

## [Getting index and value of the second highest element of CuArray](https://discourse.julialang.org/t/getting-index-and-value-of-the-second-highest-element-of-cuarray/80054)

<div class="topic-metadata">

**Author:** [@Phuntsho](https://discourse.julialang.org/u/Phuntsho)\
**Replies:** 1\
**Last updated:** [April 26, 2022, 3:24pm UTC](https://discourse.julialang.org/t/getting-index-and-value-of-the-second-highest-element-of-cuarray/80054 "2022-04-26T15:24:21Z")

</div>

For CuArray, say, A, we can use findmax(A) to find the value and index of the highest element efficiently. Is there a similar function that does for the second element? Thank you in advance for your help.

---

## [Error handling in CUDA kernels](https://discourse.julialang.org/t/error-handling-in-cuda-kernels/79692)

<div class="topic-metadata">

**Author:** [@fedoroff](https://discourse.julialang.org/u/fedoroff)\
**Replies:** 6\
**Last updated:** [April 26, 2022, 8:37am UTC](https://discourse.julialang.org/t/error-handling-in-cuda-kernels/79692 "2022-04-26T08:37:52Z")

</div>

In my CUDA kernel I check for a specific condition and would like to terminate the execution if the condition is fulfilled. What is the proper way to do so? How can I throw an error from inside a CUDA kernel?

---

## [CUDA.jl - Multiple Threads to Initiate Same CUDA Algorithm](https://discourse.julialang.org/t/cuda-jl-multiple-threads-to-initiate-same-cuda-algorithm/79728)

<div class="topic-metadata">

**Author:** [@moukann](https://discourse.julialang.org/u/moukann)\
**Replies:** 3\
**Last updated:** [April 26, 2022, 7:58am UTC](https://discourse.julialang.org/t/cuda-jl-multiple-threads-to-initiate-same-cuda-algorithm/79728 "2022-04-26T07:58:04Z")

</div>

Hello all, Let’s say we have a situation where we run a for loop with “n” times. Every for loop contains CUDA kernels and CPU functions mixture. However, every operation is independent from each other. for index = 1:n …

---

## [Yolo.jl \[CUDA\] related issue](https://discourse.julialang.org/t/yolo-jl-cuda-related-issue/71882)

<div class="topic-metadata">

**Author:** [@n90](https://discourse.julialang.org/u/n90)\
**Replies:** 8\
**Last updated:** [April 24, 2022, 11:17am UTC](https://discourse.julialang.org/t/yolo-jl-cuda-related-issue/71882 "2022-04-24T11:17:24Z")

</div>

I am working on a server with Tesla M60. When i try running the sample code am getting the following error. Using CUDA.jl I checked the versioninfo() and gpu is recognized and working. What is the cause of this error and…

---

## [Calculating crossentropy with varying sized vectors on GPU](https://discourse.julialang.org/t/calculating-crossentropy-with-varying-sized-vectors-on-gpu/79700)

<div class="topic-metadata">

**Author:** [@Casper](https://discourse.julialang.org/u/Casper)\
**Replies:** 0\
**Last updated:** [April 19, 2022, 4:15pm UTC](https://discourse.julialang.org/t/calculating-crossentropy-with-varying-sized-vectors-on-gpu/79700 "2022-04-19T16:15:08Z")

</div>

Hello, I’m attempting to calculate the cross entropy of a bunch of samples of different length. using CUDA entropy(π̂, π) =-sum(π .\* log.(π̂ )) m = 3 n = 3 w = ones(m) |\> gpu a1 = rand(Float32, m, n) a1 = softmax(a…

---

## [OOM when using Flux and loops](https://discourse.julialang.org/t/oom-when-using-flux-and-loops/79468)

<div class="topic-metadata">

**Author:** [@Fabrice\_Rosay](https://discourse.julialang.org/u/Fabrice_Rosay)\
**Replies:** 4\
**Last updated:** [April 14, 2022, 1:37pm UTC](https://discourse.julialang.org/t/oom-when-using-flux-and-loops/79468 "2022-04-14T13:37:19Z")

</div>

The following code works with actor a residual network of depth 5 and 64 filters if n=1000 (using Flux) But if the lines calling GC are commented, it fails with OOM. Using CUDA 3.9 and Nvidia Driver Version: 510.47.03 …

---

## [Linear algebra of sparse matrices on GPU](https://discourse.julialang.org/t/linear-algebra-of-sparse-matrices-on-gpu/79287)

<div class="topic-metadata">

**Author:** [@Vahid\_Hosseinzadeh](https://discourse.julialang.org/u/Vahid_Hosseinzadeh)\
**Replies:** 0\
**Last updated:** [April 10, 2022, 7:41am UTC](https://discourse.julialang.org/t/linear-algebra-of-sparse-matrices-on-gpu/79287 "2022-04-10T07:41:43Z")

</div>

Hello everyone, I have a code with some computations in LinearAlgebra using SparseArrays. How can I use that to be performed on GPU? Can I use Cuda.jl? what functions are available in linear algebra? In my case, I need…

---

## [Passing tuple of structs to a CUDA.jl kernel](https://discourse.julialang.org/t/passing-tuple-of-structs-to-a-cuda-jl-kernel/79064)

<div class="topic-metadata">

**Author:** [@lodygaw](https://discourse.julialang.org/u/lodygaw)\
**Replies:** 4\
**Last updated:** [April 6, 2022, 11:52am UTC](https://discourse.julialang.org/t/passing-tuple-of-structs-to-a-cuda-jl-kernel/79064 "2022-04-06T11:52:51Z")

</div>

Hi, I have a problem with passing a tuple of structs to a CUDA.jl kernel. This is MWE: using CUDA, Adapt, StaticArrays struct MyType1 end struct MyType2 end struct MyStruct{T,N,L} type :: T data :: SMatrix{N,2,Flo…

---

## [One example from \`GPU programming in Julia | Workshop | JuliaCon 2021\`](https://discourse.julialang.org/t/one-example-from-gpu-programming-in-julia-workshop-juliacon-2021/79060)

<div class="topic-metadata">

**Author:** [@DennisFang](https://discourse.julialang.org/u/DennisFang)\
**Replies:** 0\
**Last updated:** [April 5, 2022, 4:21pm UTC](https://discourse.julialang.org/t/one-example-from-gpu-programming-in-julia-workshop-juliacon-2021/79060 "2022-04-05T16:21:51Z")

</div>

When I run the following example from the Workshop, the result is false in my computer. function my\_sum(a::AbstractArray{T}) where {T} b = CUDA.zeros(T, 1) kernel = @cuda launch=false reduce\_grid\_atomic\_shmem(+…

---

## [How to use distributed and pmap across GPU cores](https://discourse.julialang.org/t/how-to-use-distributed-and-pmap-across-gpu-cores/78852)

<div class="topic-metadata">

**Author:** [@Nadou407](https://discourse.julialang.org/u/Nadou407)\
**Replies:** 2\
**Last updated:** [April 1, 2022, 1:04pm UTC](https://discourse.julialang.org/t/how-to-use-distributed-and-pmap-across-gpu-cores/78852 "2022-04-01T13:04:25Z")

</div>

Hi all, I’m still new to Julia GPU and Julia in general so got quite confused about how to do parallel computation using a GPU. Any help would be greatly appreciated! My current code (a simple example) using 20 CPU cor…

---

## [CUDA.jl - Atomic Addition Error To A Sparse Array Inside CUDA Kernel](https://discourse.julialang.org/t/cuda-jl-atomic-addition-error-to-a-sparse-array-inside-cuda-kernel/78789)

<div class="topic-metadata">

**Author:** [@moukann](https://discourse.julialang.org/u/moukann)\
**Replies:** 4\
**Last updated:** [March 31, 2022, 11:18am UTC](https://discourse.julialang.org/t/cuda-jl-atomic-addition-error-to-a-sparse-array-inside-cuda-kernel/78789 "2022-03-31T11:18:47Z")

</div>

Hello all, I am trying to assemble many individual elements of a huge system to a global system. The global system is sparse, It is a certain thing. Also it is wasteful to store all zero elements in memory, I just need …

---

## [Diffusion by using CUDA.jl, DifferentialEquations and DiffEqGPU](https://discourse.julialang.org/t/diffusion-by-using-cuda-jl-differentialequations-and-diffeqgpu/78310)

<div class="topic-metadata">

**Author:** [@eslam\_abdelfatah](https://discourse.julialang.org/u/eslam_abdelfatah)\
**Replies:** 6\
**Last updated:** [March 29, 2022, 10:44am UTC](https://discourse.julialang.org/t/diffusion-by-using-cuda-jl-differentialequations-and-diffeqgpu/78310 "2022-03-29T10:44:42Z")

</div>

I want to apply a difusion for a two- dimensional plat using the DiffEqGPU package. when I used the Euler method as a for loop it worked. My code looks like this module Playground using CUDA using CairoMakie using C…

---

## [Julia 1.9.0-DEV.239 with CUDA CuArray](https://discourse.julialang.org/t/julia-1-9-0-dev-239-with-cuda-cuarray/78350)

<div class="topic-metadata">

**Author:** [@sjinwsu](https://discourse.julialang.org/u/sjinwsu)\
**Replies:** 12\
**Last updated:** [March 28, 2022, 2:37pm UTC](https://discourse.julialang.org/t/julia-1-9-0-dev-239-with-cuda-cuarray/78350 "2022-03-28T14:37:09Z")

</div>

Hello, I would like to ask if the following error regarding CuArray is Julia version specific. I was able to run the following basic CuArray test with Julia 1.8.0-Dev.1370, but when I tried with the latest release of Jul…

---

## [CUDA.jl - Variable Sized Local Arrays Inside CUDA Kernel](https://discourse.julialang.org/t/cuda-jl-variable-sized-local-arrays-inside-cuda-kernel/78567)

<div class="topic-metadata">

**Author:** [@moukann](https://discourse.julialang.org/u/moukann)\
**Replies:** 2\
**Last updated:** [March 28, 2022, 11:13am UTC](https://discourse.julialang.org/t/cuda-jl-variable-sized-local-arrays-inside-cuda-kernel/78567 "2022-03-28T11:13:53Z")

</div>

Hello all, I am trying to parallelize a computational mechanics code. I encountered a problem which I cannot solve. I am trying to allocate variable sized arrays for every thread. However, for a particular thread, the s…

---

## [CUDA.jl - Sub-Vector Indexing Problem Inside CUDA Kernel](https://discourse.julialang.org/t/cuda-jl-sub-vector-indexing-problem-inside-cuda-kernel/78526)

<div class="topic-metadata">

**Author:** [@moukann](https://discourse.julialang.org/u/moukann)\
**Replies:** 2\
**Last updated:** [March 28, 2022, 11:13am UTC](https://discourse.julialang.org/t/cuda-jl-sub-vector-indexing-problem-inside-cuda-kernel/78526 "2022-03-28T11:13:18Z")

</div>

Hello all, I’ve been experimenting with CUDA Julia. Formerly, I used CUDA Python but it was so limited and restrictive. So I migrated to Julia. Thanks for the great effort and flexible framework to everybody working on …

---

## [Simulation running well on K620 but instable on A100?](https://discourse.julialang.org/t/simulation-running-well-on-k620-but-instable-on-a100/77584)

<div class="topic-metadata">

**Author:** [@Ludovic\_Dumoulin](https://discourse.julialang.org/u/Ludovic_Dumoulin)\
**Replies:** 15\
**Last updated:** [March 25, 2022, 5:36pm UTC](https://discourse.julialang.org/t/simulation-running-well-on-k620-but-instable-on-a100/77584 "2022-03-25T17:36:41Z")

</div>

Hello, I am facing a difficult situation. I am new to GPU computing and I am debugging my code on my computer gpu (an old K620) and then run my simulation on a cluster with A100 cards. The simulation is stable for a l…

---

## [Gradient of ldiv trace on CUDA](https://discourse.julialang.org/t/gradient-of-ldiv-trace-on-cuda/78283)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 3\
**Last updated:** [March 23, 2022, 10:19am UTC](https://discourse.julialang.org/t/gradient-of-ldiv-trace-on-cuda/78283 "2022-03-23T10:19:38Z")

</div>

Hello, I’m trying to differentiate a left matrix division on CuArrays. I actually have the L parts l1,l2 of lu-decompositions of two matrices M1, M2 respectively. So m = l1\*l1' I made two functions, one that reconstruc…

---

## [How to use CUDA in Github CI?](https://discourse.julialang.org/t/how-to-use-cuda-in-github-ci/77855)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 2\
**Last updated:** [March 14, 2022, 10:05am UTC](https://discourse.julialang.org/t/how-to-use-cuda-in-github-ci/77855 "2022-03-14T10:05:37Z")

</div>

Hello, I contributed some code to a package, and I made unit tests to check whether the code works on the GPU. I wrapped the code in a if CUDA.functional() ... end block and I see this: It seems like CUDA is not fun…

---

## [GPU computing on AMD consumer hardware?](https://discourse.julialang.org/t/gpu-computing-on-amd-consumer-hardware/53841)

<div class="topic-metadata">

**Author:** [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Replies:** 11\
**Last updated:** [March 8, 2022, 12:40pm UTC](https://discourse.julialang.org/t/gpu-computing-on-amd-consumer-hardware/53841 "2022-03-08T12:40:55Z")

</div>

I’m putting together a new computer and would like to be able to experiment with GPU computing in Julia (on Ubuntu). I would greatly prefer an AMD GPU because of the in-kernel driver support on Linux. My understanding i…

---

## [CUDA.jl initialization test failing](https://discourse.julialang.org/t/cuda-jl-initialization-test-failing/77526)

<div class="topic-metadata">

**Author:** [@RonRahaman](https://discourse.julialang.org/u/RonRahaman)\
**Replies:** 1\
**Last updated:** [March 7, 2022, 5:56pm UTC](https://discourse.julialang.org/t/cuda-jl-initialization-test-failing/77526 "2022-03-07T17:56:06Z")

</div>

Hi all, I’m running tests for CUDA.jl (\]test CUDA) and I have one test failing. Should I be concerned, or can I safely ignore it? Error in testset initialization: Test Failed at /usr/local/pace-apps/manual/packages/jul…

---

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

<div class="topic-metadata">

**Author:** [@RonRahaman](https://discourse.julialang.org/u/RonRahaman)\
**Replies:** 3\
**Last updated:** [March 7, 2022, 4:19pm UTC](https://discourse.julialang.org/t/error-using-system-cuda-in-cuda-jl/77423 "2022-03-07T16:19:17Z")

</div>

Hi all, I’m trying to install CUDA.jl using my system’s CUDA toolkit. The installation completes, but I get errors when I try to test it by running CUDA.version(). I set JULIA\_CUDA\_USE\_BINARYBUILDER=false and ensured t…

---

## [Outdated / bogus CUDA.jl documentation at https://juliagpu.gitlab.io/CUDA.jl?](https://discourse.julialang.org/t/outdated-bogus-cuda-jl-documentation-at-https-juliagpu-gitlab-io-cuda-jl/77515)

<div class="topic-metadata">

**Author:** [@complyue](https://discourse.julialang.org/u/complyue)\
**Replies:** 1\
**Last updated:** [March 7, 2022, 3:13pm UTC](https://discourse.julialang.org/t/outdated-bogus-cuda-jl-documentation-at-https-juliagpu-gitlab-io-cuda-jl/77515 "2022-03-07T15:13:49Z")

</div>

By CUDA.jl - Google Search , the first hit is the github repo, which is good, but the second hit is https://juliagpu.gitlab.io/CUDA.jl , which seems outdated, compared to https://cuda.juliagpu.org . But the later doesn’t…

---

## [Julia on Google Colab: Free GPU-Accelerated Shareable Notebooks](https://discourse.julialang.org/t/julia-on-google-colab-free-gpu-accelerated-shareable-notebooks/15319)

<div class="topic-metadata">

**Author:** [@jekbradbury](https://discourse.julialang.org/u/jekbradbury)\
**Replies:** 58\
**Last updated:** [March 7, 2022, 4:26am UTC](https://discourse.julialang.org/t/julia-on-google-colab-free-gpu-accelerated-shareable-notebooks/15319 "2022-03-07T04:26:21Z")

</div>

(Disclosure: While I work for Google, this is not an official Google product or announcement.) tl;dr: For Julia on Colab with GPUs, first open this notebook and run the cell (takes ~15-20 minutes), then open this one to…

---

## [Using Unified Memory with oversubscription](https://discourse.julialang.org/t/using-unified-memory-with-oversubscription/77348)

<div class="topic-metadata">

**Author:** [@anscoil](https://discourse.julialang.org/u/anscoil)\
**Replies:** 3\
**Last updated:** [March 4, 2022, 2:07pm UTC](https://discourse.julialang.org/t/using-unified-memory-with-oversubscription/77348 "2022-03-04T14:07:24Z")

</div>

Hi, I recently learnt the existence of Unified Memory in Cuda, and I’m trying to explore what is possible to do with it in Julia. I would like to use it with oversubsciption, for instance by allocating one array that i…

---

## [Recommendations for using GPU on old hardware](https://discourse.julialang.org/t/recommendations-for-using-gpu-on-old-hardware/77257)

<div class="topic-metadata">

**Author:** [@quailman1031](https://discourse.julialang.org/u/quailman1031)\
**Replies:** 3\
**Last updated:** [March 2, 2022, 8:12am UTC](https://discourse.julialang.org/t/recommendations-for-using-gpu-on-old-hardware/77257 "2022-03-02T08:12:32Z")

</div>

Is there a summary somewhere of what packages or package versions support CUDA capability levels? I have a Fermi-architecture card (GeForce GT 550M) which is compute capable 2.1 and CUDA driver 9.1 (latest available). I…

---

## [Determinant of CUDA matrix?](https://discourse.julialang.org/t/determinant-of-cuda-matrix/77245)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 8\
**Last updated:** [March 1, 2022, 8:38pm UTC](https://discourse.julialang.org/t/determinant-of-cuda-matrix/77245 "2022-03-01T20:38:36Z")

</div>

Hello, I have so far been able to use CUDA without having to dig into the actual package api (besides cu(m)) just thanks to multiple dispatch. Today I need to compute the determinant of a matrix and I would like my code…

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

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