I am a pretty new user of Keras. Recently I have started using it to train quite simple neural networks. I installed Keras, tensorflow-GPU, CUDA and CUDNN. Here is the code I am running :
num_epochs=500 all_mae_histories =  for i in range(k): print('procesing fold #',i) val_data=train_data[i*num_val_samples:(i+1)*num_val_samples] val_targets=train_targets[i*num_val_samples: (i+1)*num_val_samples] partial_train_data = np.concatenate( [train_data[:i*num_val_samples], train_data[(i+1)*num_val_samples:]], axis=0) partial_train_targets = np.concatenate( [train_targets[:i*num_val_samples], train_targets[(i+1)*num_val_samples:]], axis=0) model = build_model() history= model.fit(partial_train_data, partial_train_targets, epochs=num_epochs, batch_size=1,verbose=0) mae_history = history.history['mean_absolute_error'] all_mae_histories.append(mae_history) average_mae_history=[np.mean([x[i] for x in all_mae_histories]) for i in range(num_epochs)]
basically, it is performing k-fold validation with 500 epochs and tracking the performance of the NN as a function of the epoch. Executing this code is quite long even though I have a NVIDIA 1060 graphic card. So I checked the load on the grapic card and it turned out that the code is using only 10% of the GPU and 50 % of each of my 8 CPU.
So my question is : how can I get Keras use the GPU rather than the CPU ? Would this lead to a faster execution ?