I recently picked up a second 1080 used off craigslist and want to be able to run multiple experiments in parallel. To be specific, I’m not trying to run training on multiple GPU’s - I want to train different models on each GPU. I believe I have enough RAM (32gb) but I’m still running into resource exhausted issues with the tensorflow backend and I believe its because keras is trying to assign all the work to the default device (/gpu:0)
. I’ve done some digging but can’t seem to find a simple solution to setting the GPU to use for the whole session.
- I’ve seen the code from tensorflow
- And the description from Fchollet on how to set the device context for a layer
- And I even found some suggestions on using environmental variables.
But all of these seem to suggest I need to write my entire python script within a device context…
with tf.device('/gpu:1'): all the rest of my code...
- Is there a better way to set the device for the session?
- If not, how do I do this without importing tf and running into resource exhausted errors when tf tries to use the GPU that is already maxed out training something else?