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

Profiler API Enhancements #15132

Merged
merged 24 commits into from
Jun 15, 2019
Merged

Profiler API Enhancements #15132

merged 24 commits into from
Jun 15, 2019

Conversation

Zha0q1
Copy link
Contributor

@Zha0q1 Zha0q1 commented Jun 3, 2019

Description

This is the work in progress of the changes discussed in #15069. In stead of the original design which is to add a new api, get_summary(), to return the aggregate stats in JSON, I added a few parameters to the existing dumps().

Now dumps() (MXAggregateProfileStatsPrint) supports new parameters: format which controls the return string format, sort_by which specifies by which stat should the entries be sorted, and ascending which specify whether to sort ascendingly.

New api reset() is removed from the original proposal.

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to the relevant JIRA issue created (except PRs with tiny changes)
  • 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://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

Changes

  • adding parameters to dumps()

include/mxnet/c_api.h Outdated Show resolved Hide resolved
@piyushghai
Copy link
Contributor

Thanks for your contributions @Zha0q1 .
@mxnet-label-bot Add [Profiler, pr-work-in-progress]

@marcoabreu marcoabreu added pr-work-in-progress PR is still work in progress Profiler MXNet profiling issues labels Jun 4, 2019
Copy link
Contributor

@sandeep-krishnamurthy sandeep-krishnamurthy left a comment

Choose a reason for hiding this comment

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

Thanks. nice start.
Test cases?

include/mxnet/c_api.h Outdated Show resolved Hide resolved
include/mxnet/c_api.h Outdated Show resolved Hide resolved
include/mxnet/c_api.h Outdated Show resolved Hide resolved
python/mxnet/profiler.py Show resolved Hide resolved
python/mxnet/profiler.py Show resolved Hide resolved
src/c_api/c_api_profile.cc Show resolved Hide resolved
src/profiler/aggregate_stats.cc Outdated Show resolved Hide resolved
src/profiler/aggregate_stats.cc Outdated Show resolved Hide resolved
src/profiler/aggregate_stats.cc Outdated Show resolved Hide resolved
@sandeep-krishnamurthy
Copy link
Contributor

@access2rohit - Can you please help review this PR?

@access2rohit
Copy link
Contributor

sure! Zhaoqi has fixed the failing tests now

@access2rohit
Copy link
Contributor

Can you fix the failing test ?
ERROR: Failure: SyntaxError (invalid syntax (test_profiler.py, line 256))

@Zha0q1
Copy link
Contributor Author

Zha0q1 commented Jun 12, 2019

Can you fix the failing test ?
ERROR: Failure: SyntaxError (invalid syntax (test_profiler.py, line 256))

It worked on my computer. Maybe online tests are using a different python version? I will fix this tomorrow.

Copy link
Contributor

@sandeep-krishnamurthy sandeep-krishnamurthy left a comment

Choose a reason for hiding this comment

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

Thanks. Last few minor comments.
As discussed offline, you are planning to update MXNet profiler tutorial in a new PR?

include/mxnet/c_api.h Show resolved Hide resolved
python/mxnet/profiler.py Show resolved Hide resolved
src/profiler/aggregate_stats.cc Outdated Show resolved Hide resolved
src/profiler/aggregate_stats.h Outdated Show resolved Hide resolved
src/profiler/aggregate_stats.h Outdated Show resolved Hide resolved
src/profiler/aggregate_stats.h Outdated Show resolved Hide resolved
tests/python/unittest/test_profiler.py Outdated Show resolved Hide resolved
@Zha0q1
Copy link
Contributor Author

Zha0q1 commented Jun 13, 2019

Thanks. Last few minor comments.
As discussed offline, you are planning to update MXNet profiler tutorial in a new PR?

Yeah, that I will do. Thanks for the great advices!

Copy link
Contributor

@sandeep-krishnamurthy sandeep-krishnamurthy left a comment

Choose a reason for hiding this comment

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

One minor spelling issue.

@Zha0q1 Zha0q1 closed this Jun 14, 2019
@Zha0q1 Zha0q1 reopened this Jun 14, 2019
@Zha0q1 Zha0q1 closed this Jun 14, 2019
@Zha0q1 Zha0q1 reopened this Jun 14, 2019
include/mxnet/c_api.h Outdated Show resolved Hide resolved
debug_str = profiler.dumps(format = 'json')
assert(len(debug_str) > 0)
target_dict = json.loads(debug_str)
print(target_dict)
Copy link
Member

Choose a reason for hiding this comment

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

remove print

@Zha0q1 Zha0q1 closed this Jun 14, 2019
@Zha0q1 Zha0q1 reopened this Jun 14, 2019
@sandeep-krishnamurthy sandeep-krishnamurthy merged commit 13cf5db into apache:master Jun 15, 2019
haohuanw pushed a commit to haohuanw/incubator-mxnet that referenced this pull request Jun 23, 2019
* add support for sorting and printing aggregate info in json

* revert some overwrites

* revert to old c apis; added MXAggregateProfileStatsPrintEx instead

* style fix

* style fixes

* more style fixes

* rebase

* style fixes

* fix infinite loop bug

* test cases added and bugs fixed

* fix test cases

* fix testcases

* testcases

* testcases

* testcases

* fix doc

* use enum to avoid hardcoding

* sanity test fix

* sanity test fix

* add parameter validation

* add parameter validation in frontend

* validation

* removing print()

* fix typos
@eric-haibin-lin
Copy link
Member

The ascending argument is great, but why is it missing the most important sort criteria "total time"? That's usually THE first thing people look at - what operator takes most of the time in a network. This is definitely a must-have for the 'sort-by' argument ..

@Zha0q1
Copy link
Contributor Author

Zha0q1 commented Aug 16, 2019

The ascending argument is great, but why is it missing the most important sort criteria "total time"? That's usually THE first thing people look at - what operator takes most of the time in a network. This is definitely a must-have for the 'sort-by' argument ..

Sure. I will create a pr and add "total_time" soon.

@Zha0q1
Copy link
Contributor Author

Zha0q1 commented Aug 17, 2019

The ascending argument is great, but why is it missing the most important sort criteria "total time"? That's usually THE first thing people look at - what operator takes most of the time in a network. This is definitely a must-have for the 'sort-by' argument ..

Sure. I will create a pr and add "total_time" soon.

will do this at my earliest availability after I come back from my trip. Now I don't have access to my laptop (back to US on aug 27, too many family events this week

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr-work-in-progress PR is still work in progress Profiler MXNet profiling issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants