第 8 章 · worker 数和 GPU 空等
配套讲义:第 8 章 · Dataset 与 DataLoader:给 GPU 备菜的流水线。读一批要 t_d 毫秒(CPU),训一步要 25 毫秒(GPU)。画 8 步训练。
0
40
看点:① num_workers = 0 时主进程自己备菜,备一批训一步,排成一条线;② 加 worker 后备菜并行,GPU 方块逐渐首尾相接;③ worker 数 ≥ t_d ÷ 25 时 GPU 不再等。
配套讲义:第 8 章 · Dataset 与 DataLoader:给 GPU 备菜的流水线。读一批要 t_d 毫秒(CPU),训一步要 25 毫秒(GPU)。画 8 步训练。
看点:① num_workers = 0 时主进程自己备菜,备一批训一步,排成一条线;② 加 worker 后备菜并行,GPU 方块逐渐首尾相接;③ worker 数 ≥ t_d ÷ 25 时 GPU 不再等。