import time import tensorflow as tf val = tf.test.is_gpu_available() f = open("gpu.txt", "a") ts = time.time() f.write("GPU is loaded {} at {}\n".format(val, ts)) f.close()