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

Missing S keyword for opRestriction #323

Closed
nHackel opened this issue Apr 11, 2024 · 2 comments · Fixed by #324
Closed

Missing S keyword for opRestriction #323

nHackel opened this issue Apr 11, 2024 · 2 comments · Fixed by #324

Comments

@nHackel
Copy link
Contributor

nHackel commented Apr 11, 2024

Hello, I've run into an issue where the opRestriction and in turn the opExtension constructors don't have an S keyword argument. While the operator on its own works with GPU arrays, this causes an issue when trying to build composite ops for a GPU:

julia> using LinearOperators, CUDA

julia> x = CUDA.rand(256);

julia> op = opRestriction(1:128, 256);

julia> op * x # works

julia> (op * opDiagonal(x)) * x # fails
@dpo
Copy link
Member

dpo commented Apr 12, 2024

Could you please show the error message?

@nHackel
Copy link
Contributor Author

nHackel commented Apr 12, 2024

The error is:

julia> (op * opDiagonal(x)) * x
ERROR: LinearOperatorException("storage types cannot be promoted to a concrete type")
Stacktrace:
 [1] *(op1::LinearOperator{Int64, Int64, LinearOperators.var"#156#158"{UnitRange{Int64}}, LinearOperators.var"#157#159"{UnitRange{Int64}}, LinearOperators.var"#157#159"{UnitRange{Int64}}, Vector{Int64}}, op2::LinearOperator{Float32, Int64, LinearOperators.var"#146#148"{CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}}, LinearOperators.var"#146#148"{CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}}, LinearOperators.var"#147#149"{typeof(conj), CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}}, CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}})
   @ LinearOperators ~/.julia/dev/LinearOperators.jl/src/operations.jl:119
 [2] top-level scope
   @ REPL[5]:1
 [3] top-level scope
   @ ~/.julia/packages/CUDA/htRwP/src/initialization.jl:206

The storage_type of opRestriction is always Vector{Int64} without the added kwarg from #324

@dpo dpo closed this as completed in #324 Apr 20, 2024
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 a pull request may close this issue.

2 participants