[DDP] Allow tuning of first bucket (#62748)
authorRohan Varma <rvarm1@fb.com>
Thu, 5 Aug 2021 23:33:40 +0000 (16:33 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Thu, 5 Aug 2021 23:35:07 +0000 (16:35 -0700)
commit80091cb0f70b67943209a1dbe17f2f367d788906
treed2c873d39634f41b04a399825bdc22450e66ac43
parent5c431981b5b36da6dba61f0e5d5101e72d2fd726
[DDP] Allow tuning of first bucket (#62748)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/62748

Previously after buckets were rebuilt the first bucket size was always
defaulted to 1MB, this diff allows first bucket to be tuned like the rest of
the bucket sizes can.

Setting `dist._DEFAULT_FIRST_BUCKET_BYTES = 1` results in the following logs as
expected:
I0804 12:31:47.592272 246736 reducer.cpp:1694] 3 buckets rebuilt with size
limits: 1, 1048, 1048 bytes.
ghstack-source-id: 135074696

Test Plan: CI

Reviewed By: SciPioneer, wanchaol

Differential Revision: D30110041

fbshipit-source-id: 96f76bec012de129d1645e7f50e266d4b255ec66
torch/csrc/distributed/c10d/init.cpp
torch/csrc/distributed/c10d/reducer.cpp
torch/csrc/distributed/c10d/reducer.hpp
torch/nn/parallel/distributed.py