GMLake:利用虚拟内存拼接实现大规模DNN训练的高效透明GPU内存碎片整理
GMLake: Efficient and Transparent GPU Memory Defragmentation for Large-scale DNN Training with Virtual Memory Stitching
AI总结:
针对大规模DNN训练中缓存分配器因频繁不规则内存请求导致的严重碎片问题,本文提出基于GPU虚拟内存管理的GMLake框架,通过虚拟内存拼接机制合并非连续内存块,在八个LLM模型上平均减少9.2 GB显存占用并降低15%碎片,且对模型和内存缩减技术完全透明。
摘要:
大规模深度神经网络(DNN),如大语言模型(LLM),已经彻底改变了人工智能(AI)领域并日益普及。然而,训练或微调此类模型需要大量的计算能力和资源,其中单个加速设备(如GPU)的内存容量是最重要的瓶颈之一。由于GPU原生内存分配器的开销过高(例如10倍),PyTorch和TensorFlow等DNN框架采用缓存分配器,该分配器维护一个具有拆分机制的内存池,以实现快速的内存分配与释放。不幸的是,对于重计算、卸载、分布式训练和低秩适配等流行的内存缩减技术,缓存分配器的效率会迅速下降。主要原因是这些内存缩减技术会引入频繁且不规则的内存分配与释放请求,导致基于拆分的缓存分配器出现严重的碎片问题。为了缓解这一碎片问题,我们提出了一种基于底层GPU虚拟内存管理的新型内存分配框架,称为GPU内存湖(GMLake)。GMLake采用一种新颖的虚拟内存拼接(VMS)机制,可以通过虚拟内存地址映射融合或合并非连续内存块。在配备80 GB内存的GPU A100上,GMLake在八个LLM模型中平均可减少9.2 GB(最高25 GB)的GPU内存使用量,并将碎片减少15%(最高33%)。GMLake对DNN模型和内存缩减技术完全透明,并确保资源密集型深度学习任务的无缝执行。我们已在https://github.com/intelligent-machine-learning/glake/tree/main/GMLake开源GMLake。
英文摘要:
Large-scale deep neural networks (DNNs), such as large language models (LLMs), have revolutionized the artificial intelligence (AI) field and become increasingly popular. However, training or fine-tuning such models requires substantial computational power and resources, where the memory capacity of a single acceleration device like a GPU is one of the most important bottlenecks. Owing to the prohibitively large overhead (e.g., $10 \times$) of GPUs' native memory allocator, DNN frameworks like PyTorch and TensorFlow adopt a caching allocator that maintains a memory pool with a splitting mechanism for fast memory (de)allocation. Unfortunately, the caching allocator's efficiency degrades quickly for popular memory reduction techniques such as recomputation, offloading, distributed training, and low-rank adaptation. The primary reason is that those memory reduction techniques introduce frequent and irregular memory (de)allocation requests, leading to severe fragmentation problems for the splitting-based caching allocator. To mitigate this fragmentation problem, we propose a novel memory allocation framework based on low-level GPU virtual memory management called GPU memory lake (GMLake). GMLake employs a novel virtual memory stitching (VMS) mechanism, which can fuse or combine non-contiguous memory blocks with a virtual memory address mapping. GMLake can reduce an average of 9.2 GB (up to 25 GB) GPU memory usage and 15% (up to 33% ) fragmentation among eight LLM models on GPU A100 with 80 GB memory. GMLake is completely transparent to the DNN models and memory reduction techniques and ensures the seamless execution of resource-intensive deep-learning tasks. We have open-sourced GMLake at https://github.com/intelligent-machine-learning/glake/tree/main/GMLake.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。