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

Julia 1.5: no method matching elsize(::Type{SharedArray{Complex{Float64},4}}) #37438

Closed
atbug opened this issue Sep 6, 2020 · 3 comments
Closed
Labels
regression Regression in behavior compared to a previous version

Comments

@atbug
Copy link

atbug commented Sep 6, 2020

julia> using SharedArrays

julia> A = SharedArray{ComplexF64}(10, 10, 20, 3);

julia> coeffs = rand(ComplexF64, 20);

julia> reshape(view(A, :, :, :, 1), (100, :)) * coeffs
ERROR: MethodError: no method matching elsize(::Type{SharedArray{Complex{Float64},4}})
Closest candidates are:
  elsize(::Type{var"#s91"} where var"#s91"<:(Array{T,N} where N)) where T at array.jl:220
  elsize(::Base.CodeUnits{T,S} where S<:AbstractString) where T at strings/basic.jl:724
  elsize(::Random.UnsafeView{T}) where T at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Random\src\RNGs.jl:440
  ...
Stacktrace:
 [1] elsize(::SharedArray{Complex{Float64},4}) at .\abstractarray.jl:153
 [2] _memory_offset(::SharedArray{Complex{Float64},4}, ::Int64, ::Vararg{Int64,N} where N) at .\abstractarray.jl:1013
 [3] unsafe_convert(::Type{Ptr{Complex{Float64}}}, ::SubArray{Complex{Float64},3,SharedArray{Complex{Float64},4},Tuple{Base.Slice{Base.OneTo{Int64}},Base.Slice{Base.OneTo{Int64}},Base.Slice{Base.OneTo{Int64}},Int64},true}) at .\subarray.jl:405
 [4] unsafe_convert(::Type{Ptr{Complex{Float64}}}, ::Base.ReshapedArray{Complex{Float64},2,SubArray{Complex{Float64},3,SharedArray{Complex{Float64},4},Tuple{Base.Slice{Base.OneTo{Int64}},Base.Slice{Base.OneTo{Int64}},Base.Slice{Base.OneTo{Int64}},Int64},true},Tuple{}}) at .\reshapedarray.jl:281
 [5] gemv!(::Char, ::Complex{Float64}, ::Base.ReshapedArray{Complex{Float64},2,SubArray{Complex{Float64},3,SharedArray{Complex{Float64},4},Tuple{Base.Slice{Base.OneTo{Int64}},Base.Slice{Base.OneTo{Int64}},Base.Slice{Base.OneTo{Int64}},Int64},true},Tuple{}}, ::Array{Complex{Float64},1}, ::Complex{Float64}, ::Array{Complex{Float64},1}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\blas.jl:626
 [6] gemv!(::Array{Complex{Float64},1}, ::Char, ::Base.ReshapedArray{Complex{Float64},2,SubArray{Complex{Float64},3,SharedArray{Complex{Float64},4},Tuple{Base.Slice{Base.OneTo{Int64}},Base.Slice{Base.OneTo{Int64}},Base.Slice{Base.OneTo{Int64}},Int64},true},Tuple{}}, ::Array{Complex{Float64},1}, ::Bool, ::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\matmul.jl:470
 [7] mul! at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\matmul.jl:66 [inlined]
 [8] mul! at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\matmul.jl:208 [inlined]
 [9] *(::Base.ReshapedArray{Complex{Float64},2,SubArray{Complex{Float64},3,SharedArray{Complex{Float64},4},Tuple{Base.Slice{Base.OneTo{Int64}},Base.Slice{Base.OneTo{Int64}},Base.Slice{Base.OneTo{Int64}},Int64},true},Tuple{}}, ::Array{Complex{Float64},1}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\matmul.jl:51
 [10] top-level scope at REPL[20]:1
 [11] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1088

julia> versioninfo()
Julia Version 1.5.1
Commit 697e782ab8 (2020-08-25 20:08 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
Environment:
  JULIA_EDITOR = "C:\Users\atbug\AppData\Local\Programs\Microsoft VS Code\Code.exe"
  JULIA_NUM_THREADS =

Used to work with julia 1.4.

@KristofferC
Copy link
Member

Ref #36553

@KristofferC KristofferC added the regression Regression in behavior compared to a previous version label Sep 6, 2020
vtjnash added a commit that referenced this issue Oct 21, 2020
@severinson
Copy link

severinson commented Oct 22, 2020

Would defining the following in SharedArrays.jl be a good solution? Doing so solves the problem for me.
Base.elsize(S::SharedArray) = Base.elsize(sdata(S))

@atbug
Copy link
Author

atbug commented Oct 22, 2020

I am doing

if VERSION >= v"1.5.0"
    Base.elsize(::Type{SharedArray{T,N}}) where {T,N} = sizeof(T)
end

vtjnash added a commit that referenced this issue Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression Regression in behavior compared to a previous version
Projects
None yet
Development

No branches or pull requests

3 participants