I want to compare processing time of my code with and without gpu. My backend of keras is Tensorflow. So it uses a GPU automatically. I use a model of keras/examples/mnist_mlp.py
for comparing.
I checked the processing time like below. Then, how do I disable my GPU? Should ~/.keras/keras.json
be modified?
$ time python mnist_mlp.py
Test loss: 0.109761892007
Test accuracy: 0.9832
python mnist_mlp.py 38.22s user 3.18s system 162% cpu 25.543 total
$ CUDA_VISIBLE_DEVICES=-1 time python mnist_mlp.py
seems to be a) either the new way, or b) a way that works on both Windows and Linux.
Have you tried something like this? :
$ CUDA_VISIBLE_DEVICES='' time python mnist_mlp.py
CUDA_VISIBLE_DEVICES
is usually used to hide some GPU's to cuda. Here you hide them all as you don't put any visible device.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With