2

I have two models (theano scripts) I want to train and evaluate.
I have two GPUs I can use to train them.

How can I run a model on each GPU at the same time?

1 Answers1

1

When running your script you can choose where your progam will run with THEANO_FLAGS:

THEANO_FLAGS='device=gpu0' python script_1.py
THEANO_FLAGS='device=gpu1' python script_2.py

change gpuX for each gpu (eg. gpu0,gpu1,gpu2...)

maz
  • 1,980
  • 14
  • 17
  • So this will run everything in parallel? (I'm new to this) – Purushothaman Srikanth Feb 05 '21 at 08:06
  • 1
    It depends by what you mean by running in parallel. If like circuitdesigner5172 you have two separate models to run with two separate gpus then yes, everything will run in parallel. But the script about will not run a single model with two gpus. In any case, do not use theano (or theano flags) as of 2022. I'd rather use the nvidia flags with more recent frameworks (pytorch/tensorflow) CUDA_VISIBLE_DEVICES=0 python script_1.py and CUDA_VISIBLE_DEVICES=1 python script_2.py in a different terminal – maz Jan 23 '22 at 00:42