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

Implement isequal #405

Merged
merged 1 commit into from
Apr 11, 2022
Merged

Implement isequal #405

merged 1 commit into from
Apr 11, 2022

Conversation

danielwe
Copy link
Contributor

@danielwe danielwe commented Apr 7, 2022

I thought maybe it would be good to have isequal work for GPU arrays? The AbstractArray fallback contains an explicit loop, so without this PR, isequal(::AnyGPUArray, ::AnyGPUArray) hits scalar indexing.

I also added some tests for == and isequal, including edge cases where they differ.

PS. Note that isapprox is also broken for GPU arrays whenever isfinite(norm(A - B)) == false (e.g., when the arrays contain Infs or NaNs) because the elementwise fallback iterates sequentially. I've proposed that this be fixed in base: JuliaLang/julia#44893. However, if this is rejected on account of performance I guess GPUArrays.jl should get it's own isapprox as well.

@maleadt
Copy link
Member

maleadt commented Apr 11, 2022

Thanks, this looks like a good operation to support indeed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants