小编you*_*ong的帖子

tensorflow 多 GPU 并行使用

我想并行使用 8 gpus,而不是按顺序使用。

例如,当我执行这段代码时,

import tensorflow as tf

with tf.device('/gpu:0'):
    for i in range(10):
        print(i)

with tf.device('/gpu:1'):
    for i in range(10, 20):
        print(i)
Run Code Online (Sandbox Code Playgroud)

我试过 cmd 命令 'CUDA_VISIBLE_DEVICE='0,1' 但结果是一样的。

我想看到结果“0 10 1 11 2 3 12 ....等”

但实际结果依次为“0 1 2 3 4 5 ..... 10 11 12 13..”

我怎样才能得到想要的结果?

python multi-gpu tensorflow

5
推荐指数
1
解决办法
7428
查看次数

标签 统计

multi-gpu ×1

python ×1

tensorflow ×1