Tflearn: GPUs: How to set the specific GPU to run with?

Created on 17 Nov 2016  路  4Comments  路  Source: tflearn/tflearn

I have 4 GPU cards, and I want to run 4 different tasks on these 4 GPUs. What can I do to set which GPU
to be used? I tried tf.device('/gpu:x'), but it didn't work.

Most helpful comment

You have to run in your shell, for example to run on GPU-0 only:

export CUDA_VISIBLE_DEVICES='0'
python your_script.py

All 4 comments

You have to run in your shell, for example to run on GPU-0 only:

export CUDA_VISIBLE_DEVICES='0'
python your_script.py

Thanks. Although it makes use of the setting of CUDA, it works anyway.

Before using tf.device(), add the followings:

config = tf.ConfigProto()
config.allow_soft_placement = True
config.gpu_options.allow_growth = True
tf.add_to_collection('graph_config', config)

Hi, is it possible to add 'export CUDA_VISIBLE_DEVICES='0'' to some configure files of tensorflow?

In theano we have theanorc, but for tensforflow I don't find a configure file. Any suggestion would be appreciated.

Was this page helpful?
0 / 5 - 0 ratings