Tim Dettmers 做量化、多卡和智能体时,习惯先把硬件账和算法账摊开。把「How To Build and Use a Multi GPU System for Deep Learning」写成能落地的笔记,核心不是复述论文摘要,而是:显存、精度、通信和评测会在哪一层先爆。下面用中文重排,去掉原站广告和分享条。

问题从哪来

When I started using GPUs for deep learning my deep learning skills improved quickly. When you can run experiments of algorithms and algorithms with different parameters and gain rapid feedback you can just learn much more quickly. At the beginning, deep learning is a lot of trial and error: You have to get a feel what parameters need to be adjusted, or what puzzle piece is missing in order to get a good result. A GPU helps you to fail quickly and learn im

After this success I was tempted to use multiple GPUs in order to train deep learning algorithms even faster. I also took interest in learning very large models which do not fit into a single GPU. I thus wanted to build a little GPU cluster and explore the possibilities to speed up deep learning with multiple nodes with multiple GPUs. At the same time I was offered to do contract work as a data base developer through my old employer. This gave me opportuni

方法怎么选

When I did my research on which hardware to buy I soon realized, that the main bottleneck will be the network bandwidth, i.e. how much data can be transferred from computer to computer per second. The network bandwidth of network cards (affordable cards are at about 4GB/s) does not come even close to the speed of PCIe 3.0 bandwidth (15.75 GB/s). So GPU-to-GPU communication within a computer will be fast, but it will be slow between computers. On top of tha

This is the reason why many big companies like Google and Microsoft are using CPU rather than GPU clusters to train their big neural networks. Luckily, Mellanox and Nvidia recently came together to work on that problem and the result is GPUDirect RDMA, a network card driver that can make sense of GPU memory addresses and thus can transfer data directly from GPU to GPU between computers.

数字怎么读

Generally your best bet for cheap network cards is eBay. I won an auction for a set of 40Gbit/s Mellanox network cards that support GPUDirect RDMA along with the fitting fibre cable on eBay. I already had two GTX Titan GPUs with 6GB of memory and as 当时的目标是 to build huge models that do not fit into a single memory, so I decided to keep the 6GB cards and buy more of them to build a cluster that features 24GB memory. In retrospect this was a rather foolish (a

There are basically two options how to do multi-GPU programming. You do it in CUDA and have a single thread and manage the GPUs directly by setting the current device and by declaring and assigning a dedicated memory-stream to each GPU, or the other options is to use CUDA-aware MPI where a single thread is spawned for each GPU and all communication and synchronization is handled by MPI. The first method is rather complicated as you need to create efficient

上线前先钉死的事

The second option is much more efficient and clean. MPI is the standard in high performance computing and its standardized library means that you can be sure that a MPI method really does what it is supposed to do. Underlying MPI the same principles are used as in the first method describes above, but the abstraction is so good that it is quite easy to adapt single GPU code to multiple GPU code (at least for data parallelism). The result is clean and maint

落地时建议先做的 5 件事

  1. 用自己的模型和序列长度算显存账,不要只看官网 TFLOPS。
  2. 量化前后都要有同一套评测:平均分和长尾失败都记。
  3. 多卡训练先分清数据并行和模型并行,通信量写进预算。
  4. 智能体工作流要有可复现实验,而不是一次演示通过。
  5. 硬件选型写清接口、功耗和两年后还能不能买到。

和智能体产品怎么接

龙虾PRO做 OpenClaw 落地时,量化和多卡经验会直接变成推理成本和技能能否本地跑。数字员工和网关应共用同一套 GPU/精度预算,而不是每条链路各买各的卡。

效率龙虾 会带着下面这段开聊

按文章《怎么搭一套能干活的多 GPU 训练机》把卡点收成可执行步骤:先做什么、别踩哪条、怎么验证。

用效率龙虾试这篇

本文侧重全链路风控方法论。落地时请用自身业务单据做回放验证,不要把示例阈值直接当生产策略。 相关:风控体检 · 方案资源

常见问题 FAQ

为什么在深度学习中需要搭建多GPU训练机?

从文章看,作者最初用GPU加速单模型训练,能快速试错学习。但遇到大模型时,单GPU显存不够,所以需要多GPU集群来并行训练,加速过程并支持更大模型。这能提升实验效率,让深度学习更易探索。

搭建多GPU系统时,网络带宽为什么容易成为瓶颈?

文章提到,PCIe 3.0带宽约15.75GB/s,而廉价网卡只有4GB/s,导致GPU间跨机通信慢。这限制了多节点数据传输,Google等公司因此用CPU集群,但GPUDirect RDMA能直接处理GPU内存地址,提升效率。

多GPU编程的两种主要方法是什么?如何选择?

一种是用CUDA直接管理GPU,通过设置设备和内存流,但复杂;另一种是用CUDA-aware MPI,为每个GPU生成线程,MPI处理通信。MPI更高效、标准化,易从单GPU代码适配,推荐用于数据并行任务。

为什么在多GPU训练中MPI比直接CUDA管理更高效?

MPI是高性能计算标准,底层原理相似,但抽象层次好,代码更干净、可维护。直接CUDA管理需手动同步多线程,易出错;MPI简化了通信和同步,便于扩展,适合大规模训练。

搭建多GPU训练系统前,必须先完成哪些准备事项?

文章建议5件事:用自己模型算显存需求,不只看官网TFLOPS;建立统一评测基准,记录平均分和长尾失败;区分数据并行和模型并行,预算通信量;确保智能体工作流可复现;硬件选型考虑接口、功耗和长期可用性。

如何将多GPU训练与智能体产品如龙虾PRO结合?

文章提到龙虾PRO做智能体产品,但需先搭建高效多GPU基础设施。建议注重可复现实验,而非单次演示,将训练系统集成到智能体工作流中,确保评测一致,并规划硬件支持未来扩展。