Keras: How to train with CPU if GPU is installed.

Created on 16 May 2018  路  1Comment  路  Source: rstudio/keras

Hey, so for some reason R crashes when I try to train an RNN (LSTM etc) on GPU, I know it works when training on CPU (from abck when I had no GPU). Is there a way to set the config such that keras is forced to train with CPU?

Most helpful comment

If you do the following you'll set CUDA cores to 0, hence disabling GPU indirectly:

# Disable GPU                                                                   
Sys.setenv("CUDA_VISIBLE_DEVICES" = -1)   

# Then load keras
library(keras)                                                                  
use_backend("tensorflow") 

Check this for further info: https://www.tensorflow.org/programmers_guide/using_gpu

I hope it helps

>All comments

If you do the following you'll set CUDA cores to 0, hence disabling GPU indirectly:

# Disable GPU                                                                   
Sys.setenv("CUDA_VISIBLE_DEVICES" = -1)   

# Then load keras
library(keras)                                                                  
use_backend("tensorflow") 

Check this for further info: https://www.tensorflow.org/programmers_guide/using_gpu

I hope it helps

Was this page helpful?
0 / 5 - 0 ratings

Related issues

faltinl picture faltinl  路  6Comments

LarsHill picture LarsHill  路  6Comments

systats picture systats  路  4Comments

qade544 picture qade544  路  5Comments

faltinl picture faltinl  路  4Comments