- 1.确认tensorflow是否与cuda,cudnn对应,在这里查看
- 2.修改设置
os.environ['CUDA_VISIBLE_DEVICES']='0,1'
# tf 1.13
config = tf.ConfigProto()
config.gpu_options.allow_growth=True
sess = tf.Session(config=config)
sess.run(tf.global_variables_initializer())
# tf 2.0
# gpu = tf.config.experimental.list_physical_devices('GPU')
# tf.config.experimental.set_memory_growth(gpu[0], True)
# gpu = tf.config.experimental.list_physical_devices('GPU')
# tf.config.experimental.set_memory_growth(gpu[1], True)

本文介绍了如何检查TensorFlow与CUDA、cuDNN的对应关系,并提供了在TensorFlow 1.x和2.x中设置GPU可见性和管理GPU内存的方法,确保高效利用GPU资源进行深度学习计算。
2918

被折叠的 条评论
为什么被折叠?



