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

Use std::exception as the param in engine complete callback #14911

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

yuxihu
Copy link
Member

@yuxihu yuxihu commented May 7, 2019

Description

This PR replaces dmlc::Error with std::exception for the param in engine complete callback functions.

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 http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
  • To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

Changes

  • Feature1, tests, (and when applicable, API doc)
  • Feature2, tests, (and when applicable, API doc)

Comments

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

@yuxihu
Copy link
Member Author

yuxihu commented May 7, 2019

@mxnet-label-bot add [pr-work-in-progress]

@marcoabreu marcoabreu added the pr-work-in-progress PR is still work in progress label May 7, 2019
@@ -74,15 +74,15 @@ class CallbackOnComplete {
public:
// use implicit copy and assign
/*! \brief involve the callback */
inline void operator()(const dmlc::Error* error = nullptr) const {
inline void operator()(const std::exception* error = nullptr) const {
Copy link
Member

Choose a reason for hiding this comment

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

Is this to support horovod to handle non dmlc exceptions ?

Copy link
Member Author

@yuxihu yuxihu May 7, 2019

Choose a reason for hiding this comment

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

No, there is no need for this in Horovod at this moment. dmlc exception is a subclass of std::exception. I feel it is better to be more generic on the interface. Additionally, your recent improvements on exception handling also started to catch a broader range of exceptions using std::exception instead of dmlc::Error.

Copy link
Member

Choose a reason for hiding this comment

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

okay sure.

Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to add a unit test? For example, purposely performing nd.ones((1,) + extremely_small_number to cause std::stof to fail?

Copy link
Member Author

Choose a reason for hiding this comment

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

I changed this place to use this new interface. A lot existing negative test cases have already covered it.

Copy link
Member

Choose a reason for hiding this comment

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

The link was broken. Do you mind sending the link again?

@yuxihu yuxihu force-pushed the callback_ex branch 3 times, most recently from ee563d0 to 48601d8 Compare May 16, 2019 21:42
@Roshrini
Copy link
Member

@yuxihu Can you please address comments?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr-work-in-progress PR is still work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants