# GPU

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

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

**Page:** 30

---

## [How to use multiple GPUs correctly?](https://discourse.julialang.org/t/how-to-use-multiple-gpus-correctly/29986)

<div class="topic-metadata">

**Author:** [@ww1g11](https://discourse.julialang.org/u/ww1g11)\
**Replies:** 2\
**Last updated:** [October 16, 2019, 3:12pm UTC](https://discourse.julialang.org/t/how-to-use-multiple-gpus-correctly/29986 "2019-10-16T15:12:42Z")

</div>

Hi all, I am trying to change my GPU code to use multiple GPUs due to the memory limit of a single GPU. I found an example (Multiple-GPU Parallelism on the HPC with Julia | juliabloggers.com) and the basic idea is sp…

---

## [Kernel Error: kernel returns a value of type \`Union{}\`](https://discourse.julialang.org/t/kernel-error-kernel-returns-a-value-of-type-union/29885)

<div class="topic-metadata">

**Author:** [@ennvvy](https://discourse.julialang.org/u/ennvvy)\
**Replies:** 3\
**Last updated:** [October 14, 2019, 6:52am UTC](https://discourse.julialang.org/t/kernel-error-kernel-returns-a-value-of-type-union/29885 "2019-10-14T06:52:37Z")

</div>

I am trying to port my Julia code to be able to run with GPU support. I use LightGraphs package. My code and error message are as follows: cmin=0.5;cmax=0.9;N=1000;P=500;od=125;Pr=0.5;sigma=10;Pi=1.0; mutable struct Pa…

---

## [CuArray allocation issue: How often is it a problem?](https://discourse.julialang.org/t/cuarray-allocation-issue-how-often-is-it-a-problem/27508)

<div class="topic-metadata">

**Author:** [@haberdashPI](https://discourse.julialang.org/u/haberdashPI)\
**Replies:** 5\
**Last updated:** [September 30, 2019, 2:40pm UTC](https://discourse.julialang.org/t/cuarray-allocation-issue-how-often-is-it-a-problem/27508 "2019-09-30T14:40:28Z")

</div>

Hi there, I’m thinking about making use of Flux and CuArrays for a new project. However, I was a little troubled to learn about this issue. It’s hard to a get a sense from that thread how often this is coming up as a pr…

---

## [Gillespie in parallel on the GPU with DiffEqGPU?](https://discourse.julialang.org/t/gillespie-in-parallel-on-the-gpu-with-diffeqgpu/29114)

<div class="topic-metadata">

**Author:** [@nilsbecker](https://discourse.julialang.org/u/nilsbecker)\
**Replies:** 1\
**Last updated:** [September 24, 2019, 2:44pm UTC](https://discourse.julialang.org/t/gillespie-in-parallel-on-the-gpu-with-diffeqgpu/29114 "2019-09-24T14:44:12Z")

</div>

DifferentialEquations is getting support for integrating ODE parameters ensembles on the GPU, in parallel. Another example for an ‘embarassingly parallel’ problem is stochastic simulation with multiple copies of random n…

---

## [Weak dependence on CUDA packages, 2019 version](https://discourse.julialang.org/t/weak-dependence-on-cuda-packages-2019-version/29033)

<div class="topic-metadata">

**Author:** [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Replies:** 3\
**Last updated:** [September 22, 2019, 2:11pm UTC](https://discourse.julialang.org/t/weak-dependence-on-cuda-packages-2019-version/29033 "2019-09-22T14:11:48Z")

</div>

What’s state of the art for writing code with weak dependence on CUDA, e.g. when you want to provide automatic speedup if GPU is available, but provide fallback for systems with only CPUs? I remember a lot of discussion …

---

## [\]test DiffEqGPU errors with " unsupported call to the Julia runtime"](https://discourse.julialang.org/t/test-diffeqgpu-errors-with-unsupported-call-to-the-julia-runtime/28893)

<div class="topic-metadata">

**Author:** [@nilsbecker](https://discourse.julialang.org/u/nilsbecker)\
**Replies:** 19\
**Last updated:** [September 20, 2019, 2:39pm UTC](https://discourse.julialang.org/t/test-diffeqgpu-errors-with-unsupported-call-to-the-julia-runtime/28893 "2019-09-20T14:39:11Z")

</div>

hi, i’m trying to experiment with ODE solving on GPUs but can’t seem to get the packages running properly. this is on a machine with CUDA 9.0 installed and 4 Tesla K80 GPUs. i can install DiffEqGPU but the test fails as…

---

## [Synchronizing Cuda kernels](https://discourse.julialang.org/t/synchronizing-cuda-kernels/28220)

<div class="topic-metadata">

**Author:** [@wiktorkujawa](https://discourse.julialang.org/u/wiktorkujawa)\
**Replies:** 5\
**Last updated:** [September 20, 2019, 5:49am UTC](https://discourse.julialang.org/t/synchronizing-cuda-kernels/28220 "2019-09-20T05:49:45Z")

</div>

I have two cuda functions in my code: @cuda blocks=3 threads=numberofsegments+1 divideLine(Segment,numberofsegments+1,SegmentsCalculated) @cuda blocks=lenX,lenY,lenZ threads=numberofsegments,2,1 biotGPU(x,y,z,SegmentsCa…

---

## [CuArray is Row Major or Column Major?](https://discourse.julialang.org/t/cuarray-is-row-major-or-column-major/7402)

<div class="topic-metadata">

**Author:** [@drjoke](https://discourse.julialang.org/u/drjoke)\
**Replies:** 1\
**Last updated:** [November 30, 2017, 7:49am UTC](https://discourse.julialang.org/t/cuarray-is-row-major-or-column-major/7402 "2017-11-30T07:49:41Z")

</div>

And does it really matter for the GPU? I read it matters if the architecture supports SIMD. I am not sure if GPU supports SIMD.

---

## [CUDAnative: examples using CUDA streams?](https://discourse.julialang.org/t/cudanative-examples-using-cuda-streams/24702)

<div class="topic-metadata">

**Author:** [@samo](https://discourse.julialang.org/u/samo)\
**Replies:** 8\
**Last updated:** [September 19, 2019, 1:06pm UTC](https://discourse.julialang.org/t/cudanative-examples-using-cuda-streams/24702 "2019-09-19T13:06:24Z")

</div>

From this topic we can see that CUDA streams are supported. Are there any code examples using CUDA streams in CUDAnative to help with first steps? I.e. how to create a stream, use it in a kernel call, sync on the stream…

---

## [Problem with GPU programming](https://discourse.julialang.org/t/problem-with-gpu-programming/28704)

<div class="topic-metadata">

**Author:** [@sergevic](https://discourse.julialang.org/u/sergevic)\
**Replies:** 4\
**Last updated:** [September 13, 2019, 4:09pm UTC](https://discourse.julialang.org/t/problem-with-gpu-programming/28704 "2019-09-13T16:09:20Z")

</div>

I have the following code that I can run on Julia v.1.1: using LinearAlgebra L=Symmetric(rand(Float32,10000,10000)) C=zeros(Float32,size(L,1),size(L,2)) D=zeros(Float32,size(L,1),size(L,2)) D\[1,1\]=1 k=750 function Lap…

---

## [ERROR: InvalidIRError: compiling reduce\_kernel with \`eigen\` command](https://discourse.julialang.org/t/error-invalidirerror-compiling-reduce-kernel-with-eigen-command/28307)

<div class="topic-metadata">

**Author:** [@sergevic](https://discourse.julialang.org/u/sergevic)\
**Replies:** 4\
**Last updated:** [September 3, 2019, 12:31am UTC](https://discourse.julialang.org/t/error-invalidirerror-compiling-reduce-kernel-with-eigen-command/28307 "2019-09-03T00:31:34Z")

</div>

I’m trying to convert my Julia code with CUDA programming, because I get a OutOfMemory() error when I run the original code on Julia v.1.2. My converted code starts with the following lines: using CuArrays using Dista…

---

## [ERROR: Package CuArrays errored during testing](https://discourse.julialang.org/t/error-package-cuarrays-errored-during-testing/28006)

<div class="topic-metadata">

**Author:** [@sergevic](https://discourse.julialang.org/u/sergevic)\
**Replies:** 2\
**Last updated:** [August 27, 2019, 4:31pm UTC](https://discourse.julialang.org/t/error-package-cuarrays-errored-during-testing/28006 "2019-08-27T16:31:59Z")

</div>

I followed all the steps in https://juliagpu.gitlab.io/CuArrays.jl/tutorials/generated/intro/ to install Cuda for using it in Julia v. 1.1. I also installed the CUDA Toolkit v. 10.1. After the installation, I run test Cu…

---

## [Precompiling CUDAnative on login node (works on compute node)](https://discourse.julialang.org/t/precompiling-cudanative-on-login-node-works-on-compute-node/27886)

<div class="topic-metadata">

**Author:** [@samo](https://discourse.julialang.org/u/samo)\
**Replies:** 6\
**Last updated:** [August 23, 2019, 4:07pm UTC](https://discourse.julialang.org/t/precompiling-cudanative-on-login-node-works-on-compute-node/27886 "2019-08-23T16:07:50Z")

</div>

This is a follow up of this post about building CUDAnative on login node. Building CUDAnative on the login nodes works with the master version. Now, unfortunately, comes up the next problem: how can we precompile CUDAnat…

---

## [Cannot build CUDAnative on login node (works on compute node)](https://discourse.julialang.org/t/cannot-build-cudanative-on-login-node-works-on-compute-node/27860)

<div class="topic-metadata">

**Author:** [@samo](https://discourse.julialang.org/u/samo)\
**Replies:** 3\
**Last updated:** [August 23, 2019, 10:34am UTC](https://discourse.julialang.org/t/cannot-build-cudanative-on-login-node-works-on-compute-node/27860 "2019-08-23T10:34:23Z")

</div>

Context I am preparing a site-wide installation of Julia with the CUDA packages (CUDAdrv, CUDAnative and CuArrays) on our GPU supercomputer. To this purpose, I am creating automated installation recipes as for all our so…

---

## [Discussion: SPIR-V analog to CUDAnative?](https://discourse.julialang.org/t/discussion-spir-v-analog-to-cudanative/27427)

<div class="topic-metadata">

**Author:** [@wsphillips](https://discourse.julialang.org/u/wsphillips)\
**Replies:** 6\
**Last updated:** [August 13, 2019, 5:20pm UTC](https://discourse.julialang.org/t/discussion-spir-v-analog-to-cudanative/27427 "2019-08-13T17:20:13Z")

</div>

Almost certainly this has been thought of, but surprisingly I haven’t been able to find any mention of it on discourse and not really any repos…(although I noticed VulkanCore is perhaps waking up :smiley: ) Has there be…

---

## [Writing stencils for CuArray](https://discourse.julialang.org/t/writing-stencils-for-cuarray/26562)

<div class="topic-metadata">

**Author:** [@platawiec](https://discourse.julialang.org/u/platawiec)\
**Replies:** 6\
**Last updated:** [July 31, 2019, 3:19pm UTC](https://discourse.julialang.org/t/writing-stencils-for-cuarray/26562 "2019-07-31T15:19:54Z")

</div>

I am adapting a PDE solver to work on GPU. Being lazy, I was hoping that something like using CuArrays A = rand(5, 5, 5) |\> CuArray{Float64} B = similar(A) Is = CartesianIndices((2:4, 2:4)) @views @. B\[Is.indices..., :…

---

## [Problem building CUDAnative](https://discourse.julialang.org/t/problem-building-cudanative/26540)

<div class="topic-metadata">

**Author:** [@vargonis](https://discourse.julialang.org/u/vargonis)\
**Replies:** 2\
**Last updated:** [July 26, 2019, 7:29am UTC](https://discourse.julialang.org/t/problem-building-cudanative/26540 "2019-07-26T07:29:41Z")

</div>

Hi there. I’m trying to setup Julia to use CuArrays. I have Julia 1.0.4 and the cuda toolkit 10.1, on Pop!\_OS. I’m doing (on the REPL) ENV\["LD\_LIBRARY\_PATH"\] = "/usr/lib/cuda/lib64" ENV\["CUDA\_PATH"\] = "/usr/lib/cuda" u…

---

## [Dask and Dask-cuDF Julia alternative?](https://discourse.julialang.org/t/dask-and-dask-cudf-julia-alternative/26446)

<div class="topic-metadata">

**Author:** [@ldsands](https://discourse.julialang.org/u/ldsands)\
**Replies:** 8\
**Last updated:** [July 18, 2019, 3:03pm UTC](https://discourse.julialang.org/t/dask-and-dask-cudf-julia-alternative/26446 "2019-07-18T15:03:04Z")

</div>

Hello everyone, TLDR: looking for information on Julia’s Dask and Dask-cuDF alternatives I’m having to analyze some data for my social science degree and it is very large. I’m using python, pandas and dask to parrellel…

---

## [CuArrays/CUDAnative/CUDAdrv equivalent to cudaMemcpy3DAsync?](https://discourse.julialang.org/t/cuarrays-cudanative-cudadrv-equivalent-to-cudamemcpy3dasync/26182)

<div class="topic-metadata">

**Author:** [@samo](https://discourse.julialang.org/u/samo)\
**Replies:** 10\
**Last updated:** [July 15, 2019, 9:52am UTC](https://discourse.julialang.org/t/cuarrays-cudanative-cudadrv-equivalent-to-cudamemcpy3dasync/26182 "2019-07-15T09:52:59Z")

</div>

What is the CuArrays/CUDAnative/CUDAdrv equivalent to cudaMemcpy3DAsync? More precisely, I am looking for how to do the equivalent of the following CUDA C code, which copies a XZ-plane of a 3-D device array to a contigu…

---

## [How to create cuda streams with different priorities?](https://discourse.julialang.org/t/how-to-create-cuda-streams-with-different-priorities/25791)

<div class="topic-metadata">

**Author:** [@samo](https://discourse.julialang.org/u/samo)\
**Replies:** 11\
**Last updated:** [July 15, 2019, 9:46am UTC](https://discourse.julialang.org/t/how-to-create-cuda-streams-with-different-priorities/25791 "2019-07-15T09:46:34Z")

</div>

Question How can we create (nonblocking) cuda streams with different priorities? That is, how can we do with CuArrays/CUDAnative/CUDAdrv the equivivalent to the following lines of CUDA code? cudaStream\_t streams\[2\]; in…

---

## [CUDAnative: simple and nice way to define type for all integer/float literals?; size() returning UInt32?](https://discourse.julialang.org/t/cudanative-simple-and-nice-way-to-define-type-for-all-integer-float-literals-size-returning-uint32/26227)

<div class="topic-metadata">

**Author:** [@samo](https://discourse.julialang.org/u/samo)\
**Replies:** 5\
**Last updated:** [July 12, 2019, 10:37am UTC](https://discourse.julialang.org/t/cudanative-simple-and-nice-way-to-define-type-for-all-integer-float-literals-size-returning-uint32/26227 "2019-07-12T10:37:15Z")

</div>

The following code is the computation kernel of a small heat diffusion application in 3-D: function diffusion3D\_kernel!(Te2, Te, Ci, lam, dt, dx, dy, dz) \_dx = 1.0/dx; # \_dx could obviously be passed as argument ins…

---

## [Thousands of matrix multiplications using CuArray](https://discourse.julialang.org/t/thousands-of-matrix-multiplications-using-cuarray/26222)

<div class="topic-metadata">

**Author:** [@joseph\_bouvard](https://discourse.julialang.org/u/joseph_bouvard)\
**Replies:** 5\
**Last updated:** [July 11, 2019, 2:49pm UTC](https://discourse.julialang.org/t/thousands-of-matrix-multiplications-using-cuarray/26222 "2019-07-11T14:49:02Z")

</div>

Using CuArray.jl it was possible to improve the following code at about 7x when compare to the analogue computation executed on host. However, it is still disappointing for my purposes (53.122 s running on a Tesla K40c w…

---

## [Using vectors of vectors with CuArrays](https://discourse.julialang.org/t/using-vectors-of-vectors-with-cuarrays/25042)

<div class="topic-metadata">

**Author:** [@tanhevg](https://discourse.julialang.org/u/tanhevg)\
**Replies:** 2\
**Last updated:** [July 9, 2019, 8:43am UTC](https://discourse.julialang.org/t/using-vectors-of-vectors-with-cuarrays/25042 "2019-07-09T08:43:34Z")

</div>

Hello, I am trying to get the blstm example from Flux model zoo to work on GPU. The latest hurdle that I ran into is trying to convert the training data to GPU arrays. The example uses arrays of arrays to store the data…

---

## [Shared library errors when using optirun](https://discourse.julialang.org/t/shared-library-errors-when-using-optirun/17309)

<div class="topic-metadata">

**Author:** [@galenlynch](https://discourse.julialang.org/u/galenlynch)\
**Replies:** 4\
**Last updated:** [July 2, 2019, 8:40pm UTC](https://discourse.julialang.org/t/shared-library-errors-when-using-optirun/17309 "2019-07-02T20:40:08Z")

</div>

I’m just trying Julia’s CUDA packages for the first time, and am having problems launching Julia with optirun. I’m hoping that there are other people out there trying to run Julia with optirun, and that they may have fig…

---

## [Maintaining Julia native GPU codegen vs relying on MLIR](https://discourse.julialang.org/t/maintaining-julia-native-gpu-codegen-vs-relying-on-mlir/25615)

<div class="topic-metadata">

**Author:** [@datnamer](https://discourse.julialang.org/u/datnamer)\
**Replies:** 5\
**Last updated:** [July 2, 2019, 7:38pm UTC](https://discourse.julialang.org/t/maintaining-julia-native-gpu-codegen-vs-relying-on-mlir/25615 "2019-07-02T19:38:29Z")

</div>

Apparently swift will be getting GPU kernel generation capability through MLIR. As far as I understand it, Julia relies already on LLVM to generate Cuda code. What are the costs and benefits of maintaining an extra laye…

---

## [CUDA streams do not overlap](https://discourse.julialang.org/t/cuda-streams-do-not-overlap/24879)

<div class="topic-metadata">

**Author:** [@samo](https://discourse.julialang.org/u/samo)\
**Replies:** 6\
**Last updated:** [July 1, 2019, 10:12am UTC](https://discourse.julialang.org/t/cuda-streams-do-not-overlap/24879 "2019-07-01T10:12:57Z")

</div>

I have troubles to make streams overlap. So, I created the following simple example, where the streams s1 and s2 should overlap; yet they don’t: using CUDAdrv, CUDAnative, CuArrays function memcopy!(A, B) ix = (blo…

---

## [Select a device for the entire program](https://discourse.julialang.org/t/select-a-device-for-the-entire-program/25603)

<div class="topic-metadata">

**Author:** [@samo](https://discourse.julialang.org/u/samo)\
**Replies:** 3\
**Last updated:** [June 24, 2019, 4:22pm UTC](https://discourse.julialang.org/t/select-a-device-for-the-entire-program/25603 "2019-06-24T16:22:20Z")

</div>

Question: To my understanding, CuArrays/CUDAnative/CUDAdrv selects the device 0 by default. How can I select a different device at the beginning of my program, that will be used in the rest of the program for any GPU op…

---

## [Mapslices causes an error with Flux and GPU arrays](https://discourse.julialang.org/t/mapslices-causes-an-error-with-flux-and-gpu-arrays/25448)

<div class="topic-metadata">

**Author:** [@tanhevg](https://discourse.julialang.org/u/tanhevg)\
**Replies:** 2\
**Last updated:** [June 19, 2019, 3:46pm UTC](https://discourse.julialang.org/t/mapslices-causes-an-error-with-flux-and-gpu-arrays/25448 "2019-06-19T15:46:49Z")

</div>

I wonder, if this is a known issue. Quick Google search has not revealed anything. using CuArrays, Flux f(x) = sum(mapslices(t-\>sqrt(sum(t.\*t)), x, dims=2)) df(x) = Tracker.gradient(f, x) x = rand(10, 10) |\> gpu df(x) E…

---

## [CUDA: MVectors always allocate memory and cause "Out of Memory Error"](https://discourse.julialang.org/t/cuda-mvectors-always-allocate-memory-and-cause-out-of-memory-error/25239)

<div class="topic-metadata">

**Author:** [@11116](https://discourse.julialang.org/u/11116)\
**Replies:** 2\
**Last updated:** [June 14, 2019, 1:51am UTC](https://discourse.julialang.org/t/cuda-mvectors-always-allocate-memory-and-cause-out-of-memory-error/25239 "2019-06-14T01:51:33Z")

</div>

try this simple code: using CUDAnative using CUDAdrv using CuArrays function kernel(i,arr) for i in 1:i a = MVector{3,Float32}(undef) arr\[i\] = a\[1\]+1.0f0 end end N1 = 1 N2 = 10000 arr1 = CuArray(Array{Float32,1}(u…

---

## [Are there any obvious problems/code smells with this GPU code?](https://discourse.julialang.org/t/are-there-any-obvious-problems-code-smells-with-this-gpu-code/25160)

<div class="topic-metadata">

**Author:** [@currymj](https://discourse.julialang.org/u/currymj)\
**Replies:** 2\
**Last updated:** [June 12, 2019, 12:27am UTC](https://discourse.julialang.org/t/are-there-any-obvious-problems-code-smells-with-this-gpu-code/25160 "2019-06-12T00:27:43Z")

</div>

I am working on a small package to implement the Sinkhorn algorithm for optimal transport. Since this is frequently used as a loss function for generative models, my goal is to have an implementation that is generic eno…

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

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