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

Better timeline #9037

Merged
merged 1 commit into from
Mar 15, 2018
Merged

Better timeline #9037

merged 1 commit into from
Mar 15, 2018

Conversation

panyx0718
Copy link
Contributor

  1. Supported nested event
  2. Better support for cpu multi-thread
  3. Betters support nested block and block total time.

@CLAassistant
Copy link

CLAassistant commented Mar 14, 2018

CLA assistant check
All committers have signed the CLA.

@panyx0718 panyx0718 force-pushed the develop branch 8 times, most recently from b97dc69 to fbe8a9a Compare March 14, 2018 08:08
RecordThread::~RecordThread() {
if (g_state == ProfilerState::kDisabled) return;
ClearCurThread();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that RecordThread only supports one layer nesting. If RecordThread records the PreThread before setting CurThread, RecordThread can support more layers nesting.

   thread0
        thread1
             thread2
        thread1
   thread0

Copy link
Contributor Author

@panyx0718 panyx0718 Mar 15, 2018

Choose a reason for hiding this comment

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

Yes, currently, it doesn't auto support thread nesting. See comments here:
paddle/fluid/platform/device_tracer.cc
The main reason is that we don't have nest threading yet.

Actually, user can add code to give nested thread different ids:

int nested_thread_id = CurThread() * 10 + 1
std::thread([nested_thread_id]() {
  RecordThread(nested_thread_id);
  ...
}

namespace {
// block id starts from 0. This id is used to represent the codeblock
// wrapping the first block 0.
int kProgramId = -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is kProgramId to distinguish the different program in a model?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. The global block has block id 0. However, before the block 0 starts, there are some other preprocessing and post-processing overhead. I wrap those codes into block id -1.

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.

LGTM! We can get this merge first.

@panyx0718 panyx0718 merged commit d284cf8 into PaddlePaddle:develop Mar 15, 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.

3 participants