8000 Cythonize concat method by unnonouno · Pull Request #2233 · chainer/chainer · GitHub
[go: up one dir, main page]

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

Cythonize concat method #2233

Merged
merged 5 commits into from
Feb 7, 2017
Merged

Cythonize concat method #2233

merged 5 commits into from
Feb 7, 2017

Conversation

unnonouno
Copy link
Member

Please merge #2144 before this pr.
Concat method is slow because it consumes to check arguments. I cythonized concat method.

@unnonouno unnonouno added CuPy Related to CuPy. cat:enhancement Implementation that does not break interfaces. labels Feb 5, 2017
@okuta okuta self-assigned this Feb 7, 2017
dtype = a.dtype
continue

have_same_types &= (a.dtype == dtype)
Copy link
Member

Choose a reason for hiding this comment

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

Please use and

@unnonouno unnonouno force-pushed the optimize-concat-method branch from 7c30490 to 52c0368 Compare February 7, 2017 06:43
@unnonouno
Copy link
Member Author
unnonouno commented Feb 7, 2017

Current array comparison is faster than shape[:axis] and shape[axis+1:] because cython optimizes it. The former is about 1.2ms and the later is about 1.7ms.

@unnonouno unnonouno changed the title [WIP] Cythonize concat method Cythonize concat method Feb 7, 2017
@unnonouno
Copy link
Member Author

I now get this result. The original implementation requires about 15ms. It is 10times faster!

CPU split_axis ... finished in 5.18ms
CPU concat ... finished in 3.27ms
copy to GPU ... finished in 6.92ms
GPU split_axis ... finished in 4.88ms
GPU concat ... finished in 1.15ms
copy to CPU ... finished in 1.21ms

@okuta okuta added this to the v1.21.0 milestone Feb 7, 2017
@okuta
Copy link
Member
okuta commented Feb 7, 2017

LGTM!

@okuta okuta merged commit 3fae314 into master Feb 7, 2017
@okuta okuta deleted the optimize-concat-method branch February 7, 2017 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat:enhancement Implementation that does not break interfaces. CuPy Related to CuPy.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0