1 Star 0 Fork 0

Louis / multi_gpu_test

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

pytorch多卡训练DDP

1. 库安装步骤

  1. 安装apex(应该也可用不用安装)
    git clone https://github.com/NVIDIA/apex
    cd apex
    pip3 install -v --no-cache-dir ./
  2. 测试是否安装成功 python -m torch.distributed.launch --nproc_per_node=4 main.py

2. 运行程序

  1. torch.nn.DataParallel,python main_DP.py
  2. torch.nn.parallel.DistributedDataParallel,python -m torch.distributed.launch --nproc_per_node=4 main_DPP.py (其中nproc_per_node可填GPU数目)

3. 运行结果

  1. torch.nn.DataParallel:
    GPU占用:1091MiB;2757MiB;2757MiB;2757MiB;
    耗时:0:07:01.833007
  2. torch.nn.parallel.DistributedDataParallel: GPU占用:961MiB;961MiB;961MiB;961MiB
    耗时:0:00:57.362566

参考

github仓库1
github仓库2(主要是这个)
知乎的博客

空文件

简介

PyTorch多GPU测试仓库 展开 收起
Python
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Python
1
https://gitee.com/LouisJiangjing/multi_gpu_test.git
git@gitee.com:LouisJiangjing/multi_gpu_test.git
LouisJiangjing
multi_gpu_test
multi_gpu_test
master

搜索帮助