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

Speed up group executor #16069

Merged
merged 3 commits into from
Sep 6, 2019
Merged

Speed up group executor #16069

merged 3 commits into from
Sep 6, 2019

Conversation

doronsinger
Copy link
Contributor

Description

We ran into an issue where mxnet took over 15 minutes of real-time to process large symbols, this change was the root cause. The square-brackets implementation of symbol looks up the symbol using a loop, so the implementation was O(n^2) where it should have been O(n)

Current implementation is O(n^2), this implementation is O(n)
for name in self.output_names]
self.num_outputs = len(self.symbol.list_outputs())
self.num_outputs = len(self.output_names)
self.output_layouts = [i for i in range(self.num_outputs)]
Copy link
Member

Choose a reason for hiding this comment

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

Thank you for the contribution!
The following code may be faster : )

        self.num_outputs = len(self.output_names)
        self.output_layouts = [DataDesc.get_batch_axis(self.symbol[index].attr('__layout__'))
                               for index in range(self.num_outputs)]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

Current implementation is O(n^2), this implementation is O(n)
Copy link
Member

@wkcn wkcn left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you : )

@wkcn wkcn added pr-awaiting-review PR is waiting for code review Python Performance labels Sep 5, 2019
@marcoabreu marcoabreu merged commit e98dbe7 into apache:master Sep 6, 2019
gyshi pushed a commit to gyshi/incubator-mxnet that referenced this pull request Sep 7, 2019
* Speed up group executor

Current implementation is O(n^2), this implementation is O(n)

* Speed up group executor

Current implementation is O(n^2), this implementation is O(n)

* CI
gyshi pushed a commit to gyshi/incubator-mxnet that referenced this pull request Sep 7, 2019
* Speed up group executor

Current implementation is O(n^2), this implementation is O(n)

* Speed up group executor

Current implementation is O(n^2), this implementation is O(n)

* CI
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Performance pr-awaiting-review PR is waiting for code review Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants