Running Oceananigans on Different GPUs #3786
-
I have a machine that has two GPUs on it and I was wondering if it would be possible to write code where I can run an Oceananigans model on one GPU and run another model on the other GPU on a different instance of Julia? Any help or tips on how to do this would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @RicksterB57 I think you're looking for the For example, if you run Julia with This isn't just Julia-specific and you can find more info on: https://stackoverflow.com/questions/39649102/how-do-i-select-which-gpu-to-run-a-job-on You can also control which GPU is being used inside Julia with the |
Beta Was this translation helpful? Give feedback.
Hi @RicksterB57 I think you're looking for the
CUDA_VISIBLE_DEVICES
environment variable.For example, if you run Julia with
CUDA_VISIBLE_DEVICES=0 julia
then CUDA.jl will only see and use GPU 0. You can see which GPU got assigned which number with thenvidia-smi
command.This isn't just Julia-specific and you can find more info on: https://stackoverflow.com/questions/39649102/how-do-i-select-which-gpu-to-run-a-job-on
You can also control which GPU is being used inside Julia with the
device!
function. See: https://cuda.juliagpu.org/stable/usage/multigpu/