My script fails always on
session = tf.Session(config=config) with this error
terminate called after throwing an instance of 'std::system_error' what(): Resource temporarily unavailable Neúspěšně ukončen (SIGABRT)
import os
import subprocess
import tensorflow as tf
def setGPU():
free_gpu = subprocess.check_output(
'nvidia-smi -q | grep "Minor\|Processes" | grep "None" -B1 | tr -d " " | cut -d ":" -f2 | sed -n "1p"', shell=True)
if len(free_gpu) == 0:
print ('No free GPU available!')
sys.exit(1)
os.environ['CUDA_VISIBLE_DEVICES'] = free_gpu.decode().strip()
print('I got GPU!')
return int(free_gpu.strip())
setGPU()
config = tf.ConfigProto()
config.gpu_options.per_process_gpu_memory_fraction = 0.5
session = tf.Session(config=config)
Did anybody encounter something similer - any advice?