TensorFlow: Blas GEMM launch failed
This worked for me on TensorFlow 2.1.0 (per: https://www.tensorflow.org/api_docs/python/tf/config/experimental/set_memory_growth)
import tensorflow as tfphysical_devices = tf.config.list_physical_devices('GPU') for device in physical_devices: tf.config.experimental.set_memory_growth(device, True)
It's a simple fix, but it was a nightmare to figure it all out
On Windows I found the Keras install in Anaconda3\Lib\site-packages\keras
sources:
https://www.tensorflow.org/guide/using_gpu
https://github.com/keras-team/keras/blob/master/keras/backend/tensorflow_backend.py
Find the following in your keras/tensorflow_backend.py fileyou'll add config.gpu_options.allow_growth= True in both places
if _SESSION is None: if not os.environ.get('OMP_NUM_THREADS'): config = tf.ConfigProto(allow_soft_placement=True) config.gpu_options.allow_growth=True else: num_thread = int(os.environ.get('OMP_NUM_THREADS')) config = tf.ConfigProto(intra_op_parallelism_threads=num_thread, allow_soft_placement=True) config.gpu_options.allow_growth=True _SESSION = tf.Session(config=config) session = _SESSION
Make sure you have no other processes using the GPU running. Run nvidia-smi to check this.
SOURCE: An issue brought up by @reedwm.