查看显卡使用情况:

nvidia-smi

设置tensorflow按需分配资源:

import os

os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"

os.environ["CUDA_VISIBLE_DEVICES"] = "1" # 使用第二块GPU(从0开始)

gpu_options = tf.GPUOptions(allow_growth=True)

sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options)) 

相关文章:

  • 2021-09-19
  • 2021-07-30
  • 2021-07-20
  • 2021-06-12
  • 2022-01-12
  • 2021-11-25
  • 2021-08-25
  • 2022-01-02
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-03
  • 2021-07-23
  • 2022-12-23
相关资源
相似解决方案