# GPU

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

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

**Page:** 26

---

## [General question on GPU Programming and on how to use low level C API](https://discourse.julialang.org/t/general-question-on-gpu-programming-and-on-how-to-use-low-level-c-api/39526)

<div class="topic-metadata">

**Author:** [@Olivier\_Gagnon](https://discourse.julialang.org/u/Olivier_Gagnon)\
**Replies:** 1\
**Last updated:** [October 14, 2020, 6:22pm UTC](https://discourse.julialang.org/t/general-question-on-gpu-programming-and-on-how-to-use-low-level-c-api/39526 "2020-10-14T18:22:12Z")

</div>

Hey everyone, I just started to learn GPU Programming (and also rather new to Julia). I am currently trying to go through Cuda by Example but reproducing everything in Julia. I would have 2 questions (everything is exe…

---

## [MD with Subarrays and CuArrays](https://discourse.julialang.org/t/md-with-subarrays-and-cuarrays/48334)

<div class="topic-metadata">

**Author:** [@bmit](https://discourse.julialang.org/u/bmit)\
**Replies:** 5\
**Last updated:** [October 14, 2020, 3:08pm UTC](https://discourse.julialang.org/t/md-with-subarrays-and-cuarrays/48334 "2020-10-14T15:08:10Z")

</div>

A view of a CuArray has type SubArray. This means a=CUDA.zeros(3,2) b=view(a,:,1) typeof(b) \<: CuArray false If I use multiple dispatch to execute a function on the CPU or GPU depending on the type of the input then…

---

## [Global memory behavior explained](https://discourse.julialang.org/t/global-memory-behavior-explained/47422)

<div class="topic-metadata">

**Author:** [@barrettp](https://discourse.julialang.org/u/barrettp)\
**Replies:** 9\
**Last updated:** [October 13, 2020, 2:58pm UTC](https://discourse.julialang.org/t/global-memory-behavior-explained/47422 "2020-10-13T14:58:27Z")

</div>

Can anyone explain the following behavior? I am using CUDA and have a nested set of kernels, one first-level kernel and three second-level kernels. I’m performing three summations/reductions and storing the results in a…

---

## [Error when calling 2D dynamic kernel with view argument](https://discourse.julialang.org/t/error-when-calling-2d-dynamic-kernel-with-view-argument/47647)

<div class="topic-metadata">

**Author:** [@barrettp](https://discourse.julialang.org/u/barrettp)\
**Replies:** 2\
**Last updated:** [October 6, 2020, 2:23pm UTC](https://discourse.julialang.org/t/error-when-calling-2d-dynamic-kernel-with-view-argument/47647 "2020-10-06T14:23:16Z")

</div>

The following MWE returns a kernel of type Union{} for a 2D dynamic kernel with at least one argument being a view(). The kernel compiles fine if the dynamic kernel is 1D or has no view() arguments. I’d be much obliged …

---

## [Pmap with multiple GPUs](https://discourse.julialang.org/t/pmap-with-multiple-gpus/47698)

<div class="topic-metadata">

**Author:** [@theogf](https://discourse.julialang.org/u/theogf)\
**Replies:** 8\
**Last updated:** [October 5, 2020, 8:15am UTC](https://discourse.julialang.org/t/pmap-with-multiple-gpus/47698 "2020-10-05T08:15:31Z")

</div>

Hi, First CUDA.jl is simply amazing and really to use, kudos to you all! Now in my problem I have multiple GPUs and I would like to parallelize the training of my networks in parallel. So basically have one training of…

---

## [Problems copying data on the GPU](https://discourse.julialang.org/t/problems-copying-data-on-the-gpu/47518)

<div class="topic-metadata">

**Author:** [@bmit](https://discourse.julialang.org/u/bmit)\
**Replies:** 8\
**Last updated:** [October 1, 2020, 6:22am UTC](https://discourse.julialang.org/t/problems-copying-data-on-the-gpu/47518 "2020-10-01T06:22:24Z")

</div>

I’m having trouble with a basic copy operation on the GPU. My goal is to copy a chosen subset of data from an N-D array into a vector. My following two attempts have failed. using CUDA CUDA.allowscalar(false) a=CUDA.ran…

---

## [Debugging with CUDA.jl](https://discourse.julialang.org/t/debugging-with-cuda-jl/47493)

<div class="topic-metadata">

**Author:** [@bmit](https://discourse.julialang.org/u/bmit)\
**Replies:** 1\
**Last updated:** [September 29, 2020, 5:50pm UTC](https://discourse.julialang.org/t/debugging-with-cuda-jl/47493 "2020-09-29T17:50:09Z")

</div>

Does Debugger.jl work with CUDA.jl? I haven’t had any luck and wasn’t sure if I was missing something or it’s not supposed to work. Here’s the simplest case I came up with: using CUDA using Debugger function test\_cuda\_d…

---

## [How to call cuda functions that are not implemented in CUDA.jl?](https://discourse.julialang.org/t/how-to-call-cuda-functions-that-are-not-implemented-in-cuda-jl/47219)

<div class="topic-metadata">

**Author:** [@cuchxq](https://discourse.julialang.org/u/cuchxq)\
**Replies:** 8\
**Last updated:** [September 25, 2020, 1:20am UTC](https://discourse.julialang.org/t/how-to-call-cuda-functions-that-are-not-implemented-in-cuda-jl/47219 "2020-09-25T01:20:26Z")

</div>

If there is a function in CUDA, but have not been implemented in CUDA.jl, is it possible to call that function using ccall? I am trying it with a call to dgemm ( gemm is available through CUDA.jl, but I want to try a fu…

---

## [Can the CuArray/CuPtr in CUDA.jl be directly passed to foreign functions?](https://discourse.julialang.org/t/can-the-cuarray-cuptr-in-cuda-jl-be-directly-passed-to-foreign-functions/46939)

<div class="topic-metadata">

**Author:** [@weylspinor](https://discourse.julialang.org/u/weylspinor)\
**Replies:** 2\
**Last updated:** [September 22, 2020, 11:44am UTC](https://discourse.julialang.org/t/can-the-cuarray-cuptr-in-cuda-jl-be-directly-passed-to-foreign-functions/46939 "2020-09-22T11:44:10Z")

</div>

Hi, I am just wondering if there is any way to directly pass CuArrays or CuPtr in CUDA.jl to C/C++, like passing Core.Array or Core.Ref. For example, I would like to define a C function which gets a device memory pointe…

---

## [CUDA Array broadcasting: possible to use a different stream for a code block?](https://discourse.julialang.org/t/cuda-array-broadcasting-possible-to-use-a-different-stream-for-a-code-block/46845)

<div class="topic-metadata">

**Author:** [@samo](https://discourse.julialang.org/u/samo)\
**Replies:** 2\
**Last updated:** [September 21, 2020, 8:31am UTC](https://discourse.julialang.org/t/cuda-array-broadcasting-possible-to-use-a-different-stream-for-a-code-block/46845 "2020-09-21T08:31:28Z")

</div>

I am wondering if it is possible somehow to specify the stream for a code block with array computations that rely on CuArray’s broadcasting capability as e.g. A .= A .+ B in this snippet: using CUDA A = CUDA.zeros(2,3) …

---

## [Examples with atomic operations using CUDA.jl](https://discourse.julialang.org/t/examples-with-atomic-operations-using-cuda-jl/46084)

<div class="topic-metadata">

**Author:** [@duanestorti](https://discourse.julialang.org/u/duanestorti)\
**Replies:** 6\
**Last updated:** [September 15, 2020, 2:31pm UTC](https://discourse.julialang.org/t/examples-with-atomic-operations-using-cuda-jl/46084 "2020-09-15T14:31:44Z")

</div>

Can anyone point me to examples that include atomic operations using CUDA.jl? I am having some issues trying to figure out the syntax for pointers, and examples would be helpful.

---

## [Calling a CUDA kernel in an external library](https://discourse.julialang.org/t/calling-a-cuda-kernel-in-an-external-library/46505)

<div class="topic-metadata">

**Author:** [@Niclas\_Wiberg](https://discourse.julialang.org/u/Niclas_Wiberg)\
**Replies:** 6\
**Last updated:** [September 14, 2020, 5:48pm UTC](https://discourse.julialang.org/t/calling-a-cuda-kernel-in-an-external-library/46505 "2020-09-14T17:48:44Z")

</div>

Is it possible to call a precompiled CUDA kernel from Julia? I am writing CUDA kernels in C++ and compiling with nvcc, for use in a C++ application. I use Julia to test the code. Currently I write host-side wrapping fun…

---

## [Local installation of CUDA toolkit](https://discourse.julialang.org/t/local-installation-of-cuda-toolkit/46463)

<div class="topic-metadata">

**Author:** [@DanaGalizia](https://discourse.julialang.org/u/DanaGalizia)\
**Replies:** 5\
**Last updated:** [September 11, 2020, 5:49pm UTC](https://discourse.julialang.org/t/local-installation-of-cuda-toolkit/46463 "2020-09-11T17:49:50Z")

</div>

Hi, I’m trying to add the Cuda.jl package using a local installation of the CUDA toolkit. In the installation guide, it says You might want to disallow use of artifacts, e.g., because an optimized CUDA installation is …

---

## [Mapping functions using CuArrays](https://discourse.julialang.org/t/mapping-functions-using-cuarrays/46300)

<div class="topic-metadata">

**Author:** [@manderson](https://discourse.julialang.org/u/manderson)\
**Replies:** 2\
**Last updated:** [September 9, 2020, 4:12pm UTC](https://discourse.julialang.org/t/mapping-functions-using-cuarrays/46300 "2020-09-09T16:12:00Z")

</div>

I am attempting to map functions to the GPU using CUDA, CuArrays, and map(). My ultimate goal is to take what is currently a serial grid search and run each reduction in parallel on the GPU. For this, I need to pass a v…

---

## [Use of CartesianIndices with CUDA?](https://discourse.julialang.org/t/use-of-cartesianindices-with-cuda/42160)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 6\
**Last updated:** [September 7, 2020, 3:01pm UTC](https://discourse.julialang.org/t/use-of-cartesianindices-with-cuda/42160 "2020-09-07T15:01:10Z")

</div>

Hi, I have a function that iterates over all elements of a four-dimenasional array full of CartesianIndices elements 21×31×41×51 Array{CartesianIndex{4},4}: \[:, :, 1, 1\] = CartesianIndex(1, 1, 1, 1) … CartesianInde…

---

## [Mac's AMD GPU](https://discourse.julialang.org/t/macs-amd-gpu/33014)

<div class="topic-metadata">

**Author:** [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Replies:** 61\
**Last updated:** [September 7, 2020, 2:34pm UTC](https://discourse.julialang.org/t/macs-amd-gpu/33014 "2020-09-07T14:34:18Z")

</div>

the new Mac Pro seems to be very powerful and can be equipped with multiple powerful AMD GPUs. But OpenCL.jl seems very inactive. do we have any chance to unleash the power of Mac’s GPU using Julia? (Mac is not supporti…

---

## [Power of a given value into CUDA.jl kernel](https://discourse.julialang.org/t/power-of-a-given-value-into-cuda-jl-kernel/46082)

<div class="topic-metadata">

**Author:** [@eufosc](https://discourse.julialang.org/u/eufosc)\
**Replies:** 2\
**Last updated:** [September 5, 2020, 2:54pm UTC](https://discourse.julialang.org/t/power-of-a-given-value-into-cuda-jl-kernel/46082 "2020-09-05T14:54:02Z")

</div>

Hi! I’m using Julia V1.4.2 + CUDA.jl and I have an issue with a CUDA kernel. I’m trying to power the elements of an array, just like the example below: using CUDA T = \[0.0 0.666667 0.0; -0.333333 -0.25 0.333333; -0.5…

---

## [How to write device code?](https://discourse.julialang.org/t/how-to-write-device-code/11527)

<div class="topic-metadata">

**Author:** [@floswald](https://discourse.julialang.org/u/floswald)\
**Replies:** 4\
**Last updated:** [September 4, 2020, 10:32pm UTC](https://discourse.julialang.org/t/how-to-write-device-code/11527 "2020-09-04T22:32:48Z")

</div>

hi there newcomer question here. suppose i am looking at some cuda code that has a function like \_\_device\_\_ int binaryVal(const REAL x, const int n, const REAL\* X) { } where I read the \_\_device\_\_ thing as saying that …

---

## [Zygote + CUDA: scalar getindex with custom activation function using multiplication](https://discourse.julialang.org/t/zygote-cuda-scalar-getindex-with-custom-activation-function-using-multiplication/45997)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 3\
**Last updated:** [September 3, 2020, 1:40pm UTC](https://discourse.julialang.org/t/zygote-cuda-scalar-getindex-with-custom-activation-function-using-multiplication/45997 "2020-09-03T13:40:35Z")

</div>

This simple model training does not work because of the custom activation function: julia\> using CUDA,Flux julia\> CUDA.allowscalar(false) julia\> const c = 100 100 julia\> f(x) = σ(x)\*2\*c f (generic function with 1 met…

---

## [Faster small CUDA memory transfers (UnifiedMem?)](https://discourse.julialang.org/t/faster-small-cuda-memory-transfers-unifiedmem/45850)

<div class="topic-metadata">

**Author:** [@Alex\_Ellison](https://discourse.julialang.org/u/Alex_Ellison)\
**Replies:** 2\
**Last updated:** [August 31, 2020, 8:14pm UTC](https://discourse.julialang.org/t/faster-small-cuda-memory-transfers-unifiedmem/45850 "2020-08-31T20:14:21Z")

</div>

Hey, I’m trying to write a program which launches many kernels, but the launches depend on results of earlier kernels. Sometimes the result means a kernel should not be launched at all. They can be distributed across ma…

---

## [CUDA matmul performance](https://discourse.julialang.org/t/cuda-matmul-performance/45267)

<div class="topic-metadata">

**Author:** [@acxz](https://discourse.julialang.org/u/acxz)\
**Replies:** 11\
**Last updated:** [August 21, 2020, 12:42am UTC](https://discourse.julialang.org/t/cuda-matmul-performance/45267 "2020-08-21T00:42:22Z")

</div>

Hello everyone, I have recently been trying to GPUify my code. I first tried replacing my CPU Arrays with CuArrays as recommended, however, that resulted in a slower program execution time. So I’m trying to dig a bit d…

---

## [CUDA.jl tests on windows](https://discourse.julialang.org/t/cuda-jl-tests-on-windows/43378)

<div class="topic-metadata">

**Author:** [@anj](https://discourse.julialang.org/u/anj)\
**Replies:** 25\
**Last updated:** [August 19, 2020, 7:48pm UTC](https://discourse.julialang.org/t/cuda-jl-tests-on-windows/43378 "2020-08-19T19:48:24Z")

</div>

Trying to migrate to CUDA.jl. However can’t make tests passing (both with artifact download and local). Not 100% sure if this is a bug in CUDA.jl or I missed something. Any idea if tests meant to pass on Windows (I under…

---

## [Is it time to migrate to CUDA.jl?](https://discourse.julialang.org/t/is-it-time-to-migrate-to-cuda-jl/44203)

<div class="topic-metadata">

**Author:** [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Replies:** 10\
**Last updated:** [August 19, 2020, 6:01am UTC](https://discourse.julialang.org/t/is-it-time-to-migrate-to-cuda-jl/44203 "2020-08-19T06:01:10Z")

</div>

From documentation of corresponding packages: CuArrays are deprecated in favor of CUDA.jl CUDA.jl only works on Julia 1.4 latest LTS version of Julia is 1.0 From these facts I conclude that the only way to keep backwa…

---

## [Error when using dynamic parallelism with six or more arguments](https://discourse.julialang.org/t/error-when-using-dynamic-parallelism-with-six-or-more-arguments/44931)

<div class="topic-metadata">

**Author:** [@emiwar](https://discourse.julialang.org/u/emiwar)\
**Replies:** 1\
**Last updated:** [August 14, 2020, 7:50pm UTC](https://discourse.julialang.org/t/error-when-using-dynamic-parallelism-with-six-or-more-arguments/44931 "2020-08-14T19:50:34Z")

</div>

Hi, I’m getting an error (unsupported dynamic function invocation) when I run manyArgs(a, b, c, d, e, f) = nothing caller() = (@CUDA.cuda dynamic=true manyArgs(1,2,3,4,5,6); nothing) @CUDA.cuda caller() while manyArg…

---

## [Passing too long tuples into CUDA kernel causes an error](https://discourse.julialang.org/t/passing-too-long-tuples-into-cuda-kernel-causes-an-error/44239)

<div class="topic-metadata">

**Author:** [@fedoroff](https://discourse.julialang.org/u/fedoroff)\
**Replies:** 3\
**Last updated:** [August 10, 2020, 3:02pm UTC](https://discourse.julialang.org/t/passing-too-long-tuples-into-cuda-kernel-causes-an-error/44239 "2020-08-10T15:02:55Z")

</div>

Consider the following code where I create a tuple of structures and pass it into the GPU kernel: import CUDA struct Foo{T} a :: T b :: T end function func(u, foos) N = length(u) function get\_config…

---

## [Pointer to CuArray as a parameter for DifferentialEquations right-hand-side function](https://discourse.julialang.org/t/pointer-to-cuarray-as-a-parameter-for-differentialequations-right-hand-side-function/44125)

<div class="topic-metadata">

**Author:** [@fedoroff](https://discourse.julialang.org/u/fedoroff)\
**Replies:** 9\
**Last updated:** [August 9, 2020, 9:58am UTC](https://discourse.julialang.org/t/pointer-to-cuarray-as-a-parameter-for-differentialequations-right-hand-side-function/44125 "2020-08-09T09:58:31Z")

</div>

I would like to pass a pointer to CuArray (or one of its sections) as a parameter for DifferentialEquations right-hand-side function which is defined as a GPU kernel function. Why do I need it? I have a differential equ…

---

## [Which GPU should I ask for?](https://discourse.julialang.org/t/which-gpu-should-i-ask-for/43861)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 4\
**Last updated:** [July 29, 2020, 1:43pm UTC](https://discourse.julialang.org/t/which-gpu-should-i-ask-for/43861 "2020-07-29T13:43:08Z")

</div>

Hello, we have a remote server (not VPS) and I would like to ask the company managing it to add a GPU for machine learning computations (using CUDA.jl I suppose). Is there a list of supported GPU? How they are organise…

---

## [ERROR: could not load library libcutensor.so](https://discourse.julialang.org/t/error-could-not-load-library-libcutensor-so/43020)

<div class="topic-metadata">

**Author:** [@samo](https://discourse.julialang.org/u/samo)\
**Replies:** 19\
**Last updated:** [July 24, 2020, 6:24am UTC](https://discourse.julialang.org/t/error-could-not-load-library-libcutensor-so/43020 "2020-07-24T06:24:26Z")

</div>

After a fresh installation of CUDA.jl 1.1/1.0, we got the following error on a cluster when trying to precompile a package that has CUDA in its dependencies: \[ Info: Precompiling ParallelStencil \[94395366-693c-11ea-3b26…

---

## [CuArrays deprecated?](https://discourse.julialang.org/t/cuarrays-deprecated/43064)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 1\
**Last updated:** [July 14, 2020, 5:42pm UTC](https://discourse.julialang.org/t/cuarrays-deprecated/43064 "2020-07-14T17:42:51Z")

</div>

Hi, I’ve just realized that CuArrays seems to be deprecated in favour of CUDA.jl. Now I tried add CUDA and failed, but did work add CUDA.jl why the .jl? Anyway it is not critical… Still I have lots of code lines wr…

---

## [Add CUDA adds v0.1](https://discourse.julialang.org/t/add-cuda-adds-v0-1/43032)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 10\
**Last updated:** [July 14, 2020, 11:11am UTC](https://discourse.julialang.org/t/add-cuda-adds-v0-1/43032 "2020-07-14T11:11:10Z")

</div>

I just moved from the deprecated CuArrays package to CUDA. I used add CUDA and status tells me v0.1 is installed. The most recent release is v1.1.0. Am I doing something wrong ? Maybe I have to uninstall stuff before ?

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

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