jefffessler / linearmapsaa.jl Goto Github PK
View Code? Open in Web Editor NEWOverlay of LinearMaps.jl
License: MIT License
Overlay of LinearMaps.jl
License: MIT License
I've tested it locally with Julia 1.3 and the test passes, is that because you disabled Julia 1.3 test in travis? In this case, we could just switch to Github Actions.
My understanding is that "drop CI test for a version" doesn't necessarily mean "being incompatible with a version".
Said that, it's not a big issue to not bring 1.3-compatibility back since Julia 1.3 isn't an LTS version.
Tuple{Method, Method}[(-(A::LinearMapAX, B::AbstractMatrix) @ LinearMapsAA ~/.julia/dev/LinearMapsAA/src/lm-aa.jl:126, -(a::AbstractArray, b::StaticArraysCore.StaticArray) @ StaticArrays ~/.julia/packages/StaticArrays/9KYrc/src/linalg.jl:17), (+(A::LinearMapAX, B::AbstractMatrix) @ LinearMapsAA ~/.julia/dev/LinearMapsAA/src/lm-aa.jl:108, +(a::AbstractArray, b::StaticArraysCore.StaticArray) @ StaticArrays ~/.julia/packages/StaticArrays/9KYrc/src/linalg.jl:13), (+(A::AbstractMatrix, B::LinearMapAX) @ LinearMapsAA ~/.julia/dev/LinearMapsAA/src/lm-aa.jl:123, +(a::StaticArraysCore.StaticArray, b::AbstractArray) @ StaticArrays ~/.julia/packages/StaticArrays/9KYrc/src/linalg.jl:14), (-(A::AbstractMatrix, B::LinearMapAX) @ LinearMapsAA ~/.julia/dev/LinearMapsAA/src/lm-aa.jl:127, -(a::StaticArraysCore.StaticArray, b::AbstractArray) @ StaticArrays ~/.julia/packages/StaticArrays/9KYrc/src/linalg.jl:18)]
@JuliaRegistrator register()
@JuliaRegistrator register()
When running the following block of code
using LinearMapsAA
nx = 8
ny = 8
nz = 6
idim = (nx,ny,nz)
odim = (nx,ny,nz)
T = Float32
A = LinearMapAA(x -> 2 * x, y -> 2 * y, (prod(odim), prod(idim)); T, odim, idim)
A * CuArray(ones(T, nx, ny, nz))
it returns an array of type Array{Float32, 3}
not CuArray{Float32, 3}
.
So I am thinking that we should make the type of output and input to be consistent.
I am using Julia v1.6.3 on Ubuntu 20.04 and LinearMapsAA
@v0.10.0.
see
JuliaLinearAlgebra/LinearMaps.jl#118
like how I
works in LinearAlgebra
@JuliaRegistrator register()
Note to self: remove most (if not all?) the code in ambiguity.jl
after JuliaLang/julia#41188 is merged.
Probably not until Julia 1.8 ?
@JuliaRegistrator register()
@JuliaRegistrator register()
I found that LinearMapsAA
built on CuSPECTrecon
does not support CUDA.
Here is my test code:
using CuSPECTrecon
using LinearMapsAA
using CUDA
CUDA.allowscalar(false)
T = Float32
nx = 8; ny = nx
nz = 6
nview = 7
mumap = rand(T, nx, ny, nz)
px = 5
pz = 3
psfs = rand(T, px, pz, ny, nview)
psfs = psfs .+ mapslices(reverse, psfs, dims = [1, 2]) # symmetrize
psfs = psfs ./ mapslices(sum, psfs, dims = [1, 2])
dy = T(4.7952)
Cuimage = CuArray(zeros(T, nx, ny, nz))
Cuviews = CuArray(rand(T, nx, nz, nview))
Cumumap = CuArray(mumap)
Cupsfs = CuArray(psfs)
Cuplan = CuSPECTplan(Cumumap, Cupsfs, dy; T)
idim = (nx, ny, nz)
odim = (nx, nz, nview)
A = LinearMapAA(x -> Cuproject(x, Cuplan),
y -> Cubackproject(y, Cuplan),
(prod(odim), prod(idim));
idim = idim,
odim = odim,
T = Float32)
I can do both
mul!(Cuviews, A, Cuimage)
and
Cuviews = Cuproject(Cuimage, Cuplan)
but when I run
Cuviews = A * Cuimage
Julia throws me the following error:
Scalar indexing is disallowed.
Invocation of getindex resulted in scalar indexing of a GPU array.
This is typically caused by calling an iterating implementation of a method.
Such implementations *do not* execute on the GPU, but very slowly on the CPU,
and therefore are only permitted from the REPL for prototyping purposes.
If you did intend to index this array, annotate the caller with @allowscalar.
error(s::String) at error.jl:33
assertscalar(op::String) at indexing.jl:53
getindex(xs::CuArray{Float32, 3, CUDA.Mem.DeviceBuffer}, I::Int64) at indexing.jl:86
copyto_unaliased!(deststyle::IndexLinear, dest::SubArray{Float32, 1, Matrix{Float32}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}, srcstyle::IndexLinear, src::CuArray{Float32, 3, CUDA.Mem.DeviceBuffer}) at abstractarray.jl:1018
copyto!(dest::SubArray{Float32, 1, Matrix{Float32}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}, src::CuArray{Float32, 3, CUDA.Mem.DeviceBuffer}) at abstractarray.jl:998
_unsafe_mul!(y::SubArray{Float32, 1, Matrix{Float32}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}, A::LinearMaps.FunctionMap{Float32, LinearMapsAA.var"#6#10"{Tuple{Int64, Int64, Int64}, Tuple{Int64, Int64, Int64}, var"#9#11"}, LinearMapsAA.var"#8#12"{Tuple{Int64, Int64, Int64}, Tuple{Int64, Int64, Int64}, var"#10#12"}}, x::CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}) at functionmap.jl:114
mul! at LinearMaps.jl:163 [inlined]
_generic_mapvec_mul!(y::SubArray{Float32, 1, Matrix{Float32}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}, A::LinearMaps.FunctionMap{Float32, LinearMapsAA.var"#6#10"{Tuple{Int64, Int64, Int64}, Tuple{Int64, Int64, Int64}, var"#9#11"}, LinearMapsAA.var"#8#12"{Tuple{Int64, Int64, Int64}, Tuple{Int64, Int64, Int64}, var"#10#12"}}, x::CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}, α::Int64, β::Int64) at LinearMaps.jl:204
_unsafe_mul! at LinearMaps.jl:249 [inlined]
mul! at LinearMaps.jl:198 [inlined]
lm_mul! at multiply.jl:88 [inlined]
lmao_mul!(Y::Array{Float32, 3}, Lm::LinearMaps.FunctionMap{Float32, LinearMapsAA.var"#6#10"{Tuple{Int64, Int64, Int64}, Tuple{Int64, Int64, Int64}, var"#9#11"}, LinearMapsAA.var"#8#12"{Tuple{Int64, Int64, Int64}, Tuple{Int64, Int64, Int64}, var"#10#12"}}, X::CuArray{Float32, 3, CUDA.Mem.DeviceBuffer}, α::Int64, β::Int64; idim::Tuple{Int64, Int64, Int64}, odim::Tuple{Int64, Int64, Int64}) at multiply.jl:153
(::LinearMapsAA.var"#lmao_mul!##kw")(::NamedTuple{(:idim, :odim), Tuple{Tuple{Int64, Int64, Int64}, Tuple{Int64, Int64, Int64}}}, ::typeof(LinearMapsAA.lmao_mul!), Y::Array{Float32, 3}, Lm::LinearMaps.FunctionMap{Float32, LinearMapsAA.var"#6#10"{Tuple{Int64, Int64, Int64}, Tuple{Int64, Int64, Int64}, var"#9#11"}, LinearMapsAA.var"#8#12"{Tuple{Int64, Int64, Int64}, Tuple{Int64, Int64, Int64}, var"#10#12"}}, X::CuArray{Float32, 3, CUDA.Mem.DeviceBuffer}, α::Int64, β::Int64) at multiply.jl:136
lmax_mul(A::LinearMapAO{Float32, 3, 3, LinearMaps.FunctionMap{Float32, LinearMapsAA.var"#6#10"{Tuple{Int64, Int64, Int64}, Tuple{Int64, Int64, Int64}, var"#9#11"}, LinearMapsAA.var"#8#12"{Tuple{Int64, Int64, Int64}, Tuple{Int64, Int64, Int64}, var"#10#12"}}, NamedTuple{(), Tuple{}}}, X::CuArray{Float32, 3, CUDA.Mem.DeviceBuffer}) at multiply.jl:212
*(A::LinearMapAO{Float32, 3, 3, LinearMaps.FunctionMap{Float32, LinearMapsAA.var"#6#10"{Tuple{Int64, Int64, Int64}, Tuple{Int64, Int64, Int64}, var"#9#11"}, LinearMapsAA.var"#8#12"{Tuple{Int64, Int64, Int64}, Tuple{Int64, Int64, Int64}, var"#10#12"}}, NamedTuple{(), Tuple{}}}, X::CuArray{Float32, 3, CUDA.Mem.DeviceBuffer}) at multiply.jl:191
top-level scope at Cuautodiff.jl:36
eval at boot.jl:373 [inlined]
@JuliaRegistrator register()
@JuliaRegistrator register()
@JuliaRegistrator register()
@JuliaRegistrator register()
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
@JuliaRegistrator register()
Consider using _cat
parroting
https://github.com/Jutho/LinearMaps.jl/pull/114/files
@JuliaRegistrator register()
I was trying to explore functionality mentioned in this comment JuliaLinearAlgebra/LinearMaps.jl#44 (comment), but couldn't figure out how to create a LinearMapAO
(or LinearMapAX
). Is there an example available somewhere?
See JuliaLang/julia#48004
May need to revise to improve stability and performance.
@JuliaRegistrator register()
@JuliaRegistrator register()
A very general linear mapping could map between vectors spaces defined by arrays of arrays.
This could be useful, e.g., for dynamic MRI where it might be more natural to have the time sequence of 3D images be stored as a vector of 3D arrays, rather than as a 4D array, and the corresponding k-space data could also be a vector of arrays, especially if the number of k-space samples varies between frames.
This extension would require something more general than idim
and odim
to describe the input and output "dimensions." Tuples of Dim
s?
@JuliaRegistrator register()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.