Skip to content

Conversation

reyoung
Copy link
Collaborator

@reyoung reyoung commented Jun 11, 2018

It seems that transformer will still be hang without this lock.

@reyoung reyoung requested a review from chengduoZH June 11, 2018 04:47
template <typename Callback>
void RecordEvent(cudaEvent_t ev, Callback callback) {
std::lock_guard<std::mutex> guard(mtx_);
callback();
Copy link
Contributor

Choose a reason for hiding this comment

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

How about replacing std::mutex with std::recursive_mutex? Because, if the callback() contains another RecordEvent() calling, it will be hang again.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This situation should not happen.

Copy link
Contributor

@chengduoZH chengduoZH left a comment

Choose a reason for hiding this comment

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

Excellent

@reyoung reyoung merged commit 3fd3e50 into PaddlePaddle:develop Jun 11, 2018
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