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

Loading ChainRulesCore.jl breaks complex number arithmetic on Julia 1.8.1 #588

Closed
mtenders opened this issue Sep 21, 2022 · 7 comments · Fixed by #589
Closed

Loading ChainRulesCore.jl breaks complex number arithmetic on Julia 1.8.1 #588

mtenders opened this issue Sep 21, 2022 · 7 comments · Fixed by #589

Comments

@mtenders
Copy link

mtenders commented Sep 21, 2022

Hi,

I'm running ChainRulesCore.jl with Julia 1.8.1. I get an error when I run the following (supposedly) simple code:

julia> using ChainRulesCore

julia> a = Complex[1, 1]
2-element Vector{Complex}:
 1 + 0im
 1 + 0im

julia> b = Complex.([1,1])
2-element Vector{Complex{Int64}}:
 1 + 0im
 1 + 0im

julia> a .* b .- b
ERROR: - not defined for Complex{Int64}
Stacktrace:
 [1] error(::String, ::String, ::Type)
   @ Base ./error.jl:44
 [2] no_op_err(name::String, T::Type)
   @ Base ./promotion.jl:462
 [3] -(x::Complex{Int64}, y::Complex{Int64})
   @ Base ./promotion.jl:465
 [4] _broadcast_getindex_evalf
   @ ./broadcast.jl:670 [inlined]
 [5] _broadcast_getindex
   @ ./broadcast.jl:643 [inlined]
 [6] getindex
   @ ./broadcast.jl:597 [inlined]
 [7] copy
   @ ./broadcast.jl:899 [inlined]
 [8] materialize(bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(-), Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(*), Tuple{Vector{Complex}, Vector{Complex{Int64}}}}, Vector{Complex{Int64}}}})
   @ Base.Broadcast ./broadcast.jl:860
 [9] top-level scope
   @ REPL[4]:1

I tested the same example with Julia 1.7.2 and it seemed to work just fine.

Also the following examples don't give me any errors:

julia> a .* b - b
2-element Vector{Complex{Int64}}:
 0 + 0im
 0 + 0im

julia> a .- b
2-element Vector{Complex{Int64}}:
 0 + 0im
 0 + 0im

Everything works normally if I don't load ChainRulesCore in the beginning.

The last version where the code above works is v0.10.13 (last release before v1.0.0). Do you have any idea where this could be coming from?

P.S. I came across this problem, while using Interpolations.jl and first filed an issue there (JuliaMath/Interpolations.jl/issues/520)

@mzgubic
Copy link
Member

mzgubic commented Sep 21, 2022

I can't reproduce this error on a Mac. Somewhat nuclear option, but have you tried reinstalling julia?

@mtenders
Copy link
Author

I just tried again with fresh installs of 1.8.1 and could reproduce the error on Ubuntu and Windows 10. See my versioninfo() outputs below.

On Ubuntu:

julia> versioninfo()
Julia Version 1.8.1
Commit afb6c60d69a (2022-09-06 15:09 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 16 × AMD Ryzen 7 4800H with Radeon Graphics
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, znver2)
  Threads: 1 on 16 virtual cores

On Windows:

