首先是这篇文章
- Horace He. (2022). Making Deep Learning Go Brrrr From First Principles
内容不再赘述, 下面是纲要和一些对原文的注解. 虽然文章用 Torch 和 GPU 举例, 但基本原理依然普适.
注 (Show more »)
机器之心 编译 过这篇文章, 但有些错误. 比如只看第一段, 前几句话还行, 但光最后一句就有两个技术错误: (1) 把 in-place 说成内置; (2) 梯度设置为 None 说成 0. 关于第 2 点可以参考 torch 文档 Use parameter.grad = None instead of model.zero_grad() or optimizer.zero_grad().
简单介绍了模型耗时可以分为三部分
- Compute: Time spent on your GPU computing actual floating point operations (FLOPS)
- Bandwith: Time spent on moving the data from CPU to GPU, from one node to another, or even from CUDA global memory to CUDA shared memory
- Overhead: Everything else
