[Solved] Failed to create cublas handle: CUBLAS_STATUS_ALLOC_FAILED

 

solution:

config = tf.ConfigProto()
config.gpu_options.allow_growth = True
session = tf.Session(config=config, ...)

there are also such (fixed allocation):

gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.333)
sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))

Remember to close other programs that use video memory!

Second:

When training, testing Tensorflow, Keras code, could not create cudnn handle: CUDNN_STATUS_NOT_INITIALIZED, error retrieving driver version: Unimplemented: kernel reported driver version not implemented on Windows, could not destroy cudnn handle: CUDNN_STATUS_BAD_PARAM, etc. . Just add the following code to it.

import tensorflow as tf
from keras import backend as K
config = tf.ConfigProto()
config.gpu_options.allow_growth=True
sess = tf.Session(config=config)
K.set_session(sess)

Similar Posts: