# GPU

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

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

**Page:** 11

---

## [Using @view with CuArrays](https://discourse.julialang.org/t/using-view-with-cuarrays/104057)

<div class="topic-metadata">

**Author:** [@Kieran\_Marray](https://discourse.julialang.org/u/Kieran_Marray)\
**Replies:** 6\
**Last updated:** [September 20, 2023, 8:52pm UTC](https://discourse.julialang.org/t/using-view-with-cuarrays/104057 "2023-09-20T20:52:34Z")

</div>

Hi. I am new to GPU programming with Julia, and trying to run a matrix multiplication within a loop. It is important this is performant, so want to minimise allocations. But if I run the following minimal example (as I w…

---

## [How to determine what size and how many textures I can use?](https://discourse.julialang.org/t/how-to-determine-what-size-and-how-many-textures-i-can-use/104018)

<div class="topic-metadata">

**Author:** [@lodygaw](https://discourse.julialang.org/u/lodygaw)\
**Replies:** 1\
**Last updated:** [September 19, 2023, 11:04am UTC](https://discourse.julialang.org/t/how-to-determine-what-size-and-how-many-textures-i-can-use/104018 "2023-09-19T11:04:53Z")

</div>

Hi, Is there a way to determine (programmatically) what is the maximum size of 1D texture array for particular device? Is there any limitation how many texture arrays can be used in total?

---

## [Use ParallelStencil.jl with GPU](https://discourse.julialang.org/t/use-parallelstencil-jl-with-gpu/103439)

<div class="topic-metadata">

**Author:** [@chloisu](https://discourse.julialang.org/u/chloisu)\
**Replies:** 3\
**Last updated:** [September 1, 2023, 11:15am UTC](https://discourse.julialang.org/t/use-parallelstencil-jl-with-gpu/103439 "2023-09-01T11:15:12Z")

</div>

Hello, I’m very happy to use ParallelStencil.jl. The CPU version (i.e. USE\_GPU = false) works fine. However, when I try to run the example script diffusion3D\_novis\_noperf.jl with the GPU (i.e. USE\_GPU = true), I get the…

---

## [Does Flux.jl layers make use of tensor cores in Nvidia GPUs?](https://discourse.julialang.org/t/does-flux-jl-layers-make-use-of-tensor-cores-in-nvidia-gpus/103249)

<div class="topic-metadata">

**Author:** [@lepton01](https://discourse.julialang.org/u/lepton01)\
**Replies:** 1\
**Last updated:** [August 28, 2023, 7:31am UTC](https://discourse.julialang.org/t/does-flux-jl-layers-make-use-of-tensor-cores-in-nvidia-gpus/103249 "2023-08-28T07:31:18Z")

</div>

I was searching for an answer in the Flux.jl, CUDA.jl, cuDNN.jl, but only found \[https://juliagpu.org/2020-10-02-cuda\_2.0/#low--and-mixed-precision-operations\] which talks about independent GPU operations using CUDA.jl. …

---

## [How to perform GPU overlap operations on the custom kernel function?](https://discourse.julialang.org/t/how-to-perform-gpu-overlap-operations-on-the-custom-kernel-function/102855)

<div class="topic-metadata">

**Author:** [@fred\_wu](https://discourse.julialang.org/u/fred_wu)\
**Replies:** 8\
**Last updated:** [August 26, 2023, 9:23am UTC](https://discourse.julialang.org/t/how-to-perform-gpu-overlap-operations-on-the-custom-kernel-function/102855 "2023-08-26T09:23:21Z")

</div>

Hi, I’m trying to use different GPU kernels for overlapping operations because a single kernel usually cannot fully utilize GPU hardware resources. I defined a kernel function and tried the following, but the running ti…

---

## [Why does GPU addition slows down as the array get larger compared to other methods?](https://discourse.julialang.org/t/why-does-gpu-addition-slows-down-as-the-array-get-larger-compared-to-other-methods/103122)

<div class="topic-metadata">

**Author:** [@Reza-Reza](https://discourse.julialang.org/u/Reza-Reza)\
**Replies:** 7\
**Last updated:** [August 25, 2023, 8:53pm UTC](https://discourse.julialang.org/t/why-does-gpu-addition-slows-down-as-the-array-get-larger-compared-to-other-methods/103122 "2023-08-25T20:53:42Z")

</div>

Consider the three functions below which add two arrays sequentially, using threads, and using GPU: using BenchmarkTools using CUDA function sequential\_add!(y, x) for i in eachindex(y, x) @inbounds y\[i\] += …

---

## [Normalize a large matrix by row](https://discourse.julialang.org/t/normalize-a-large-matrix-by-row/102997)

<div class="topic-metadata">

**Author:** [@A\_M](https://discourse.julialang.org/u/A_M)\
**Replies:** 10\
**Last updated:** [August 25, 2023, 8:21am UTC](https://discourse.julialang.org/t/normalize-a-large-matrix-by-row/102997 "2023-08-25T08:21:51Z")

</div>

How can I use a CUDA kernel to normalize a big matrix A by row and use the same scaling factors to a vector b?

---

## [CUDA fft wrapper problem](https://discourse.julialang.org/t/cuda-fft-wrapper-problem/29540)

<div class="topic-metadata">

**Author:** [@Michael\_Benton](https://discourse.julialang.org/u/Michael_Benton)\
**Replies:** 1\
**Last updated:** [August 24, 2023, 12:56pm UTC](https://discourse.julialang.org/t/cuda-fft-wrapper-problem/29540 "2023-08-24T12:56:29Z")

</div>

A 1d fft across the 2nd dimension of 3 dimensional CuArray is not enabled by the wrapper (ERROR: ArgumentError: batching dims must be sequential) to reproduce: dim = 2 data = CuArrays.rand(ComplexF32,512,512,512); my…

---

## [OneAPI FPGA support](https://discourse.julialang.org/t/oneapi-fpga-support/103126)

<div class="topic-metadata">

**Author:** [@smartalecH](https://discourse.julialang.org/u/smartalecH)\
**Replies:** 3\
**Last updated:** [August 24, 2023, 7:43am UTC](https://discourse.julialang.org/t/oneapi-fpga-support/103126 "2023-08-24T07:43:48Z")

</div>

It seems like the julia bindings for OneAPI have come a long way (very cool!) I noticed that the current framework is validated to work with the Intel Compute Framework (which includes various Intel GPUs). Does anyone k…

---

## [Can the CPU function be a multi-process parallel function when using the Threads.@spawn command to perform overlapping operations between the GPU and the CPU?](https://discourse.julialang.org/t/can-the-cpu-function-be-a-multi-process-parallel-function-when-using-the-threads-spawn-command-to-perform-overlapping-operations-between-the-gpu-and-the-cpu/103098)

<div class="topic-metadata">

**Author:** [@fred\_wu](https://discourse.julialang.org/u/fred_wu)\
**Replies:** 3\
**Last updated:** [August 24, 2023, 7:45am UTC](https://discourse.julialang.org/t/can-the-cpu-function-be-a-multi-process-parallel-function-when-using-the-threads-spawn-command-to-perform-overlapping-operations-between-the-gpu-and-the-cpu/103098 "2023-08-24T07:45:01Z")

</div>

Hi, When the CPU performs compute-intensive tasks, it never yields, so the Threads.@spawn command assigns CPU and GPU operations to different threads to achieve overlap and shorten the overall running time. However, can…

---

## [Error with Flux.update! with Metal gpu backend](https://discourse.julialang.org/t/error-with-flux-update-with-metal-gpu-backend/102964)

<div class="topic-metadata">

**Author:** [@Bill\_Holmes](https://discourse.julialang.org/u/Bill_Holmes)\
**Replies:** 1\
**Last updated:** [August 19, 2023, 2:50pm UTC](https://discourse.julialang.org/t/error-with-flux-update-with-metal-gpu-backend/102964 "2023-08-19T14:50:54Z")

</div>

I’m trying to get Flux up and running with Metal as the gpu backend. The documentation for this is great, but I keep running into an issue. I’ve distilled the issue into a very simple FFNN. The code below, defines a simp…

---

## [How to make \`Colon()\` stable in CUDA kernel](https://discourse.julialang.org/t/how-to-make-colon-stable-in-cuda-kernel/102934)

<div class="topic-metadata">

**Author:** [@huiyuxie](https://discourse.julialang.org/u/huiyuxie)\
**Replies:** 1\
**Last updated:** [August 18, 2023, 11:21am UTC](https://discourse.julialang.org/t/how-to-make-colon-stable-in-cuda-kernel/102934 "2023-08-18T11:21:04Z")

</div>

Hi! I’m wondering is there any way to make Colon() stable when calling the CUDA kernel. For example (I’ve simplified the sample case here as the practical one is complex), # Helper function function view\_helper(u, arg1,…

---

## [Simple matrix multiplication using MtlArray kills REPL](https://discourse.julialang.org/t/simple-matrix-multiplication-using-mtlarray-kills-repl/102905)

<div class="topic-metadata">

**Author:** [@Bill\_Holmes](https://discourse.julialang.org/u/Bill_Holmes)\
**Replies:** 4\
**Last updated:** [August 17, 2023, 2:44pm UTC](https://discourse.julialang.org/t/simple-matrix-multiplication-using-mtlarray-kills-repl/102905 "2023-08-17T14:44:25Z")

</div>

First off, for those working on the development of Metal.jl, if you read this, thank you! Now for my issue / bug. In trying to do something with metal, I ran into the following reproducible problem. Consider the simple …

---

## [How to pass a mutable struct to CUDA kernel argument](https://discourse.julialang.org/t/how-to-pass-a-mutable-struct-to-cuda-kernel-argument/102804)

<div class="topic-metadata">

**Author:** [@huiyuxie](https://discourse.julialang.org/u/huiyuxie)\
**Replies:** 3\
**Last updated:** [August 16, 2023, 8:39pm UTC](https://discourse.julialang.org/t/how-to-pass-a-mutable-struct-to-cuda-kernel-argument/102804 "2023-08-16T20:39:03Z")

</div>

Hi all! I’m exploring ways to pass a mutable struct as an argument to a CUDA kernel. For example, # Define a custom struct here mutable struct MyStruct field1::Float32 field2::Float32 field3::Float32 ...…

---

## [Bugs on Using CUDA.jl on Jeston AGX Orin Developer Kit](https://discourse.julialang.org/t/bugs-on-using-cuda-jl-on-jeston-agx-orin-developer-kit/102847)

<div class="topic-metadata">

**Author:** [@Sujaio](https://discourse.julialang.org/u/Sujaio)\
**Replies:** 1\
**Last updated:** [August 16, 2023, 7:25am UTC](https://discourse.julialang.org/t/bugs-on-using-cuda-jl-on-jeston-agx-orin-developer-kit/102847 "2023-08-16T07:25:04Z")

</div>

Iv deployed juliaup for Nvidia Orin, when I use different version of julia and test the CUDA, the simple computing of matrix multiplication is out of GPU memory. Is someone using CUDA on Orin?

---

## [Scalar indexing is disallowed](https://discourse.julialang.org/t/scalar-indexing-is-disallowed/102808)

<div class="topic-metadata">

**Author:** [@A\_M](https://discourse.julialang.org/u/A_M)\
**Replies:** 4\
**Last updated:** [August 15, 2023, 12:50pm UTC](https://discourse.julialang.org/t/scalar-indexing-is-disallowed/102808 "2023-08-15T12:50:58Z")

</div>

Can you tell me why I am getting it? ERROR: LoadError: Scalar indexing is disallowed. Invocation of getindex resulted in scalar indexing of a GPU array. This is typically caused by calling an iterating implementation of…

---

## [Compute intensive function rewrite](https://discourse.julialang.org/t/compute-intensive-function-rewrite/102809)

<div class="topic-metadata">

**Author:** [@BioinfoBuggaBoo](https://discourse.julialang.org/u/BioinfoBuggaBoo)\
**Replies:** 2\
**Last updated:** [August 15, 2023, 5:08am UTC](https://discourse.julialang.org/t/compute-intensive-function-rewrite/102809 "2023-08-15T05:08:50Z")

</div>

I have been using a package in R that really only has one main function which does a lot behind the scenes of which a portion is prohibitively slow to the point where the timescales involved are far too long to ever achi…

---

## [Multi-threaded calls to CUDA matrix multiplication](https://discourse.julialang.org/t/multi-threaded-calls-to-cuda-matrix-multiplication/102753)

<div class="topic-metadata">

**Author:** [@eveningsilverfox](https://discourse.julialang.org/u/eveningsilverfox)\
**Replies:** 5\
**Last updated:** [August 13, 2023, 5:58pm UTC](https://discourse.julialang.org/t/multi-threaded-calls-to-cuda-matrix-multiplication/102753 "2023-08-13T17:58:04Z")

</div>

I am trying to call CUDA matrix multiplication using a multi-threaded for loop, but I am getting an error (Initialising Julia with julia -t8). My cpu has 8 cores (16 threads), and my GPU is NVIDIA GeForce GTX 1650 with 1…

---

## [CSC to CSR Transformation in GPU](https://discourse.julialang.org/t/csc-to-csr-transformation-in-gpu/102697)

<div class="topic-metadata">

**Author:** [@A\_M](https://discourse.julialang.org/u/A_M)\
**Replies:** 2\
**Last updated:** [August 10, 2023, 11:21pm UTC](https://discourse.julialang.org/t/csc-to-csr-transformation-in-gpu/102697 "2023-08-10T23:21:28Z")

</div>

Is there any way to transfer A in CSC to CSR in CUDA using Adjoint? n\_rows = 1000000 n\_cols = 1000000 nnz = 10000000 row\_indices = rand(1:n\_rows, nnz) col\_indices = rand(1:n\_cols, nnz) values = rand(nnz) A = spars…

---

## [CUFFT.plan\_fft! take a lot of memory, cannot be freed](https://discourse.julialang.org/t/cufft-plan-fft-take-a-lot-of-memory-cannot-be-freed/102377)

<div class="topic-metadata">

**Author:** [@jinfreedom](https://discourse.julialang.org/u/jinfreedom)\
**Replies:** 3\
**Last updated:** [August 3, 2023, 8:03am UTC](https://discourse.julialang.org/t/cufft-plan-fft-take-a-lot-of-memory-cannot-be-freed/102377 "2023-08-03T08:03:06Z")

</div>

Hi, I’m playing with CUDA.jl for FFT computations. I use CUFFT.plan\_fft! to perform in-place FFT on large complex arrays. What I found was the in-place plan itself seems to occupy a large chunk of GPU memory about the sa…

---

## [Is there any good way to call functions from a set of functions in a CUDA kernel](https://discourse.julialang.org/t/is-there-any-good-way-to-call-functions-from-a-set-of-functions-in-a-cuda-kernel/102051)

<div class="topic-metadata">

**Author:** [@huiyuxie](https://discourse.julialang.org/u/huiyuxie)\
**Replies:** 3\
**Last updated:** [July 25, 2023, 7:49pm UTC](https://discourse.julialang.org/t/is-there-any-good-way-to-call-functions-from-a-set-of-functions-in-a-cuda-kernel/102051 "2023-07-25T19:49:55Z")

</div>

Hi! I had some problem with calling functions from a function set in CUDA kernels. For example, if I define a function set like below and then call the kernel # Define function f1, f2, f3, f4, f5 ... # Create a NamedTu…

---

## [Launching a Metal kernel from a thread](https://discourse.julialang.org/t/launching-a-metal-kernel-from-a-thread/102010)

<div class="topic-metadata">

**Author:** [@f.ij](https://discourse.julialang.org/u/f.ij)\
**Replies:** 3\
**Last updated:** [July 24, 2023, 1:45pm UTC](https://discourse.julialang.org/t/launching-a-metal-kernel-from-a-thread/102010 "2023-07-24T13:45:40Z")

</div>

I’m trying to get into some basic GPU programming to run some analysis on data that would be unfeasible to run on the CPU. I have written a GPU kernel to compute the correlation length function of some data. I call this…

---

## [FoldsCUDA not working with simple reduction](https://discourse.julialang.org/t/foldscuda-not-working-with-simple-reduction/101917)

<div class="topic-metadata">

**Author:** [@RobertGregg](https://discourse.julialang.org/u/RobertGregg)\
**Replies:** 1\
**Last updated:** [July 22, 2023, 7:58am UTC](https://discourse.julialang.org/t/foldscuda-not-working-with-simple-reduction/101917 "2023-07-22T07:58:52Z")

</div>

I was trying to find the largest error between two matrix columns and I wanted to try parallelizing it on the GPU: using FLoops using CUDA using FoldsCUDA #To loop through all column pairs allpairs(v) = ((i,j) for j in…

---

## [Can we use GLPK library in GPU programming?](https://discourse.julialang.org/t/can-we-use-glpk-library-in-gpu-programming/101697)

<div class="topic-metadata">

**Author:** [@Jayesh\_Patil](https://discourse.julialang.org/u/Jayesh_Patil)\
**Replies:** 16\
**Last updated:** [July 18, 2023, 1:51pm UTC](https://discourse.julialang.org/t/can-we-use-glpk-library-in-gpu-programming/101697 "2023-07-18T13:51:38Z")

</div>

i am trying to apply constraints on array such that the element present in array which are greater than 1 and 4, are completely divisible by that element. and such elements are stored in another array. How can I do that …

---

## [CuArray error when running NeuralPDE.jl on JuliaHub](https://discourse.julialang.org/t/cuarray-error-when-running-neuralpde-jl-on-juliahub/101798)

<div class="topic-metadata">

**Author:** [@PeX](https://discourse.julialang.org/u/PeX)\
**Replies:** 0\
**Last updated:** [July 19, 2023, 6:49pm UTC](https://discourse.julialang.org/t/cuarray-error-when-running-neuralpde-jl-on-juliahub/101798 "2023-07-19T18:49:52Z")

</div>

Hi everyone! I was trying to test the GPU ability of NeuralPDE.jl on the JuliaHub, my network is defined like this: # Neural network inner = 25 chain = Chain(Dense(3,inner,Lux.σ), Dense(inner,inner,Lux.σ)…

---

## [GPU Parallel Computing for Global Sensitivity Analysis](https://discourse.julialang.org/t/gpu-parallel-computing-for-global-sensitivity-analysis/101545)

<div class="topic-metadata">

**Author:** [@Nick1](https://discourse.julialang.org/u/Nick1)\
**Replies:** 2\
**Last updated:** [July 14, 2023, 8:24pm UTC](https://discourse.julialang.org/t/gpu-parallel-computing-for-global-sensitivity-analysis/101545 "2023-07-14T20:24:31Z")

</div>

Hi everyone. I try to speed up Global Sensitivity Analysis calculations based on the code in this link (Global sensitivity analysis in a large parameter space - computational cost - #11 by TS-CUBED). Essentially, I chang…

---

## [NeuralPDE.jl GPU example returns "ERROR: UndefVarError: \`Adam\` not defined"](https://discourse.julialang.org/t/neuralpde-jl-gpu-example-returns-error-undefvarerror-adam-not-defined/101501)

<div class="topic-metadata">

**Author:** [@PeX](https://discourse.julialang.org/u/PeX)\
**Replies:** 1\
**Last updated:** [July 12, 2023, 4:23pm UTC](https://discourse.julialang.org/t/neuralpde-jl-gpu-example-returns-error-undefvarerror-adam-not-defined/101501 "2023-07-12T16:23:05Z")

</div>

Hello everyone, I’m trying to run the example from NeuralPDE: https://neuralpde.sciml.ai/stable/tutorials/gpu/ However when I run the line: res = Optimization.solve(prob,Adam(0.01);callback = callback,maxiters=2500) …

---

## [CUDA profiling tools crashing](https://discourse.julialang.org/t/cuda-profiling-tools-crashing/101458)

<div class="topic-metadata">

**Author:** [@smartalecH](https://discourse.julialang.org/u/smartalecH)\
**Replies:** 2\
**Last updated:** [July 11, 2023, 8:16pm UTC](https://discourse.julialang.org/t/cuda-profiling-tools-crashing/101458 "2023-07-11T20:16:45Z")

</div>

Per the docs, I’m trying to get some extra insight into my kernels using some of CUDA’s profiling tools. I’ve tried running $ nsys launch julia along with $ ncu --mode=launch julia but both commands crash with the f…

---

## [Calling Julia from PyTorch](https://discourse.julialang.org/t/calling-julia-from-pytorch/101357)

<div class="topic-metadata">

**Author:** [@AMart](https://discourse.julialang.org/u/AMart)\
**Replies:** 4\
**Last updated:** [July 10, 2023, 7:31pm UTC](https://discourse.julialang.org/t/calling-julia-from-pytorch/101357 "2023-07-10T19:31:35Z")

</div>

Hello I have written a GPU kernel in Julia that I use to accelerate a custom layer that I have written to be used with PyTorch. Everything works great, except when I try to use DDP from PyTorch. Here is a simple MWE tha…

---

## [How do I reduce into an array index on a GPU?](https://discourse.julialang.org/t/how-do-i-reduce-into-an-array-index-on-a-gpu/101451)

<div class="topic-metadata">

**Author:** [@ejmeitz](https://discourse.julialang.org/u/ejmeitz)\
**Replies:** 0\
**Last updated:** [July 10, 2023, 7:20pm UTC](https://discourse.julialang.org/t/how-do-i-reduce-into-an-array-index-on-a-gpu/101451 "2023-07-10T19:20:09Z")

</div>

Hello all, This might be too niche but I am doing the following sparse tenor times matrix multiplication: A(n,m,l) = B(i,j,k) C(i,n) C(j,m)C(l,k) I can calculate a single element of the matrix A: A\[n,m,l\] where B is a…

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

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