小编Tom*_*oma的帖子

Tensorflow:多 GPU 训练比单 GPU 训练慢

我正在尝试使用 tf.distribute.MirroredStrategy() 使用 Tensorflow 2(nightly) 和 Keras 运行多 GPU 训练。

问题是,通过使用 2 倍大的总批量大小和 2 个 GPU (16),每个时期的训练时间会慢 3 倍。有人知道我在哪里可以找到问题吗?tf.distribute.MirroredStrategy 已经为我们完成了所有工作,并在单个 GPU 上快速进行模型训练。

它是单输入、2 输出模型。造成这种情况的更有可能的原因是什么。

以下是模型摘要:

Model: "Joined_Model_2"
__________________________________________________________________________________________________
Layer (type)                    Output Shape         Param #     Connected to                     
==================================================================================================
inp (InputLayer)                [(None, None, 257)]  0                                            
__________________________________________________________________________________________________
time_distributed_2 (TimeDistrib (None, None, 512)    131584      inp[0][0]                        
__________________________________________________________________________________________________
layer_normalization_1 (LayerNor (None, None, 512)    1024        time_distributed_2[0][0]         
__________________________________________________________________________________________________
re_lu_1 (ReLU)                  (None, None, 512)    0           layer_normalization_1[0][0]      
__________________________________________________________________________________________________
lstm_5 (LSTM)                   (None, 512)          2099200     re_lu_1[0][0]                    
__________________________________________________________________________________________________
add_5 (Add)                     (None, None, 512) …
Run Code Online (Sandbox Code Playgroud)

python multi-gpu keras tensorflow

5
推荐指数
0
解决办法
734
查看次数

标签 统计

keras ×1

multi-gpu ×1

python ×1

tensorflow ×1