Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[API] unified API for custom kvstores #17010

Merged
merged 37 commits into from
Dec 17, 2019

Conversation

eric-haibin-lin
Copy link
Member

@eric-haibin-lin eric-haibin-lin commented Dec 8, 2019

Description

depends on #17007
#16795
See the KVStoreBase for all interfaces defined in kvstore/base.py. See TestStore class in the same file as an example of custom single node kvstore which implements minimal required interfaces.

The interfaces include:

  • broadcast
  • pushpull
  • num_workers
  • rank
  • type
  • is_capable

We can reuse these interfaces for other communication backends such as p3 and horovod. @anandj91 @apeforest

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to the relevant JIRA issue created (except PRs with tiny changes)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage:
  • Unit tests are added for small changes to verify correctness (e.g. adding a new operator)
  • Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)
  • Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)
  • Code is well-documented:
  • For user-facing API changes, API doc string has been updated.
  • For new C++ functions in header files, their functionalities and arguments are documented.
  • For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable
  • Check the API doc at https://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
  • To the best of my knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

Changes

Added test for:

  • pushpull with teststore in test_kvstore_custom.py
  • broadcast with teststore in test_kvstore_custom.py
  • gluon trainer with teststore in test_gluon_trainer.py

Comments

  • If this change is a backward incompatible change, why must this change be made.
  • Interesting edge cases to note here

@apeforest apeforest self-assigned this Dec 11, 2019
@apeforest apeforest self-requested a review December 11, 2019 06:36
@apeforest apeforest removed their assignment Dec 11, 2019
@eric-haibin-lin
Copy link
Member Author

@ChaokunChang FYI

Copy link
Contributor

@apeforest apeforest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does the API look like for Horovod? Could you please add some interface for Horovod related APIs so we know if the design of class is sufficient.

python/mxnet/__init__.py Outdated Show resolved Hide resolved
python/mxnet/kvstore/base.py Show resolved Hide resolved
python/mxnet/kvstore/base.py Show resolved Hide resolved
python/mxnet/kvstore/base.py Show resolved Hide resolved
python/mxnet/kvstore/base.py Show resolved Hide resolved
python/mxnet/model.py Show resolved Hide resolved
tests/nightly/dist_device_sync_kvstore_custom.py Outdated Show resolved Hide resolved
tests/python/unittest/test_kvstore.py Outdated Show resolved Hide resolved
tests/python/unittest/test_kvstore_custom.py Show resolved Hide resolved
python/mxnet/gluon/trainer.py Show resolved Hide resolved
@eric-haibin-lin
Copy link
Member Author

Thanks for the detailed review comments. Just updated the PR.

Copy link
Contributor

@apeforest apeforest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Using a base KVStore class simplies the implementation in Training class, although the method pushpull naming seems to indicate a PS-based strategy. It might be a good idea to add an alias like allreduce for non PS strategies.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants