[论文解读] Efficient Memory Management for GPU-based Deep Learning Systems
本文提出了 SmartPool 和 AutoSwap——两种用于深度学习训练的透明、系统级 GPU 内存优化技术。SmartPool 通过基于生命周期感知的分配策略,利用启发式算法减少内存碎片,与 NVIDIA 的 CnMem 相比,内存使用量最高可降低 13.3%。AutoSwap 根据访问模式动态地在 GPU 和 CPU 内存之间移动不活跃变量,内存占用最高可减少 34.2%,且无通信开销。两种技术结合使用可在不损失精度或用户干预的情况下,跨多种模型和工作负载实现有效扩展。
GPU (graphics processing unit) has been used for many data-intensive applications. Among them, deep learning systems are one of the most important consumer systems for GPU nowadays. As deep learning applications impose deeper and larger models in order to achieve higher accuracy, memory management becomes an important research topic for deep learning systems, given that GPU has limited memory size. Many approaches have been proposed towards this issue, e.g., model compression and memory swapping. However, they either degrade the model accuracy or require a lot of manual intervention. In this paper, we propose two orthogonal approaches to reduce the memory cost from the system perspective. Our approaches are transparent to the models, and thus do not affect the model accuracy. They are achieved by exploiting the iterative nature of the training algorithm of deep learning to derive the lifetime and read/write order of all variables. With the lifetime semantics, we are able to implement a memory pool with minimal fragments. However, the optimization problem is NP-complete. We propose a heuristic algorithm that reduces up to 13.3% of memory compared with Nvidia's default memory pool with equal time complexity. With the read/write semantics, the variables that are not in use can be swapped out from GPU to CPU to reduce the memory footprint. We propose multiple swapping strategies to automatically decide which variable to swap and when to swap out (in), which reduces the memory cost by up to 34.2% without communication overhead.
研究动机与目标
- 解决由于模型规模更大、更深,尽管 GPU 内存有限,但内存压力持续增长的问题。
- 克服现有方法的局限性,如模型压缩(导致精度损失)和手动内存交换(开销高,需要专业知识)。
- 开发无需修改模型结构或训练算法的自动、透明、系统级内存优化技术。
- 在不牺牲性能或精度的前提下,实现对各种 DNN 架构、批量大小和内存限制的高效内存使用。
- 提供一个统一、可扩展的内存优化框架,可跨不同深度学习工作负载有效扩展。
提出的方法
- 提出 SmartPool:一种内存池机制,通过将生命周期不重叠的变量分配到同一内存区域,实现 GPU 内存空间的重复利用,从而最小化内存碎片。
- 设计一种启发式算法,高效求解 NP-完全的内存分配问题,在与基线方法相同的时间复杂度下实现接近最优的分配效果。
- 分析 DNN 反向传播中的读写访问模式,识别出在训练迭代部分时间内处于不活跃状态的变量。
- 实现 AutoSwap:一种自动内存交换机制,将未使用的变量从 GPU 内存移至 CPU 内存,并在重新使用前恢复。
- 设计多种调度策略,以最小化通信和同步开销,同时最大化内存节省效果。
- 在统一抽象下集成两种技术,运行时收集变量生命周期和访问顺序信息,实现透明化优化。
实验结果
研究问题
- RQ1我们能否在不改变模型结构或训练算法的前提下,减少深度学习训练中的 GPU 内存占用?
- RQ2如何利用变量的生命周期信息,最小化 GPU 内存池中的内存碎片?
- RQ3我们能否自动识别并将其移至 CPU 内存的不活跃变量,以减少 GPU 内存使用?
- RQ4哪些调度策略可以在 GPU-CPU 内存交换中最小化通信开销,同时最大化内存节省?
- RQ5所提出的技术在不同 DNN 架构、批量大小和内存约束下是否具有良好的可扩展性?
主要发现
- 与 NVIDIA 默认的 CnMem 内存池相比,SmartPool 最多可将 GPU 内存使用量降低 13.3%,且时间复杂度保持一致。
- AutoSwap 在不产生任何可测量通信开销的情况下,最多可将 GPU 内存占用减少 34.2%。
- SmartPool 与 AutoSwap 联合使用可在多种模型(包括 VGG 和 ResNet)中实现显著的内存节省,且性能影响极小。
- 该方法对用户完全透明,无需手动配置或了解特定模型知识。
- 该方法在不同网络深度、批量大小和内存负载限制下均表现出良好的可扩展性,优于 MXNet-memonger 和 SuperNeurons 等现有工具,在内存减少和开销控制方面表现更优。
- 与 GeePS 相比,所提方法在实现更大内存减少的同时,保持低开销,并消除了手动选择层或张量的需要。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。