Skip to content

Conversation

xukai92
Copy link

@xukai92 xukai92 commented Aug 15, 2019

No description provided.

@nalimilan
Copy link
Member

nalimilan commented Aug 20, 2019

Thanks. Unfortunately, I'm not sure this change is appropriate: for example, if a is a sparse matrix this will return a sparse matrix, which isn't the best type. I'm not sure what's the right approach here, maybe you can ask to CuArrays.jl people?

@maleadt
Copy link

maleadt commented Aug 29, 2019

We don't have a similar but dense interface right now. Maybe collect(similar(...)) ought to fullfill that role? Currently, collect(CUDA array) yields an Array, but I think it would make sense to have that return a CuArray (e.g. to get a dense CuArray from a sparse CuArray).

@nalimilan
Copy link
Member

Unfortunately collect() will make a copy, which would be absurd since values are uninitialized. Looks like we need another interface.

@nalimilan
Copy link
Member

See also JuliaLang/LinearAlgebra.jl#271. There Matt suggested introducing an allocate function which would allow specifying much more precisely what properties are expected from the resulting object. Somebody should really revive that idea.

@xukai92
Copy link
Author

xukai92 commented Sep 16, 2019

I see.

Is the only edge case being sparse matrices? If so maybe we can implement something similar to result_type and deal with them explicitly?

@nalimilan
Copy link
Member

Sparse arrays are just an example. A PooledArray{Float64} could also be passed, yet we wouldn't want to return a PooledArray.

Can you file an issue in Julia? If we can agree on an API, it could be added to Compat so that we can use it in current Julia versions.

@xukai92
Copy link
Author

xukai92 commented Sep 22, 2019

Opned JuliaLang/julia#33361.

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.

3 participants