Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OMPException class and use it for Text Parser #445

Merged
merged 9 commits into from
Aug 15, 2018

Conversation

anirudh2290
Copy link
Contributor

Adding a class for OMPException since this needs to be handled in TextParser in dmlc-core and also the ImageDetRecordIOParser, ImageRecordIOParser and other parsers that maybe added in future in MXNet.

@hcho3
Copy link
Contributor

hcho3 commented Aug 14, 2018

@anirudh2290 Can you use this for #pragma omp for loops as well?

@anirudh2290
Copy link
Contributor Author

@hcho3 yes you should be able to use it and i am using it in the related PR for mxnet https://github.com/apache/incubator-mxnet/pull/12051/files

@anirudh2290
Copy link
Contributor Author

@hcho3 does that answer your question ? is this PR good to go ?

@hcho3
Copy link
Contributor

hcho3 commented Aug 15, 2018

@anirudh2290 Let me review it today.

Copy link
Contributor

@hcho3 hcho3 left a comment

Choose a reason for hiding this comment

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

Overall, this pull request is nicely done. It will be useful for other projects as well, such as XGBoost. Let me know what you think about my comment.

parser_exception_ = std::current_exception();
}
}
omp_exc_.Run([=] {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a bit wary about the default value capture here. For example, is it cheap to copy chunk?

I think we should stick to capture by reference [&], since there is no danger of the lambda outliving the captured objects.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point. you are right it should be by reference. i fixed it at other places in mxnet code but missed it here.

@hcho3
Copy link
Contributor

hcho3 commented Aug 15, 2018

LGTM

@hcho3 hcho3 merged commit ee773cd into dmlc:master Aug 15, 2018
hcho3 pushed a commit that referenced this pull request Aug 15, 2018
* Add OMPException class and use it for Text Parser

* Fix lint

* Add documentation for Rethrow and Run

* Fix lint

* Add documentation for OMPException

* Add more documentation

* Fix comments

* Change capture by value to capture by reference
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants