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

Write differentce of reduction functions #144

Merged
merged 3 commits into from Jul 25, 2017
Merged

Conversation

unnonouno
Copy link
Contributor

I wrote difference of reduction functions in the document.

@unnonouno unnonouno added cat:document Documentation to-be-backported Pull-requests to be backported to stable branch labels Jun 15, 2017
@niboshi
Copy link
Member

niboshi commented Jun 15, 2017

You are using the term scalar value in two different meanings.
The first use is NumPy's scalar, e.g. numpy.int64, whereas the others mean Python's scalar values e.g. int, right?

Essentially we could implement cupy.int64 which is the GPU counterpart of numpy.int64 (not an alias of numpy.int64 as currently is). The problem is that we don't have it. So, maybe you'd better explain why we don't?

@unnonouno
Copy link
Contributor Author

Ah, We can make cupy.int64 as a scalar value allocated on GPU. Do we need to make such a type?

@niboshi
Copy link
Member

niboshi commented Jun 23, 2017

Ah, We can make cupy.int64 as a scalar value allocated on GPU. Do we need to make such a type?

@okuta Do you have any idea?

@okuta
Copy link
Member

okuta commented Jun 24, 2017

Sometimes, NumPy scalar type cause miracle problem.
We can use cupy.array(1, numpy.int32). Is it not enough?

@unnonouno
Copy link
Contributor Author

You mean, NumPy scalar behaves inconsistently, and it is not reasonable to make CuPy scalar type which behaves like Numpy Scalar, right?

@unnonouno
Copy link
Contributor Author

I updated it. How about this?

@okuta
Copy link
Member

okuta commented Jul 12, 2017

Yes, I agree your opinion.

And, document of this PR is good. Can I merge this?

@okuta okuta added this to the v2.0.0b1 milestone Jul 12, 2017
@niboshi
Copy link
Member

niboshi commented Jul 12, 2017

Content looks good, but i feel it could be grammatically improved.
How about this?

NumPy reduction functions (e.g. :func:numpy.sum) return scalar values (e.g. :class:numpy.float32).
However, CuPy counterparts return zero-dimensional :class:cupy.ndarrays. That's because CuPy scalar values (e.g. :class:cupy.float32) are allocated in CPU memory. If these types were returned, it would be required to synchronize between GPU and CPU.
If you want scalar values, cast the returned arrays explicitly.

@okuta
Copy link
Member

okuta commented Jul 12, 2017

Now, cupy.float32 is completely same numpy.float32. Using numpy.float32 is better.
I think it is possible to make better CuPy scalar in the future.

@okuta okuta self-assigned this Jul 12, 2017
@niboshi niboshi mentioned this pull request Jul 18, 2017
@okuta
Copy link
Member

okuta commented Jul 25, 2017

LGTM!

@okuta okuta merged commit 02c2646 into master Jul 25, 2017
@okuta okuta deleted the difference-reduction branch July 25, 2017 09:21
okuta added a commit that referenced this pull request Jul 25, 2017
Write differentce of reduction functions
okuta added a commit that referenced this pull request Jul 25, 2017
Write differentce of reduction functions
@niboshi
Copy link
Member

niboshi commented Jul 25, 2017

This PR is causing doc-test failure in jenkins.
Could you make a quick fix or revert?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat:document Documentation to-be-backported Pull-requests to be backported to stable branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants