tensorflow报错 'failed to create cublas handle', 'Failed to get convolution algorithm'
tensorflow gpu 报错:
1 | ... tensorflow/stream_executor/cuda/cuda_blas.cc:238] failed to create cublas handle: CUBLAS_STATUS_ALLOC_FAILED |
软件版本:
- python: 3.7.7
- keras: 2.3.1
- tensorboard: 2.1.0
- tensorflow: 2.1.0
显卡版本:
- gpu: RTX 2070
- cuda: 10.1
- cudnn: 7.8
解决办法:
- 参考tensorflow的 pull #34888 : “Failed to get convolution algorithm. This is probably because cuDNN failed to initialize”
- https://github.com/tensorflow/tensorflow/issues/34888
You may try limiting your gpu memory usage with set_memory_growth option.
See https://www.tensorflow.org/guide/gpu#limiting_gpu_memory_growth
Put the following snippet on top of your code and execute again
1
2
3 import tensorflow as tf
gpus= tf.config.experimental.list_physical_devices('GPU')
tf.config.experimental.set_memory_growth(gpus[0], True)