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

Add error checking for cpp examples. #13828

Merged
merged 1 commit into from
Jan 17, 2019
Merged

Add error checking for cpp examples. #13828

merged 1 commit into from
Jan 17, 2019

Conversation

frankfliu
Copy link
Contributor

Description

In current cpp example, if data file isn't exist, example application will crash with sig 11 .
Add error checking to avoid crash.

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • 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:https://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

@@ -63,10 +63,14 @@ int main(int argc, char** argv) {
};

auto train_iter = MXDataIter("MNISTIter");
setDataIter(&train_iter, "Train", data_files, batch_size);
if (!setDataIter(&train_iter, "Train", data_files, batch_size)) {

Copy link
Member

Choose a reason for hiding this comment

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

missing return value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

@@ -244,10 +244,14 @@ int main(int argc, char const *argv[]) {
};

auto train_iter = MXDataIter("MNISTIter");
setDataIter(&train_iter, "Train", data_files, batch_size);
if (!setDataIter(&train_iter, "Train", data_files, batch_size)) {
return 1;
Copy link
Member

Choose a reason for hiding this comment

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

Can we have some descriptive error messages?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The error message already printed in check_datafiles()

@anirudhacharya
Copy link
Member

@mxnet-label-bot add [pr-awaiting-review]

Copy link
Member

@TaoLv TaoLv left a comment

Choose a reason for hiding this comment

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

Thank you for addressing my comments. Can you take a look at the CI failure?

@lanking520
Copy link
Member

lanking520 commented Jan 16, 2019

Restarted the test

@TaoLv TaoLv merged commit 26f5580 into apache:master Jan 17, 2019
@frankfliu frankfliu deleted the cpp branch January 18, 2019 05:40
stephenrawls pushed a commit to stephenrawls/incubator-mxnet that referenced this pull request Feb 16, 2019
haohuanw pushed a commit to haohuanw/incubator-mxnet that referenced this pull request Jun 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr-awaiting-review PR is waiting for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants