# GPU

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

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

**Page:** 28

---

## [ArgumentError: cannot take the CPU address of a CuArray when using selectdim](https://discourse.julialang.org/t/argumenterror-cannot-take-the-cpu-address-of-a-cuarray-when-using-selectdim/37281)

<div class="topic-metadata">

**Author:** [@Geoffrey](https://discourse.julialang.org/u/Geoffrey)\
**Replies:** 4\
**Last updated:** [April 10, 2020, 5:06pm UTC](https://discourse.julialang.org/t/argumenterror-cannot-take-the-cpu-address-of-a-cuarray-when-using-selectdim/37281 "2020-04-10T17:06:11Z")

</div>

Hi, I’m quite new to Julia computing and even more to GPU computing but I notice that selectdim function from julia output is stored on the CPU acording to this error: “ERROR: ArgumentError: cannot take the CPU address …

---

## ["Your CUDA installation does not provide libcudadevrt" even though it is available in /usr/local/cuda-10.0](https://discourse.julialang.org/t/your-cuda-installation-does-not-provide-libcudadevrt-even-though-it-is-available-in-usr-local-cuda-10-0/37011)

<div class="topic-metadata">

**Author:** [@rmz](https://discourse.julialang.org/u/rmz)\
**Replies:** 4\
**Last updated:** [April 5, 2020, 10:19am UTC](https://discourse.julialang.org/t/your-cuda-installation-does-not-provide-libcudadevrt-even-though-it-is-available-in-usr-local-cuda-10-0/37011 "2020-04-05T10:19:16Z")

</div>

I’ve gotten access to a nice machine with a rack full of GPUs running ubuntu. However I can’t get Julia 1.4.0 to use any of the GPUs. Do you have any suggestions for investegations I could do to figure out what’s wrong…

---

## [GPU Sort Function](https://discourse.julialang.org/t/gpu-sort-function/36065)

<div class="topic-metadata">

**Author:** [@bmit](https://discourse.julialang.org/u/bmit)\
**Replies:** 20\
**Last updated:** [April 2, 2020, 1:28pm UTC](https://discourse.julialang.org/t/gpu-sort-function/36065 "2020-04-02T13:28:25Z")

</div>

I was wondering if anyone has implemented a sort or partialsort function that is GPU friendly. Ultimately I need to compute statistical metrics of a dataset such as median or quartile that require sorting. I saw it was …

---

## [CuArrays v2.0.1 results in segmentation fault for LinearAlgebra.mul!](https://discourse.julialang.org/t/cuarrays-v2-0-1-results-in-segmentation-fault-for-linearalgebra-mul/36755)

<div class="topic-metadata">

**Author:** [@fedoroff](https://discourse.julialang.org/u/fedoroff)\
**Replies:** 4\
**Last updated:** [March 31, 2020, 7:56am UTC](https://discourse.julialang.org/t/cuarrays-v2-0-1-results-in-segmentation-fault-for-linearalgebra-mul/36755 "2020-03-31T07:56:51Z")

</div>

The following code with CuArrays v2.0.1 results in segmentation fault on my computer: import CuArrays import LinearAlgebra N = 1024 y = CuArrays.zeros(N) x = CuArrays.zeros(N) A = CuArrays.zeros((N, N)) LinearAlgebra…

---

## [pow(Complex, Int) supported on CUDA?](https://discourse.julialang.org/t/pow-complex-int-supported-on-cuda/36280)

<div class="topic-metadata">

**Author:** [@a5vzener](https://discourse.julialang.org/u/a5vzener)\
**Replies:** 2\
**Last updated:** [March 26, 2020, 12:57am UTC](https://discourse.julialang.org/t/pow-complex-int-supported-on-cuda/36280 "2020-03-26T00:57:14Z")

</div>

I’m trying to run some Julia code on my new nVidia Jetson Nano and I ran into this error: \> \*\*\[ Info:\*\* Building the CUDAnative run-time library for your sm\_53 device, this might take a while... \> \*\*ERROR:\*\* LoadError: …

---

## [Using CuArrays returns incompatibility between CUDA and LLVM](https://discourse.julialang.org/t/using-cuarrays-returns-incompatibility-between-cuda-and-llvm/36465)

<div class="topic-metadata">

**Author:** [@sbacelar](https://discourse.julialang.org/u/sbacelar)\
**Replies:** 1\
**Last updated:** [March 25, 2020, 10:21am UTC](https://discourse.julialang.org/t/using-cuarrays-returns-incompatibility-between-cuda-and-llvm/36465 "2020-03-25T10:21:10Z")

</div>

I am trying to follow this example on Windows 10 and Julia 1.4 and I am getting the following warning: using CuArrays x\_d = CuArrays.fill(1.0f0, N) # a vector stored on the GPU filled with 1.0 (Float32) y\_d = CuArrays.…

---

## [Incompatibility detected between CUDA and LLVM 8.0+;](https://discourse.julialang.org/t/incompatibility-detected-between-cuda-and-llvm-8-0/36434)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 2\
**Last updated:** [March 24, 2020, 12:28pm UTC](https://discourse.julialang.org/t/incompatibility-detected-between-cuda-and-llvm-8-0/36434 "2020-03-24T12:28:30Z")

</div>

Hi, this is julia 1.4.0 updated as of today. When I ran using CuArrays using CuArrays.CURAND using CUDAnative using CUDAdrv I got the above warning Warning: Incompatibility detected between CUDA and LLVM 8.0+; disabl…

---

## [AssertionError: ctx === CuCurrentContext()](https://discourse.julialang.org/t/assertionerror-ctx-cucurrentcontext/36026)

<div class="topic-metadata">

**Author:** [@benoitseron](https://discourse.julialang.org/u/benoitseron)\
**Replies:** 3\
**Last updated:** [March 16, 2020, 11:41am UTC](https://discourse.julialang.org/t/assertionerror-ctx-cucurrentcontext/36026 "2020-03-16T11:41:08Z")

</div>

I am trying to setup Julia to use my GPU, out of curiosity as I am a new user. After a few problems, I encoutered this one, where I have not found anything (apart from this which didn’t help me either): using Benchmark…

---

## [Cant Install CUDA for gpu](https://discourse.julialang.org/t/cant-install-cuda-for-gpu/35973)

<div class="topic-metadata">

**Author:** [@shashiracherla](https://discourse.julialang.org/u/shashiracherla)\
**Replies:** 2\
**Last updated:** [March 14, 2020, 4:58pm UTC](https://discourse.julialang.org/t/cant-install-cuda-for-gpu/35973 "2020-03-14T16:58:53Z")

</div>

Hi newbie here, please help me im not able to install CUDA for julia (v1.0) pkg\> add CUDA Updating registry at \`~/.julia/registries/General\` Updating git-repo \`https://github.com/JuliaRegistries/General.git\` ERROR:…

---

## [CuArrays warning: You are using CUDNN 7.1.4 for CUDA 9.0.0 with CUDA toolkit 9.2.148; these might be incompatible](https://discourse.julialang.org/t/cuarrays-warning-you-are-using-cudnn-7-1-4-for-cuda-9-0-0-with-cuda-toolkit-9-2-148-these-might-be-incompatible/35891)

<div class="topic-metadata">

**Author:** [@Phil\_Tomson](https://discourse.julialang.org/u/Phil_Tomson)\
**Replies:** 4\
**Last updated:** [March 13, 2020, 3:23pm UTC](https://discourse.julialang.org/t/cuarrays-warning-you-are-using-cudnn-7-1-4-for-cuda-9-0-0-with-cuda-toolkit-9-2-148-these-might-be-incompatible/35891 "2020-03-13T15:23:22Z")

</div>

I was trying to run the Flux modelzoo MNIST mlp.jl example and I notice these warning coming from CuArrays.jl: julia\> include("mlp.jl") \[ Info: Precompiling Flux \[587475ba-b771-5e3f-ad9e-33799f191a9c\] ┌ Warning: CuArray…

---

## [Can not install CUDAnative](https://discourse.julialang.org/t/can-not-install-cudanative/35925)

<div class="topic-metadata">

**Author:** [@sbacelar](https://discourse.julialang.org/u/sbacelar)\
**Replies:** 2\
**Last updated:** [March 13, 2020, 1:30pm UTC](https://discourse.julialang.org/t/can-not-install-cudanative/35925 "2020-03-13T13:30:36Z")

</div>

GPU newbie here (Julia 1.3.1 and Windows 10). I have been able to install CUDAdrv v6.1.0 but when I try to install CUDAnative (and also CuArrays) I receive the following error: (v1.3) pkg\> add CUDAnative Resolving pack…

---

## [Reading from a KNetArray within a GPU kernel function](https://discourse.julialang.org/t/reading-from-a-knetarray-within-a-gpu-kernel-function/35767)

<div class="topic-metadata">

**Author:** [@dfenn](https://discourse.julialang.org/u/dfenn)\
**Replies:** 0\
**Last updated:** [March 9, 2020, 7:46pm UTC](https://discourse.julialang.org/t/reading-from-a-knetarray-within-a-gpu-kernel-function/35767 "2020-03-09T19:46:40Z")

</div>

Is it possible to use KNetArrays from within a custom GPU kernel function? The following MWE fails: using Knet using GPUArrays knArray = KnetArray(rand(4,4)) function kernel(state, knArray) temp = knArray\[1\] …

---

## [CUDAnative dynamic allocation](https://discourse.julialang.org/t/cudanative-dynamic-allocation/35435)

<div class="topic-metadata">

**Author:** [@Michael\_Benton](https://discourse.julialang.org/u/Michael_Benton)\
**Replies:** 5\
**Last updated:** [March 4, 2020, 6:29pm UTC](https://discourse.julialang.org/t/cudanative-dynamic-allocation/35435 "2020-03-04T18:29:52Z")

</div>

I need to be able to dynamically allocate in kernel. val = MArray{Tuple{4}, Float32}(undef) is a way to get static allocation with StaticArrays.jl inside a CUDA kernel I figured something like Array{Float32}(undef, 4) …

---

## [Yay, I finally managed to define my custom kernel. But now I need it to be fast(er)](https://discourse.julialang.org/t/yay-i-finally-managed-to-define-my-custom-kernel-but-now-i-need-it-to-be-fast-er/34398)

<div class="topic-metadata">

**Author:** [@izzorts](https://discourse.julialang.org/u/izzorts)\
**Replies:** 6\
**Last updated:** [March 2, 2020, 10:39am UTC](https://discourse.julialang.org/t/yay-i-finally-managed-to-define-my-custom-kernel-but-now-i-need-it-to-be-fast-er/34398 "2020-03-02T10:39:41Z")

</div>

Hi! It’s been about a week that I started learning GPGPU in Julia. At first I used ArrayFire, but then I needed to do some more sophisticated computations on the GPU and started trying to define my own custom kernels via…

---

## [CUDAnative: would it be possible to specify interface arguments rather than kernel arguments?](https://discourse.julialang.org/t/cudanative-would-it-be-possible-to-specify-interface-arguments-rather-than-kernel-arguments/35282)

<div class="topic-metadata">

**Author:** [@samo](https://discourse.julialang.org/u/samo)\
**Replies:** 2\
**Last updated:** [March 2, 2020, 9:24am UTC](https://discourse.julialang.org/t/cudanative-would-it-be-possible-to-specify-interface-arguments-rather-than-kernel-arguments/35282 "2020-03-02T09:24:16Z")

</div>

Issue Let’s consider the following simple CUDAnative example: julia\> using CuArrays, CUDAnative julia\> A = CuArrays.zeros(2,2) 2×2 CuArray{Float32,2}: 0.0 0.0 0.0 0.0 julia\> B = CuArrays.ones(2,2) 2×2 CuArray{Floa…

---

## [Request for testing: CUDA from BinaryBuilder](https://discourse.julialang.org/t/request-for-testing-cuda-from-binarybuilder/34856)

<div class="topic-metadata">

**Author:** [@maleadt](https://discourse.julialang.org/u/maleadt)\
**Replies:** 19\
**Last updated:** [February 27, 2020, 4:21pm UTC](https://discourse.julialang.org/t/request-for-testing-cuda-from-binarybuilder/34856 "2020-02-27T16:21:55Z")

</div>

Hi all, We are looking into using BinaryBuilder for installing CUDA when you use the Julia/CUDA stack, i.e. CuArrays or CUDAnative. The support for this has been merged to the master branches of the respective repositor…

---

## [CUDA verbose mode off](https://discourse.julialang.org/t/cuda-verbose-mode-off/34930)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 1\
**Last updated:** [February 20, 2020, 6:42pm UTC](https://discourse.julialang.org/t/cuda-verbose-mode-off/34930 "2020-02-20T18:42:02Z")

</div>

Hi folks, sometimes I find that my CUDA functions display this message ┌ Warning: Performing scalar operations on GPU arrays: This is very slow, consider disallowing these operations with \`allowscalar(false)\` └ @ GPUAr…

---

## [Error when trying to install Julia on Google Colaboratory](https://discourse.julialang.org/t/error-when-trying-to-install-julia-on-google-colaboratory/21624)

<div class="topic-metadata">

**Author:** [@askvorts](https://discourse.julialang.org/u/askvorts)\
**Replies:** 7\
**Last updated:** [February 20, 2020, 5:13pm UTC](https://discourse.julialang.org/t/error-when-trying-to-install-julia-on-google-colaboratory/21624 "2020-02-20T17:13:11Z")

</div>

I am trying to install Julia on Google Colaboratory and getting the following error Updating \`~/.julia/environments/v1.0/Project.toml\` \[3a865a2d\] + CuArrays v0.9.1 Updating \`~/.julia/environments/v1.0/Manifest.toml\`…

---

## [I am new to learning GPU, I do n’t know how to put it in GPU for the 4 loops here, I hope I can get help](https://discourse.julialang.org/t/i-am-new-to-learning-gpu-i-do-n-t-know-how-to-put-it-in-gpu-for-the-4-loops-here-i-hope-i-can-get-help/34904)

<div class="topic-metadata">

**Author:** [@11125](https://discourse.julialang.org/u/11125)\
**Replies:** 0\
**Last updated:** [February 20, 2020, 1:44pm UTC](https://discourse.julialang.org/t/i-am-new-to-learning-gpu-i-do-n-t-know-how-to-put-it-in-gpu-for-the-4-loops-here-i-hope-i-can-get-help/34904 "2020-02-20T13:44:58Z")

</div>

''' using CuArrays,CUDAnative,CUDAdrv,BenchmarkTools N = 3 M = 100 k = ones(N,N)\*5 the =range(0,pi/2,length=M) ph = range(0,2\*pi,length=M) theta = CuArrays.repeat(the,1,M)' phi = CuArrays.repeat(ph,1,M) aa = range(-5…

---

## [CuArrays: error calling CuArray() (ERROR\_INVALID\_DEVICE)](https://discourse.julialang.org/t/cuarrays-error-calling-cuarray-error-invalid-device/18654)

<div class="topic-metadata">

**Author:** [@samo](https://discourse.julialang.org/u/samo)\
**Replies:** 25\
**Last updated:** [February 16, 2020, 5:47pm UTC](https://discourse.julialang.org/t/cuarrays-error-calling-cuarray-error-invalid-device/18654 "2020-02-16T17:47:54Z")

</div>

Hi all, I am new to Julia and would like to try out CuArrays. However, I get the following error when following the basic example from the Julia doc: julia\> using CuArrays julia\> julia\> B = ones(10\_000) ./ 2; julia\> …

---

## [How to use parallel computing or GPU to make calculations fasterwhen the M=10000](https://discourse.julialang.org/t/how-to-use-parallel-computing-or-gpu-to-make-calculations-fasterwhen-the-m-10000/34623)

<div class="topic-metadata">

**Author:** [@11125](https://discourse.julialang.org/u/11125)\
**Replies:** 1\
**Last updated:** [February 14, 2020, 4:52pm UTC](https://discourse.julialang.org/t/how-to-use-parallel-computing-or-gpu-to-make-calculations-fasterwhen-the-m-10000/34623 "2020-02-14T16:52:03Z")

</div>

using CuArrays,CUDAnative,CUDAdrv,BenchmarkTools N = 3 k = ones(N,N)\*5 M = 100 rho = zeros(N,N) aa = range(-5,5,length=N) K = zeros(N,N) A = repeat(-aa’,N,1) B = repeat(aa,1,N) C=ones(N,N)-10 phi = repeat(range…

---

## [CUDAnative.jl failed to initialize](https://discourse.julialang.org/t/cudanative-jl-failed-to-initialize/34342)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 11\
**Last updated:** [February 10, 2020, 3:54pm UTC](https://discourse.julialang.org/t/cudanative-jl-failed-to-initialize/34342 "2020-02-10T15:54:51Z")

</div>

Hi, I’ve been using CUDAnative, CUDAdrv and CuArrays extensively in my ubuntu box for few months now, but somehow after an update of julia packages (which included these) I can no longer use them using CUDAnative \> \[ I…

---

## [Gradient of the einsum not working with CuArrays, when it's output is assigned to the field of a mutable struct](https://discourse.julialang.org/t/gradient-of-the-einsum-not-working-with-cuarrays-when-its-output-is-assigned-to-the-field-of-a-mutable-struct/34396)

<div class="topic-metadata">

**Author:** [@Azamat](https://discourse.julialang.org/u/Azamat)\
**Replies:** 0\
**Last updated:** [February 10, 2020, 3:00am UTC](https://discourse.julialang.org/t/gradient-of-the-einsum-not-working-with-cuarrays-when-its-output-is-assigned-to-the-field-of-a-mutable-struct/34396 "2020-02-10T03:00:46Z")

</div>

I’m getting a strange error when using OMEinsum, CuArrays and Zygote together. Here is the MRE: using CuArrays using Zygote using OMEinsum mutable struct S{T} c::T end function f(α, s, H) @ein s.c\[d,b\] := α\[t,b\]…

---

## [Improving cache behavior with ldg()](https://discourse.julialang.org/t/improving-cache-behavior-with-ldg/33628)

<div class="topic-metadata">

**Author:** [@Michael\_Benton](https://discourse.julialang.org/u/Michael_Benton)\
**Replies:** 6\
**Last updated:** [February 6, 2020, 11:56pm UTC](https://discourse.julialang.org/t/improving-cache-behavior-with-ldg/33628 "2020-02-06T23:56:02Z")

</div>

What exactly is meant by https://juliagpu.github.io/CUDAnative.jl/stable/lib/device/array.html that ldg “loads the value through the read-only texture cache for improved cache behavior” ? The following is a memory band…

---

## [Debugging in CUDAnative](https://discourse.julialang.org/t/debugging-in-cudanative/34193)

<div class="topic-metadata">

**Author:** [@Michael\_Benton](https://discourse.julialang.org/u/Michael_Benton)\
**Replies:** 1\
**Last updated:** [February 5, 2020, 7:01am UTC](https://discourse.julialang.org/t/debugging-in-cudanative/34193 "2020-02-05T07:01:51Z")

</div>

struggling to find the source of problems in some kernels I write due to I don’t know of a julia CUDA debugger, I’ve found some for C. I get: CUDA error: unspecified launch failure (code 719, ERROR\_LAUNCH\_FAILED) and …

---

## [CuArray can't find libcuda](https://discourse.julialang.org/t/cuarray-cant-find-libcuda/34175)

<div class="topic-metadata">

**Author:** [@cuchxq](https://discourse.julialang.org/u/cuchxq)\
**Replies:** 10\
**Last updated:** [February 5, 2020, 6:59am UTC](https://discourse.julialang.org/t/cuarray-cant-find-libcuda/34175 "2020-02-05T06:59:33Z")

</div>

I installed cuda10.2 on a ubuntu 18.10, and was able to build and run the some examples from the Cuda example folder, such as devicequery. But when I use Julia1.0.5LTS, and CuArray can’t find libcuda. and using JULIA\_D…

---

## [DifferentialEquations + RecursiveArrayTools Broadcasting / CuArrays Kernel compilation error --](https://discourse.julialang.org/t/differentialequations-recursivearraytools-broadcasting-cuarrays-kernel-compilation-error/34132)

<div class="topic-metadata">

**Author:** [@cmarcotte](https://discourse.julialang.org/u/cmarcotte)\
**Replies:** 6\
**Last updated:** [February 4, 2020, 2:53pm UTC](https://discourse.julialang.org/t/differentialequations-recursivearraytools-broadcasting-cuarrays-kernel-compilation-error/34132 "2020-02-04T14:53:03Z")

</div>

Hi, Finally have access to a CUDA capable GPU, so I’m trying to accelerate some finite-difference PDE solves using CuArrays and DifferentialEquations. I began with Chris’ simple reaction-diffusion demonstration here, a…

---

## [Initializing a grid with coordinates on the GPU](https://discourse.julialang.org/t/initializing-a-grid-with-coordinates-on-the-gpu/34107)

<div class="topic-metadata">

**Author:** [@stabbles](https://discourse.julialang.org/u/stabbles)\
**Replies:** 1\
**Last updated:** [February 3, 2020, 12:50pm UTC](https://discourse.julialang.org/t/initializing-a-grid-with-coordinates-on-the-gpu/34107 "2020-02-03T12:50:21Z")

</div>

I’m trying to build a tensor A of size 3 x ℓ x m x n where A\[:, i, j, k\] is a 3D coordinate at (i, j, k) in a uniform grid for \[0, 1\]^3. On the CPU this code looks like this: function mesh(n) r = range(0.0f0, 1.0f0, …

---

## [What does and does-not get computed on the GPU? (CuArrays)](https://discourse.julialang.org/t/what-does-and-does-not-get-computed-on-the-gpu-cuarrays/34042)

<div class="topic-metadata">

**Author:** [@jaynick](https://discourse.julialang.org/u/jaynick)\
**Replies:** 1\
**Last updated:** [January 31, 2020, 6:41pm UTC](https://discourse.julialang.org/t/what-does-and-does-not-get-computed-on-the-gpu-cuarrays/34042 "2020-01-31T18:41:26Z")

</div>

Is there a easy explanation or “rule of thumb” about which computations are run on the GPU? For example, if there is a matrix ‘W’ and array ‘a’, both on the gpu, I am sure that W\*a is computed on the GPU. But what abou…

---

## [Local thread memory in GPU using StaticArrays](https://discourse.julialang.org/t/local-thread-memory-in-gpu-using-staticarrays/33761)

<div class="topic-metadata">

**Author:** [@alvrg](https://discourse.julialang.org/u/alvrg)\
**Replies:** 4\
**Last updated:** [January 26, 2020, 11:25pm UTC](https://discourse.julialang.org/t/local-thread-memory-in-gpu-using-staticarrays/33761 "2020-01-26T23:25:20Z")

</div>

Hi all, I want to write a CUDA kernel that uses some local memory per thread. I read here and here that a possible way to do it is using StaticArrays, but I couldn’t find a MWE of this. The code I want to run is this, …

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

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