【问题标题】:(tensorflow) Am I using two gpus in parallel correctly?(tensorflow)我是否正确使用了两个GPU?
【发布时间】:2018-09-15 16:07:08
【问题描述】:

(如果这个问题太新手,我很抱歉,但由于我不太了解并想仔细检查我是否以正确的方式并行使用两个 GPU,所以我问你以下问题。)

我正在使用的电脑中安装了两个 gpus(具有相同型号)。在一个pycharm项目中,我运行一个tensorflow代码设置

os.environ["CUDA_VISIBLE_DEVICES"] = '0'

,然后使用初始运行日志运行

Using TensorFlow backend.
2018-09-15 03:36:36.727152: I T:\src\github\tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2018-09-15 03:36:37.080157: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1405] Found device 0 with properties: 
name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.6705
pciBusID: 0000:17:00.0
totalMemory: 11.00GiB freeMemory: 9.08GiB
2018-09-15 03:36:37.080671: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1484] Adding visible gpu devices: 0
2018-09-15 03:36:37.796088: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:965] Device interconnect StreamExecutor with strength 1 edge matrix:
2018-09-15 03:36:37.796320: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:971]      0 
2018-09-15 03:36:37.796469: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:984] 0:   N 
2018-09-15 03:36:37.796723: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 8783 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:17:00.0, compute capability: 6.1)

然后在另一个pycharm项目中,我运行一个tensorflow代码设置

os.environ["CUDA_VISIBLE_DEVICES"] = '1'

然后显示在运行日志中

Using TensorFlow backend.
2018-09-15 03:37:00.119630: I T:\src\github\tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2018-09-15 03:37:00.468546: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1405] Found device 0 with properties: 
name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.6705
pciBusID: 0000:65:00.0
totalMemory: 11.00GiB freeMemory: 9.08GiB
2018-09-15 03:37:00.468930: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1484] Adding visible gpu devices: 0
2018-09-15 03:37:01.199726: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:965] Device interconnect StreamExecutor with strength 1 edge matrix:
2018-09-15 03:37:01.199950: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:971]      0 
2018-09-15 03:37:01.200096: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:984] 0:   N 
2018-09-15 03:37:01.200349: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 8783 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:65:00.0, compute capability: 6.1)

让我担心的是他们都有 设备 0。但它们的 pciBusID 是不同的。

所以我的简单问题是我是否以正确的方式并行使用两个 GPU?

在使用 Windows 10 时,我使用设备管理器监控了 gpu 的使用情况,这对我来说似乎是正确的。但我只是想听听专家的意见。

如果您可以回答,那么 pci 总线 ID 大致是什么?为什么他们都显示设备0?

【问题讨论】:

    标签: tensorflow gpu


    【解决方案1】:

    不,你必须添加

    with tf.device("your_device_name")
    

    只需按照本教程的使用多个 GPU 部分https://www.tensorflow.org/guide/using_gpu

    【讨论】:

      猜你喜欢
      • 2019-01-17
      • 1970-01-01
      • 2017-10-28
      • 1970-01-01
      • 2011-07-14
      • 2014-07-19
      • 2017-06-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多