tensorflow报错 failed to create cublas handle: CUBLAS_STATUS_NOT_INITIALIZED

跑代码的时候遇到了错误:

2018-12-09 20:44:36.548619: E tensorflow/stream_executor/cuda/cuda_blas.cc:366] failed to create cublas handle: CUBLAS_STATUS_NOT_INITIALIZED
2018-12-09 20:44:36.908817: E tensorflow/stream_executor/cuda/cuda_dnn.cc:385] could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR
2018-12-09 20:44:36.908910: E tensorflow/stream_executor/cuda/cuda_dnn.cc:352] could not destroy cudnn handle: CUDNN_STATUS_BAD_PARAM
2018-12-09 20:44:36.927944: F tensorflow/core/kernels/conv_ops.cc:667] Check failed: stream->parent()->GetConvolveAlgorithms( conv_parameters.ShouldIncludeWinogradNonfusedAlgo(), &algorithms) 

在github上找到了解决方案:

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

问题原因是在多个地方使用了gpu,设置分配最少量的内存并根据需要增长。还有另一种解决方式,设置百分比为0.7,但没有尝试:

config = tf.ConfigProto()
config.gpu_options.per_process_gpu_memory_fraction = 0.4 
session = tf.Session(config = config,...)

 

你可能感兴趣的:(tensorflow报错 failed to create cublas handle: CUBLAS_STATUS_NOT_INITIALIZED)