Add HashStore to c10d (#28921)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/28921
This implementation is quite similar to the HashStore in gloo -
an ephemeral in-process store with a lock and unordered_map<>.
There are a few tweaks/differences based on c10d vs gloo:
- c10d expects add/check methods
- c10d get() use cases expect to wait up to super::timeout_ if the value isn't present
- c10d set() isn't expected to throw if the value is present.
- c10d uses uint8_t vs char
It's potentially a better choice for some cases than FileStore when we
don't need cross-process access, or care about the backing file.
ghstack-source-id: 92992341
Test Plan:
buck build mode/dev-nosan caffe2/torch/lib/c10d/...
buck-out/dev/gen/caffe2/torch/lib/c10d/HashStoreTest
Differential Revision: D18233713
fbshipit-source-id: ab23f3f93d3148c1337f2cc6a8f2aff4aa6549f3