# Multiple GPUs with Julia

**URL:** https://discourse.julialang.org/t/multiple-gpus-with-julia/11248
**Category:** GPU
**Tags:** announcement
**Created:** [May 29, 2018, 7:13pm UTC](https://discourse.julialang.org/t/multiple-gpus-with-julia/11248 "2018-05-29T19:13:24Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![jbrea](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbrea/32/3879_2.png) [@jbrea](https://discourse.julialang.org/u/jbrea)
#### Post date: [May 29, 2018, 7:58pm UTC](https://discourse.julialang.org/t/multiple-gpus-with-julia/11248/2 "2018-05-29T19:58:43Z")

</div>

Yes, I use Flux with multiple GPUs. But my approach is not elegant.

In CUDAnative (commit f60c4754356225151c866da0ca512b434aa03abd) in src/CUDAnative.jl on line 75 I replaced `default_device[] = CuDevice(0)` with `dev = haskey(ENV, "CUDADEV") ? parse(ENV["CUDADEV"]) : 0; default_device[] = CuDevice(dev)`, after which I can (in bash) `export CUDADEV=1 && julia` to open a julia session with CUDAnative using GPU 1.

---

_[View the full topic](https://discourse.julialang.org/t/multiple-gpus-with-julia/11248)._