julia> versioninfo()
Julia Version 1.8.1
Commit afb6c60d69 (2022-09-06 15:09 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 12 × Intel(R) Core(TM) i5-10500 CPU @ 3.10GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
  Threads: 1 on 12 virtual cores

@devmotion
Copy link
Member

I can reproduce the problem:

❯ julia --startup-file=no -i -e "using Pkg; Pkg.activate(; temp=true)"
  Activating new project at `/tmp/jl_zrF75x`
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.8.1 (2022-09-06)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> a = Complex[1, 1]
2-element Vector{Complex}:
 1 + 0im
 1 + 0im

julia> b = Complex.([1,1])
2-element Vector{Complex{Int64}}:
 1 + 0im
 1 + 0im

julia> a .* b .- b
2-element Vector{Complex{Int64}}:
 0 + 0im
 0 + 0im

julia> using ChainRulesCore
 │ Package ChainRulesCore not found, but a package named ChainRulesCore is available from a registry. 
 │ Install package?
 │   (jl_zrF75x) pkg> add ChainRulesCore 
 └ (y/n/o) [y]: y
    Updating registry at `~/.julia/registries/General.toml`
    Updating registry at `~/.julia/registries/PumasRegistry.toml`
   Resolving package versions...
    Updating `/tmp/jl_zrF75x/Project.toml`
  [d360d2e6] + ChainRulesCore v1.15.5
    Updating `/tmp/jl_zrF75x/Manifest.toml`
  [d360d2e6] + ChainRulesCore v1.15.5
  [34da2185] + Compat v4.2.0
  [56f22d72] + Artifacts
  [ade2ca70] + Dates
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [de0858da] + Printf
  [9a3f8284] + Random
  [ea8e919c] + SHA v0.7.0
  [9e88b42a] + Serialization
  [2f01184e] + SparseArrays
  [cf7118a7] + UUIDs
  [4ec0a83e] + Unicode
  [e66e0078] + CompilerSupportLibraries_jll v0.5.2+0
  [4536629a] + OpenBLAS_jll v0.3.20+0
  [8e850b90] + libblastrampoline_jll v5.1.1+0

julia> a = Complex[1, 1]
2-element Vector{Complex}:
 1 + 0im
 1 + 0im

julia> b = Complex.([1,1])
2-element Vector{Complex{Int64}}:
 1 + 0im
 1 + 0im

julia> a .* b .- b
ERROR: - not defined for Complex{Int64}
Stacktrace:
 [1] error(::String, ::String, ::Type)
   @ Base ./error.jl:44
 [2] no_op_err(name::String, T::Type)
   @ Base ./promotion.jl:462
 [3] -(x::Complex{Int64}, y::Complex{Int64})
   @ Base ./promotion.jl:465
 [4] _broadcast_getindex_evalf
   @ ./broadcast.jl:670 [inlined]
 [5] _broadcast_getindex
   @ ./broadcast.jl:643 [inlined]
 [6] getindex
   @ ./broadcast.jl:597 [inlined]
 [7] copy
   @ ./broadcast.jl:899 [inlined]
 [8] materialize(bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(-), Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(*), Tuple{Vector{Complex}, Vector{Complex{Int64}}}}, Vector{Complex{Int64}}}})
   @ Base.Broadcast ./broadcast.jl:860
 [9] top-level scope
   @ REPL[7]:1

I use the official binaries on Linux (installed with juliaup):

julia> versioninfo()
Julia Version 1.8.1
Commit afb6c60d69a (2022-09-06 15:09 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, tigerlake)
  Threads: 3 on 8 virtual cores
Environment:
  JULIA_NUM_THREADS = 3

@devmotion
Copy link
Member

Not sure why this happens but one additional evidence that ChainRulesCore breaks something:

julia> f(a, b) = a .* b .- b
f (generic function with 1 method)

