Skip to main content
QUICK REVIEW

[论文解读] Comparative Analysis of CPU and GPU Profiling for Deep Learning Models

Dipesh Gyawali|arXiv (Cornell University)|Sep 5, 2023
Parallel Computing and Optimization Techniques被引用 6
一句话总结

本文使用 PyTorch 和 NVIDIA 工具对比了深度学习模型在 CPU 和 GPU 上的性能分析,结果表明 GPU 显著缩短了训练时间(20 个周期的训练时间从 CPU 的 13 小时缩短至 GPU 的 2 小时),同时保持了相似的测试准确率(98–99%)。该研究量化了不同小批量大小下时间、内存、功耗和温度的差异,揭示了在低小批量大小时 GPU 内存利用率不足,以及在数据加载期间 CPU 利用率较高的问题。

ABSTRACT

Deep Learning(DL) and Machine Learning(ML) applications are rapidly increasing in recent days. Massive amounts of data are being generated over the internet which can derive meaningful results by the use of ML and DL algorithms. Hardware resources and open-source libraries have made it easy to implement these algorithms. Tensorflow and Pytorch are one of the leading frameworks for implementing ML projects. By using those frameworks, we can trace the operations executed on both GPU and CPU to analyze the resource allocations and consumption. This paper presents the time and memory allocation of CPU and GPU while training deep neural networks using Pytorch. This paper analysis shows that GPU has a lower running time as compared to CPU for deep neural networks. For a simpler network, there are not many significant improvements in GPU over the CPU.

研究动机与目标

  • 分析和比较深度学习模型训练期间 CPU 和 GPU 的资源利用率。
  • 利用性能分析工具识别训练工作流中的性能瓶颈。
  • 评估超参数(如小批量大小)对时间、内存和功耗消耗的影响。
  • 为在 CPU 和 GPU 上优化深度神经网络训练提供可操作的见解。

提出的方法

  • 在配备两块 NVIDIA A6000 GPU 和多核 CPU 的系统上,使用 PyTorch 训练了一个猫狗分类器。
  • 使用 PyTorch Profiler 和 TensorBoard 记录每个训练步骤中各操作的时间和内存使用情况。
  • 使用 NVIDIA 系统命令和性能分析工具监控 GPU 和 CPU 的利用率、内存分配、温度和功耗。
  • 执行了小批量大小为 64 和 128 的实验,以评估可扩展性和资源消耗的差异。
  • 测量推理吞吐量和训练时间,以跨指标比较 CPU 和 GPU 的性能。
  • 通过按操作符的性能分析可视化执行过程,识别出数据传输到 GPU 等耗时操作。
Figure 1: CPU and GPU
Figure 1: CPU and GPU

实验结果

研究问题

  • RQ1在深度神经网络训练过程中,GPU 利用率与 CPU 利用率如何比较?
  • RQ2小批量大小对 GPU 和 CPU 内存消耗和利用率有何影响?
  • RQ3在模型训练期间,CPU 和 GPU 的功耗和温度如何变化?
  • RQ4对于同一深度学习模型,CPU 和 GPU 的训练时间有何差异?
  • RQ5CPU 和 GPU 部署下的推理吞吐量有何不同?

主要发现

  • 在 CPU 上训练相同模型,20 个周期耗时约 13 小时,而使用 GPU 训练仅用时 2 小时(小批量大小为 64)。
  • 当小批量大小为 64 时,GPU 利用率最高达到 50%,当小批量大小为 128 时提升至 70%,表明在更高小批量大小下具有更好的可扩展性。
  • CPU 内存使用量保持恒定在 32 GB(总容量 512 GB),与小批量大小无关;而 GPU:0 的内存使用量随小批量大小增加,从约 3.4 GB 上升至约 5 GB。
  • 当小批量大小为 128 时,GPU:0 的温度达到峰值 69°C,而 CPU 温度在所有配置下均保持在 60–70°C 之间。
  • GPU:0 的功耗达到 152W(最大 300W),而 GPU:1 仅消耗 23W,表明 GPU 间负载分配不均。
  • CPU 上的推理时间为每张图像 5 秒,而 GPU 上为 2–3 秒,表明 GPU 在推理方面具有显著的吞吐量优势。
Figure 2: NVIDIA A6000 specification
Figure 2: NVIDIA A6000 specification

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。