Diable GPU usage

6,333 views
Skip to first unread message

So

unread,
Feb 5, 2016, 7:25:08 PM2/5/16
to Discuss
I know you can use tf.device to select preferred device for specific operations. However, this may result in undesired memory overhead. Is there an easy way to disable GPU usage entirely for an script? Can we set any flag for this purpose similar to other DL libraries?

I want to NOT use GPU at all for an experiment altough I have it available in the machine.


Thanks.


josh11b

unread,
Feb 5, 2016, 9:23:37 PM2/5/16
to Discuss, bahram...@gmail.com
If you specify the device as /cpu:0, it won't use the GPU.  See


Josh

josh11b

unread,
Feb 5, 2016, 9:24:12 PM2/5/16
to Discuss
In the future, this sort of question is best asked on StackOverflow.

Josh

So

unread,
Feb 7, 2016, 3:58:52 PM2/7/16
to Discuss
Thanks for your reply. As I mentioned, I am aware of this option. There are at least two problems with this approach:

1- It is not convenient to specify this for each operation, specially if the program is large.

2- It seems the GPU still remains active. See here:

I have also noticed that even after using the flag, my GPU remains active.

Maybe this can be further improved in future releases. Theano,Caffe, Torch... are much more convenient in this regard for seemless switch between CPU and GPU.

Vijay Vasudevan

unread,
Feb 7, 2016, 4:05:04 PM2/7/16
to So, Discuss
1) Try setting the environment variable CUDA_VISIBLE_DEVICES=-1 

--
You received this message because you are subscribed to the Google Groups "Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss+u...@tensorflow.org.
To post to this group, send email to dis...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/discuss/1d8a37ed-6f86-4bd2-b174-ca10e4ef7cd9%40tensorflow.org.

bahram...@gmail.com

unread,
Feb 8, 2016, 2:24:10 PM2/8/16
to Discuss, v...@google.com

Thanks. The first instruction seems to not have any effect but the second one did the trick.
Here is what I did for reference:
config = tf.ConfigProto(
        device_count = {'GPU': 0}
    )
sess = tf.Session(config=config)
Reply all
Reply to author
Forward
0 new messages