You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多
文档控制台
免费开始使用

为何多终端训练多深度学习模型比单模型更快?GPU性能状态解析

问题现象
  • 单终端运行单个训练模型时,速度较慢
  • 多终端同时运行多个训练脚本时,总训练时间缩短,且每个模型的训练速度比单独运行时更快

环境配置

  • GPU:NVIDIA RTX 4070
  • 框架:TensorFlow 2.10.1
  • 操作系统:Windows 11

每个终端对应独立Python进程,使用相同数据、随机种子训练相同模型,核心代码片段如下:

gpus = tf.config.list_physical_devices('GPU')
if gpus:
    for gpu in gpus:
        tf.config.experimental.set_memory_growth(gpu, True)

grid = GridSearchCV(estimator=model, param_grid=param_grid, n_jobs=1, cv=3)
start_time = time.time()
grid_result = grid.fit(X, Y)
end_time = time.time()

后续观察

训练单个模型时,nvidia-smi显示GPU性能状态为P8(低功耗/空闲模式);启动多终端训练进程后,性能状态提升至P4甚至P3,这是导致上述现象的原因。

内容的提问来源于stack exchange,提问作者Palantir

火山引擎 最新活动