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

Fixes for profiler#9932

Merged
cjolivier01 merged 8 commits intoapache:masterfrom
rahul003:profiler-fix
Mar 11, 2018
Merged

Fixes for profiler#9932
cjolivier01 merged 8 commits intoapache:masterfrom
rahul003:profiler-fix

Conversation

@rahul003
Copy link
Member

@rahul003 rahul003 commented Mar 1, 2018

Description

  1. Fixes issue where thread id can be hex, and the hex symbols are not recognized by chrome tracing tool. Using hash to convert it to an integer

  2. The json file has some missing commas because of the first_flag condition. The reason for this seems lost at this point. Removing it bring back the comma necessary for a valid json. Verified that it does generate valid jsons by training a network.

Checklist

Essentials

  • Passed code style checking (make lint)
  • 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
  • To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

Changes

  • See description

@rahul003 rahul003 requested a review from cjolivier01 as a code owner March 1, 2018 01:24
/*! \brief id of thread which operation run on */
std::thread::id thread_id_ = std::this_thread::get_id(); // Not yet seen a
// case where this isn't valid
size_t thread_id_ = std::hash<std::thread::id>{}(std::this_thread::get_id());
Copy link
Member

Choose a reason for hiding this comment

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

why do it here instead of emit time?

Copy link
Member Author

Choose a reason for hiding this comment

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

Does each ProfileStat get used only once? I thought this would be better, because we can hash once only.

Copy link
Member

Choose a reason for hiding this comment

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

only once

Copy link
Member

Choose a reason for hiding this comment

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

it's no longer thread_id_ if you do this...

std::thread::id thread_id_ = std::this_thread::get_id(); // Not yet seen a
// case where this isn't valid
size_t thread_id_ = std::hash<std::thread::id>{}(std::this_thread::get_id());
// thread getid returns a hex, hashing it to get a size_t
Copy link
Member

Choose a reason for hiding this comment

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

nit: usually comment goes above the code?

} else {
file << ",\n";
}
file << ",\n";
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this ? Also is there a reason not to use std::endl ?

Copy link
Member Author

Choose a reason for hiding this comment

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

There were two new lines here earlier. Using one \n is slightly better for performance since we are anyway flushing the buffer with the second new line

@rahul003
Copy link
Member Author

rahul003 commented Mar 1, 2018

@marcoabreu Looks like this test test_gluon_model_zoo_gpu.test_training is failing. My PR should not have anything to do with that.
Have you seen this test fail before?

@marcoabreu
Copy link
Contributor

Yes it's flaky unfortunately. Please just push a new commit to trigger CI

/*! \brief id of thread which operation run on */
std::thread::id thread_id_ = std::this_thread::get_id(); // Not yet seen a
// case where this isn't valid
size_t thread_id_ = std::hash<std::thread::id>{}(std::this_thread::get_id());
Copy link
Member

Choose a reason for hiding this comment

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

only once

/*! \brief id of thread which operation run on */
std::thread::id thread_id_ = std::this_thread::get_id(); // Not yet seen a
// case where this isn't valid
size_t thread_id_ = std::hash<std::thread::id>{}(std::this_thread::get_id());
Copy link
Member

Choose a reason for hiding this comment

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

it's no longer thread_id_ if you do this...

@rahul003 rahul003 changed the title Fixing couple of bugs in profiler Fixes for profiler Mar 1, 2018
@CodingCat
Copy link
Contributor

Hi, the community has passed to vote about associating the code changes with JIRA (https://lists.apache.org/thread.html/ab22cf0e35f1bce2c3bf3bec2bc5b85a9583a3fe7fd56ba1bbade55f@%3Cdev.mxnet.apache.org%3E)

We have updated the guidelines for contributors in https://cwiki.apache.org/confluence/display/MXNET/Development+Process, please ensure that you have created a JIRA at https://issues.apache.org/jira/projects/MXNET/issues/ to describe your work in this pull request and include the JIRA title in your PR as [MXNET-xxxx] your title where MXNET-xxxx is the JIRA id

Thanks!

@piiswrong
Copy link
Contributor

@cjolivier01 ping

@cjolivier01 cjolivier01 merged commit 94f68fc into apache:master Mar 11, 2018
@rahul003 rahul003 deleted the profiler-fix branch March 11, 2018 11:18
jinhuang415 pushed a commit to jinhuang415/incubator-mxnet that referenced this pull request Mar 30, 2018
* hash tid

* remove first flag conditions to fix missing commas

* hash tid

* remove first flag conditions to fix missing commas

* update comment

* CI restart

* address review comments
rahul003 added a commit to rahul003/mxnet that referenced this pull request Jun 4, 2018
* hash tid

* remove first flag conditions to fix missing commas

* hash tid

* remove first flag conditions to fix missing commas

* update comment

* CI restart

* address review comments
zheng-da pushed a commit to zheng-da/incubator-mxnet that referenced this pull request Jun 28, 2018
* hash tid

* remove first flag conditions to fix missing commas

* hash tid

* remove first flag conditions to fix missing commas

* update comment

* CI restart

* address review comments
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants