keras or tensorflow call GPU error: Blas GEMM launch failed

I had to call back-end training time tf with keras, frequent memory allocation errors. Insurance is to manually specify the memory allocation.

import tensorflow as tf
from keras.backend.tensorflow_backend import set_session
config = tf.ConfigProto()
config.gpu_options.allocator_type = 'BFC' #A "Best-fit with coalescing" algorithm, simplified from a version of dlmalloc.
config.gpu_options.per_process_gpu_memory_fraction = 0.3
config.gpu_options.allow_growth = True
set_session(tf.Session(config=config))

原文:https://blog.csdn.net/leo_xu06/article/details/82023330

Guess you like

Origin www.cnblogs.com/yjybupt/p/10971965.html