Code Monkey home page Code Monkey logo

linearmapsaa.jl's Introduction

GitHub stats

linearmapsaa.jl's People

Contributors

dependabot[bot] avatar jefffessler avatar juliatagbot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

linearmapsaa.jl's Issues

why is Julia 1.3 incompatible?

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.

method ambiguities

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)]

return GPU arrays

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.

LinearMapsAA is not CUDA compatible?

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]

TagBot trigger issue

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!

Support arrays of arrays?

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 Dims?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.