AI4Finance-Foundation / AI4Finance-Foundation/RLSolver

✨ DataParallel and DistributedDataParallel for speed up training.

未关闭
#43 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
Python
星标
169
派生
36
PR 合并指标
30 天内没有已合并 PR

描述

DataParallel: multiple thread for single machine multiple GPUs
- unbalance GPU memory and GPU usage. ([discuss.pytorch.org: Use `FullModel` which writes loss function into the model to solve the memory usage imbalance problem. ](https://discuss.pytorch.org/t/dataparallel-imbalanced-memory-usage/22551/6))
- slow
- Collecting gradients by a serial method

DistributedDataParallel: multiple processing for single or multiple machines and multiple GPUs.
- balance GPU memory and GPU usage. (don't need to use `FullModel`)
- faster than DataParallel
- [Ring-Allreduce by pytorch](https://pytorch.org/tutorials/intermediate/dist_tuto.html#our-own-ring-allreduce)

It is very easy to add **DataParallel** into the code, but DataParallel brings less speed up.

It's a little tricky to use because **DistributedDataParallel** needs to be started from the command line, but it gives a significant speedup with 4 GPUs in single machine in high GPU memory.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。