Skip to content
This repository has been archived by the owner on Mar 12, 2021. It is now read-only.

broadcast for ^ #325

Merged
merged 16 commits into from
May 15, 2019
Merged

broadcast for ^ #325

merged 16 commits into from
May 15, 2019

Conversation

chengchingwen
Copy link
Contributor

broadcast ^ for CuArray since there is no Base.pow

src/broadcast.jl Outdated Show resolved Hide resolved
@vchuravy
Copy link
Member

Thank you!

Co-Authored-By: chengchingwen <[email protected]>
@vchuravy
Copy link
Member

bors try

bors bot added a commit that referenced this pull request Apr 23, 2019
@chengchingwen
Copy link
Contributor Author

I only add :^ to _cufuncs without literal_pow because I think no one would manually call the literal_pow

@bors
Copy link
Contributor

bors bot commented Apr 23, 2019

try

Build succeeded

@vchuravy
Copy link
Member

Can you open a PR to CUDAnative with the definition for CUDAnative.pow(x::Union{Float32, Float64}, y::Int64) = CUDAnative.pow(x, Int32(y))? Otherwise this looks GTM.

chengchingwen added a commit to chengchingwen/CUDAnative.jl that referenced this pull request Apr 24, 2019
@maleadt
Copy link
Member

maleadt commented Apr 25, 2019

I guess this depends on JuliaGPU/CUDAnative.jl#394?
bors try
We should probably conditionalize the test, or use an Int32 exponent to have it work on a released version of CUDAnative.

bors bot added a commit that referenced this pull request Apr 25, 2019
@chengchingwen
Copy link
Contributor Author

@bors
Copy link
Contributor

bors bot commented Apr 25, 2019

try

Build failed

@chengchingwen
Copy link
Contributor Author

@maleadt I use Int32 in culiteral_pow so that it didn't need JuliaGPU/CUDAnative.jl#394.

@chengchingwen
Copy link
Contributor Author

Since this PR was only meant to handle the problem of broadcasting ^, I guess it would better to change as less code as possible and leave the type problem to CUDAnative

@chengchingwen
Copy link
Contributor Author

@maleadt I also add the diffrule for pow, so now it can work with the ForwardDiff.

@maleadt
Copy link
Member

maleadt commented May 2, 2019

Should we have a test for the ForwardDiff logic?
I'm not too familiar with this code though, so @vchuravy or @MikeInnes please merge if this is OK.

@MikeInnes
Copy link
Collaborator

Looks generally good. Testing a bit more comprehensively would be nice, but since there's no ForwardDiff test setup right now AFAIK that may be a big ask. Are we testing the various literal / non-literal power cases?

There's also a merge conflict that needs fixing.

@chengchingwen
Copy link
Contributor Author

@MikeInnes the conflict is because the master of CuArrays move ForwardDiff to another file, so I just merge the master of CuArrays to this PR. Since the ForwardDiff is now using with the Require, are there any way to test it?

@MikeInnes
Copy link
Collaborator

You could add ForwardDiff as a test dependency. Honestly it might just be better to have it as a regular dependency at this point; I would want to check that the other maintainers don't object, though.

@maleadt
Copy link
Member

maleadt commented May 2, 2019

Honestly it might just be better to have it as a regular dependency at this point; I would want to check that the other maintainers don't object, though.

I moved it out to reduce the set of dependencies to test CuArrays on my development system. Requires makes much sense here IMO, wouldn't it be equivalent to add some CI rule to make sure ForwardDiff is installed?

@chengchingwen
Copy link
Contributor Author

chengchingwen commented May 2, 2019

@MikeInnes I could try to add some tests for ForwardDiff with CuArrays, but I'm totally unfamiliar with ForwardDiff. The implementation of pow was tested with Tracker. Could you give me some guide on how to do it?

@chengchingwen
Copy link
Contributor Author

So I finally find a way to test all the ForwardDiff and also fix some function that are not able to use the diffrule directly (due to calling the native function with literal number/Int64)

@chengchingwen
Copy link
Contributor Author

@MikeInnes Anything else to do here?

@maleadt
Copy link
Member

maleadt commented May 14, 2019

bors r+

bors bot added a commit that referenced this pull request May 14, 2019
325: broadcast for ^ r=maleadt a=chengchingwen

broadcast `^` for `CuArray` since there is no `Base.pow`

Co-authored-by: chengchingwen <[email protected]>
Co-authored-by: Valentin Churavy <[email protected]>
@bors
Copy link
Contributor

bors bot commented May 14, 2019

Build failed

@chengchingwen
Copy link
Contributor Author

@maleadt Could you try again, this should pass all the test.

@maleadt
Copy link
Member

maleadt commented May 15, 2019

bors r+

bors bot added a commit that referenced this pull request May 15, 2019
325: broadcast for ^ r=maleadt a=chengchingwen

broadcast `^` for `CuArray` since there is no `Base.pow`

Co-authored-by: chengchingwen <[email protected]>
Co-authored-by: Valentin Churavy <[email protected]>
@bors
Copy link
Contributor

bors bot commented May 15, 2019

Build succeeded

@bors bors bot merged commit 4d9aeca into JuliaGPU:master May 15, 2019
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.

4 participants