julia> @code_typed f(a, b)
CodeInfo(
1 ── %1   = Base.arraysize(a, 1)::Int64%2   = Base.slt_int(%1, 0)::Bool%3   = Core.ifelse::typeof(Core.ifelse)
│    %4   = (%3)(%2, 0, %1)::Int64%5   = %new(Base.OneTo{Int64}, %4)::Base.OneTo{Int64}%6   = Base.arraysize(b, 1)::Int64%7   = Base.slt_int(%6, 0)::Bool%8   = Core.ifelse::typeof(Core.ifelse)
│    %9   = (%8)(%7, 0, %6)::Int64%10  = %new(Base.OneTo{Int64}, %9)::Base.OneTo{Int64}%11  = (%9 === %4)::Bool
└───        goto #3 if not %11
2 ──        goto #4
3 ── %14  = (%4 === 1)::Bool
└───        goto #4
4 ┄─ %16  = φ (#2 => %11, #3 => %14)::Bool
└───        goto #6 if not %16
5 ──        goto #12
6 ── %19  = (%4 === %9)::Bool
└───        goto #8 if not %19
7 ──        goto #9
8 ── %22  = (%9 === 1)::Bool
└───        goto #9
9 ┄─ %24  = φ (#7 => %19, #8 => %22)::Bool
└───        goto #11 if not %24
10 ─        goto #12
11%27  = invoke Base.print_to_string("arrays could not be broadcast to a common size; got a dimension with lengths "::String, %4::Vararg{Any}, " and ", %9)::String%28  = Base.Broadcast.DimensionMismatch(%27)::Any
│           Base.Broadcast.throw(%28)::Union{}
└───        unreachable
12%31  = φ (#5 => %9, #10 => %4)::Int64%32  = φ (#5 => %9, #10 => %4)::Int64%33  = φ (#5 => %9, #10 => %4)::Int64%34  = φ (#5 => %9, #10 => %4)::Int64%35  = φ (#5 => %9, #10 => %4)::Int64%36  = φ (#5 => %9, #10 => %4)::Int64%37  = φ (#5 => %9, #10 => %4)::Int64%38  = φ (#5 => %10, #10 => %5)::Base.OneTo{Int64}
└───        goto #13
13 ─        goto #14
14 ─        goto #15
15 ─        goto #16
16 ─        goto #17
17%44  = Base.arraysize(b, 1)::Int64%45  = Base.slt_int(%44, 0)::Bool%46  = Core.ifelse::typeof(Core.ifelse)
│    %47  = (%46)(%45, 0, %44)::Int64%48  = %new(Base.OneTo{Int64}, %47)::Base.OneTo{Int64}%49  = (%47 === %31)::Bool
└───        goto #19 if not %49
18 ─        goto #20
19%52  = (%32 === 1)::Bool
└───        goto #20
20%54  = φ (#18 => %49, #19 => %52)::Bool
└───        goto #22 if not %54
21 ─        goto #28
22%57  = (%33 === %47)::Bool
└───        goto #24 if not %57
23 ─        goto #25
24%60  = (%47 === 1)::Bool
└───        goto #25
25%62  = φ (#23 => %57, #24 => %60)::Bool
└───        goto #27 if not %62
26 ─        goto #28
27%65  = invoke Base.print_to_string("arrays could not be broadcast to a common size; got a dimension with lengths "::String, %34::Vararg{Any}, " and ", %47)::String%66  = Base.Broadcast.DimensionMismatch(%65)::Any
│           Base.Broadcast.throw(%66)::Union{}
└───        unreachable
28%69  = φ (#21 => %47, #26 => %35)::Int64%70  = φ (#21 => %47, #26 => %36)::Int64%71  = φ (#21 => %47, #26 => %37)::Int64%72  = φ (#21 => %48, #26 => %38)::Base.OneTo{Int64}%73  = Core.tuple(%72)::Tuple{Base.OneTo{Int64}}
└───        goto #29
29 ─        goto #30
30 ─        goto #31
31 ─        goto #32
32%78  = Base.arraysize(a, 1)::Int64%79  = Base.slt_int(%78, 0)::Bool%80  = Core.ifelse::typeof(Core.ifelse)
│    %81  = (%80)(%79, 0, %78)::Int64%82  = (%81 === 1)::Bool%83  = Base.not_int(%82)::Bool%84  = Core.tuple(%83)::Tuple{Bool}%85  = %new(Base.Broadcast.Extruded{Vector{Complex}, Tuple{Bool}, Tuple{Int64}}, a, %84, (1,))::Base.Broadcast.Extruded{Vector{Complex}, Tuple{Bool}, Tuple{Int64}}%86  = Base.arraysize(b, 1)::Int64%87  = Base.slt_int(%86, 0)::Bool%88  = Core.ifelse::typeof(Core.ifelse)
│    %89  = (%88)(%87, 0, %86)::Int64%90  = (%89 === 1)::Bool%91  = Base.not_int(%90)::Bool%92  = Core.tuple(%91)::Tuple{Bool}%93  = %new(Base.Broadcast.Extruded{Vector{Complex{Int64}}, Tuple{Bool}, Tuple{Int64}}, b, %92, (1,))::Base.Broadcast.Extruded{Vector{Complex{Int64}}, Tuple{Bool}, Tuple{Int64}}%94  = Core.tuple(%85, %93)::Tuple{Base.Broadcast.Extruded{Vector{Complex}, Tuple{Bool}, Tuple{Int64}}, Base.Broadcast.Extruded{Vector{Complex{Int64}}, Tuple{Bool}, Tuple{Int64}}}
│    %95  = %new(Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(*), Tuple{Base.Broadcast.Extruded{Vector{Complex}, Tuple{Bool}, Tuple{Int64}}, Base.Broadcast.Extruded{Vector{Complex{Int64}}, Tuple{Bool}, Tuple{Int64}}}}, *, %94, nothing)::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(*), Tuple{Base.Broadcast.Extruded{Vector{Complex}, Tuple{Bool}, Tuple{Int64}}, Base.Broadcast.Extruded{Vector{Complex{Int64}}, Tuple{Bool}, Tuple{Int64}}}}
│    %96  = Base.arraysize(b, 1)::Int64%97  = Base.slt_int(%96, 0)::Bool%98  = Core.ifelse::typeof(Core.ifelse)
│    %99  = (%98)(%97, 0, %96)::Int64%100 = (%99 === 1)::Bool%101 = Base.not_int(%100)::Bool%102 = Core.tuple(%101)::Tuple{Bool}%103 = %new(Base.Broadcast.Extruded{Vector{Complex{Int64}}, Tuple{Bool}, Tuple{Int64}}, b, %102, (1,))::Base.Broadcast.Extruded{Vector{Complex{Int64}}, Tuple{Bool}, Tuple{Int64}}%104 = Core.tuple(%95, %103)::Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(*), Tuple{Base.Broadcast.Extruded{Vector{Complex}, Tuple{Bool}, Tuple{Int64}}, Base.Broadcast.Extruded{Vector{Complex{Int64}}, Tuple{Bool}, Tuple{Int64}}}}, Base.Broadcast.Extruded{Vector{Complex{Int64}}, Tuple{Bool}, Tuple{Int64}}}
│    %105 = %new(Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Tuple{Base.OneTo{Int64}}, typeof(-), Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(*), Tuple{Base.Broadcast.Extruded{Vector{Complex}, Tuple{Bool}, Tuple{Int64}}, Base.Broadcast.Extruded{Vector{Complex{Int64}}, Tuple{Bool}, Tuple{Int64}}}}, Base.Broadcast.Extruded{Vector{Complex{Int64}}, Tuple{Bool}, Tuple{Int64}}}}, -, %104, %73)::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Tuple{Base.OneTo{Int64}}, typeof(-), Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(*), Tuple{Base.Broadcast.Extruded{Vector{Complex}, Tuple{Bool}, Tuple{Int64}}, Base.Broadcast.Extruded{Vector{Complex{Int64}}, Tuple{Bool}, Tuple{Int64}}}}, Base.Broadcast.Extruded{Vector{Complex{Int64}}, Tuple{Bool}, Tuple{Int64}}}}
│    %106 = Base.slt_int(%69, 1)::Bool
└───        goto #34 if not %106
33 ─        Base.nothing::Nothing
└───        goto #35
34 ─        goto #35
35%111 = φ (#33 => true, #34 => false)::Bool%112 = φ (#34 => 1)::Int64%113 = φ (#34 => 1)::Int64
└───        goto #37 if not %111
36%115 = $(Expr(:foreigncall, :(:jl_alloc_array_1d), Vector{Any}, svec(Any, Int64), 0, :(:ccall), Vector{Any}, :(%70), :(%70)))::Vector{Any}
└───        goto #65
37 ─        goto #42 if not false
38%118 = Base.sle_int(1, %112)::Bool%119 = Base.sle_int(%112, %71)::Bool%120 = Base.and_int(%118, %119)::Bool%121 = Base.and_int(%120, true)::Bool
└───        goto #40 if not %121
39 ─        goto #41
40%124 = Base.throw_boundserror::typeof(Base.throw_boundserror)
│    %125 = Core.tuple(%112)::Tuple{Int64}
│           invoke %124(%105::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Tuple{Base.OneTo{Int64}}, typeof(-), Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(*), Tuple{Base.Broadcast.Extruded{Vector{Complex}, Tuple{Bool}, Tuple{Int64}}, Base.Broadcast.Extruded{Vector{Complex{Int64}}, Tuple{Bool}, Tuple{Int64}}}}, Base.Broadcast.Extruded{Vector{Complex{Int64}}, Tuple{Bool}, Tuple{Int64}}}}, %125::Tuple{Int64})::Union{}
└───        unreachable
41nothing::Nothing
42%129 = Core.ifelse::typeof(Core.ifelse)
│    %130 = (%129)(%83, %112, 1)::Int64%131 = Base.arrayref(false, a, %130)::Complex%132 = Core.ifelse::typeof(Core.ifelse)
│    %133 = (%132)(%91, %112, 1)::Int64%134 = Base.arrayref(false, b, %133)::Complex{Int64}%135 = (*)(%131, %134)::Any%136 = Core.ifelse::typeof(Core.ifelse)
│    %137 = (%136)(%101, %112, 1)::Int64%138 = Base.arrayref(false, b, %137)::Complex{Int64}%139 = (isa)(%135, Bool)::Bool
└───        goto #44 if not %139
43%141 = π (%135, Bool)
│    %142 = invoke -(%141::Bool, %138::Complex{Int64})::Any
└───        goto #55
44%144 = (isa)(%135, Complex{Int64})::Bool
└───        goto #46 if not %144
45%146 = π (%135, Complex{Int64})
│    %147 = invoke -(%146::Complex{Int64}, %138::Complex{Int64})::Any
└───        goto #55
46%149 = (isa)(%135, Missing)::Bool
└───        goto #48 if not %149
47%151 = π (%135, Missing)
│    %152 = invoke -(%151::Missing, %138::Complex{Int64})::Any
└───        goto #55
48%154 = (isa)(%135, NoTangent)::Bool
└───        goto #50 if not %154
49%156 = π (%135, NoTangent)
│    %157 = invoke -(%156::NoTangent, %138::Complex{Int64})::Any
└───        goto #55
50%159 = (isa)(%135, ChainRulesCore.NotImplemented)::Bool
└───        goto #52 if not %159
51%161 = π (%135, ChainRulesCore.NotImplemented)
│    %162 = invoke -(%161::ChainRulesCore.NotImplemented, %138::Complex{Int64})::Any
└───        goto #55
52%164 = (isa)(%135, ZeroTangent)::Bool
└───        goto #54 if not %164
53%166 = π (%135, ZeroTangent)
│    %167 = invoke -(%166::ZeroTangent, %138::Complex{Int64})::Any
└───        goto #55
54%169 = (-)(%135, %138)::Any
└───        goto #55
55%171 = φ (#43 => %142, #45 => %147, #47 => %152, #49 => %157, #51 => %162, #53 => %167, #54 => %169)::Any
└───        goto #56
56 ─        goto #57
57 ─        goto #58
58%175 = Base.Broadcast.typeof(%171)::DataType%176 = Base.Broadcast.similar(%105, %175)::Union{Vector, BitVector}
│           Base.setindex!(%176, %171, %112)::Any%178 = Core._typevar(Symbol("#s884"), Union{}, Any)::TypeVar%179 = (isa)(%176, BitVector)::Bool
└───        goto #60 if not %179
59 ─        goto #61
60%182 = Base.Broadcast.ndims(%176)::Int64
└───        goto #61
61%184 = φ (#59 => 1, #60 => %182)::Int64%185 = Core.apply_type(Base.Broadcast.AbstractArray, %178, %184)::Type{AbstractArray{var"#s884", 1}}%186 = $(Expr(:foreigncall, :(:jl_type_unionall), Any, svec(Any, Any), 0, :(:ccall), :(%178), :(%185)))::Type{AbstractVector}%187 = Base.Broadcast.copyto_nonleaf!::typeof(Base.Broadcast.copyto_nonleaf!)
│    %188 = (isa)(%176, BitVector)::Bool
└───        goto #63 if not %188
62%190 = π (%176, BitVector)
│    %191 = invoke %187(%190::BitVector, %105::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Tuple{Base.OneTo{Int64}}, typeof(-), Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(*), Tuple{Base.Broadcast.Extruded{Vector{Complex}, Tuple{Bool}, Tuple{Int64}}, Base.Broadcast.Extruded{Vector{Complex{Int64}}, Tuple{Bool}, Tuple{Int64}}}}, Base.Broadcast.Extruded{Vector{Complex{Int64}}, Tuple{Bool}, Tuple{Int64}}}}, %72::Base.OneTo{Int64}, %113::Int64, 1::Int64)::Any
└───        goto #64
63%193 = Base.Broadcast.copyto_nonleaf!(%176, %105, %72, %113, 1)::Any
└───        goto #64
64%195 = φ (#62 => %191, #63 => %193)::Any
│           Core.typeassert(%195, %186)::AbstractVector%197 = π (%195, AbstractVector)
└───        goto #65
65%199 = φ (#36 => %115, #64 => %197)::AbstractVector
└───        goto #66
66return %199
) => AbstractVector

@devmotion
Copy link
Member

I suspect the problem is that

  • a is not concretely typed,
  • therefore the compiler takes into account multiple possible return types of e.g. *(::Complex, ::Complex{Int64})
  • ChainRulesCore defines methods for e.g. *(::NotImplemented, ::Any) etc. (
    @eval Base.:*(x::NotImplemented, ::$T) = x
    @eval Base.:*(::$T, x::NotImplemented) = x
    and similar lines)

So the problem in ChainRulesCore seem to be these definitions for ::Any arguments. So this seems to be an example for when #448 causes issues in practice.

@devmotion
Copy link
Member

The issue will be fixed in Julia 1.8.2. With the binary from https://buildkite.com/organizations/julialang/pipelines/julia-release-1-dot-8/builds/231/jobs/018360eb-94e0-440a-a9c2-46347547d59b/artifacts/01836124-3b61-458a-b1f5-14197af7556e:

./bin/julia --startup-file=no -i -e "using Pkg; Pkg.activate(; temp=true)"
  Activating new project at `/tmp/jl_BtxVYm`
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.8.1 (2022-09-21)
 _/ |\__'_|_|_|\__'_|  |  release-1.8/4e8ce6178ca (fork: 357 commits, 217 days)
|__/                   |

julia> a = Complex[1, 1]
2-element Vector{Complex}:
 1 + 0im
 1 + 0im

julia> b = Complex.([1,1])
2-element Vector{Complex{Int64}}:
 1 + 0im
 1 + 0im

julia> a .* b .- b
2-element Vector{Complex{Int64}}:
 0 + 0im
 0 + 0im

julia> using ChainRulesCore
 │ Package ChainRulesCore not found, but a package named ChainRulesCore is available from a registry. 
 │ Install package?
 │   (jl_BtxVYm) pkg> add ChainRulesCore 
 └ (y/n/o) [y]: y
    Updating registry at `~/.julia/registries/General.toml`
    Updating registry at `~/.julia/registries/PumasRegistry.toml`
   Resolving package versions...
    Updating `/tmp/jl_BtxVYm/Project.toml`
  [d360d2e6] + ChainRulesCore v1.15.5
    Updating `/tmp/jl_BtxVYm/Manifest.toml`
  [d360d2e6] + ChainRulesCore v1.15.5
  [34da2185] + Compat v4.2.0
  [56f22d72] + Artifacts
  [ade2ca70] + Dates
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [de0858da] + Printf
  [9a3f8284] + Random
  [ea8e919c] + SHA v0.7.0
  [9e88b42a] + Serialization
  [2f01184e] + SparseArrays
  [cf7118a7] + UUIDs
  [4ec0a83e] + Unicode
  [e66e0078] + CompilerSupportLibraries_jll v0.5.2+0
  [4536629a] + OpenBLAS_jll v0.3.20+0
  [8e850b90] + libblastrampoline_jll v5.1.1+0
Precompiling project...
  5 dependencies successfully precompiled in 1 seconds

julia> a = Complex[1, 1]
2-element Vector{Complex}:
 1 + 0im
 1 + 0im

julia> b = Complex.([1,1])
2-element Vector{Complex{Int64}}:
 1 + 0im
 1 + 0im

julia> a .* b .- b
2-element Vector{Complex{Int64}}:
 0 + 0im
 0 + 0im
julia> versioninfo()
Julia Version 1.8.1
Commit 4e8ce6178ca (2022-09-21 16:38 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, tigerlake)
  Threads: 3 on 8 virtual cores
Environment:
  JULIA_NUM_THREADS = 3

It seems to be similar to (the same as?) JuliaDiff/ForwardDiff.jl#601

@oxinabox
Copy link
Member

We can close this since it is a julia bug that is fixed upstream.
Thus there is nothing actionable here.

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.

5 participants