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

tests hang possibly due to type inference #95

Open
AshtonSBradley opened this issue Dec 5, 2019 · 21 comments
Open

tests hang possibly due to type inference #95

AshtonSBradley opened this issue Dec 5, 2019 · 21 comments

Comments

@AshtonSBradley
Copy link

Tests have suddenly become extremely slow. I can't tell if they fail because they never seem to finish:

Screen Shot 2019-12-05 at 3 22 45 PM

not sure how long this goes on for, but at least half an hour I think...

@MikaelSlevinsky
Copy link
Member

MikaelSlevinsky commented Dec 5, 2019 via email

@AshtonSBradley
Copy link
Author

(v1.3) pkg> st
    Status `~/.julia/environments/v1.3/Project.toml`
  [537997a7] AbstractPlotting v0.9.11 #master (https://github.com/JuliaPlots/AbstractPlotting.jl.git)
  [c52e3926] Atom v0.11.3
  [6e4b80f9] BenchmarkTools v0.4.3
  [944b1d66] CodecZlib v0.6.0
  [35d6a980] ColorSchemes v3.5.0
  [17699382] ComplexPortraits v0.1.0 #master (https://github.com/luchr/ComplexPortraits.jl.git)
  [2e2c70e5] DataFitting v0.1.0
  [0c46a032] DifferentialEquations v6.9.0
  [aaf54ef3] DistributedArrays v0.6.4
  [31c24e10] Distributions v0.21.9
  [e30172f5] Documenter v0.24.2
  [7a1cc6ca] FFTW v1.1.0
  [6c09c9bc] FGPEexamples v0.1.0 [`~/.julia/dev/FGPEexamples`]
  [442a2c76] FastGaussQuadrature v0.4.1
  [057dd010] FastTransforms v0.8.1
  [5789e2e9] FileIO v1.1.0
  [f013a474] FourierGPE v0.1.0 [`~/.julia/dev/FourierGPE`]
  [e9467ef8] GLMakie v0.0.8 #master (https://github.com/JuliaPlots/GLMakie.jl.git)
  [92c85e6c] GSL v0.6.0
  [4d00f742] GeometryTypes v0.7.6
  [f67ccb44] HDF5 v0.12.5
  [7073ff75] IJulia v1.20.2
  [6218d12a] ImageMagick v0.7.5
  [916415d5] Images v0.19.0
  [c601a237] Interact v0.10.3
  [a98d9a8b] Interpolations v0.12.5
  [033835bb] JLD2 v0.1.9
  [e5e0dc1b] Juno v0.7.2
  [b964fa9f] LaTeXStrings v1.0.3
  [23fbe1c1] Latexify v0.12.3
  [2fda8390] LsqFit v0.8.1
  [ee78f7c6] Makie v0.9.5 #master (https://github.com/JuliaPlots/Makie.jl.git)
  [e6723b4c] Meshing v0.5.1
  [429524aa] Optim v0.19.5
  [69f2af54] OptionalGPUTest v0.1.0 #master (https://github.com/simonbyrne/OptionalGPUTest.jl.git)
  [1dea7af3] OrdinaryDiffEq v5.26.1
  [3b7a836e] PGFPlots v3.1.3
  [8314cec4] PGFPlotsX v1.2.0
  [65888b18] ParameterizedFunctions v4.2.1
  [d96e819e] Parameters v0.12.0
  [0e21426a] PhaseSpaceTools v0.1.0 [`~/.julia/dev/PhaseSpaceTools`]
  [91a5bcdd] Plots v0.28.2
  [92933f4c] ProgressMeter v1.2.0
  [d330b81b] PyPlot v2.8.2
  [1fd47b50] QuadGK v2.1.1
  [295af30f] Revise v2.3.2
  [276daf66] SpecialFunctions v0.8.0
  [fd094767] Suppressor v0.1.1
  [123dc426] SymEngine v0.7.0
  [24249f21] SymPy v1.0.8
  [c751599d] ToeplitzMatrices v0.6.0
  [b688e990] VortexDistributions v0.0.0 [`~/.julia/dev/VortexDistributions`]
  [44d3d7a6] Weave v0.9.1
  [0f1e0344] WebIO v0.8.11
  [c4c688b2] jlpkg v1.1.2
  [8ba89e20] Distributed 
  [2f01184e] SparseArrays 
  [8dfed614] Test 

julia> versioninfo()
Julia Version 1.3.0
Commit 46ce4d7933 (2019-11-26 06:09 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin19.0.0)
  CPU: Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
Environment:
  JULIA_NUM_THREADS = 8

@MikaelSlevinsky
Copy link
Member

Nothing seems strange with that to me...

If you run the libfasttransformstests.jl file line by line (section by section) can you narrow it down?

@MikaelSlevinsky
Copy link
Member

MikaelSlevinsky commented Dec 5, 2019

As a backup, you can set the ENV["FT_BUILD_FROM_SOURCE"]=“true”, but this has to be set before every new ‘using’

@AshtonSBradley
Copy link
Author

do you mean before I run line by line?

@AshtonSBradley
Copy link
Author

ah, I see

@AshtonSBradley
Copy link
Author

AshtonSBradley commented Dec 5, 2019

Ok, line by line everything runs fast and passes, provided I unroll the second type for loop
for T in (Float64, Complex{Float64}).

In detail, this runs:

ENV["FT_BUILD_FROM_SOURCE"]="true"

using FastTransforms, LinearAlgebra, Test

FastTransforms.set_num_threads(ceil(Int, Base.Sys.CPU_THREADS/2))

n = 64

α, β, γ, δ, λ, μ = 0.1, 0.2, 0.3, 0.4, 0.5, 0.6

#---
for T in (Float32, Float64, Complex{Float32}, Complex{Float64})
x = T(1) ./ (1:n)
Id = Matrix{T}(I, n, n)
for (p1, p2) in (
    (plan_leg2cheb(Id), plan_cheb2leg(Id)),
    (plan_ultra2ultra(Id, λ, μ), plan_ultra2ultra(Id, μ, λ)),
    (plan_jac2jac(Id, α, β, γ, δ), plan_jac2jac(Id, γ, δ, α, β)),
    (plan_lag2lag(Id, α, β), plan_lag2lag(Id, β, α)),
    (plan_jac2ultra(Id, α, β, λ), plan_ultra2jac(Id, λ, α, β)),
    (plan_jac2cheb(Id, α, β), plan_cheb2jac(Id, α, β)),
    (plan_ultra2cheb(Id, λ), plan_cheb2ultra(Id, λ)),
)
    y = p1 * x
    z = p2 * y
    @test z  x
    y = p1 * x
    z = p1'y
    y = transpose(p1) * z
    z = transpose(p1) \ y
    y = p1' \ z
    z = p1 \ y
    @test z  x
    y = p2 * x
    z = p2'y
    y = transpose(p2) * z
    z = transpose(p2) \ y
    y = p2' \ z
    z = p2 \ y
    @test z  x
    P = p1 * Id
    Q = p2 * P
    @test Q  Id
    P = p1 * Id
    Q = p1'P
    P = transpose(p1) * Q
    Q = transpose(p1) \ P
    P = p1' \ Q
    Q = p1 \ P
    @test Q  Id
    P = p2 * Id
    Q = p2'P
    P = transpose(p2) * Q
    Q = transpose(p2) \ P
    P = p2' \ Q
    Q = p2 \ P
    @test Q  Id
end
end

#---

for T in (BigFloat, Complex{BigFloat})
    x = T(1) ./ (1:n)
    Id = Matrix{T}(I, n, n)
    for (p1, p2) in (
        (plan_leg2cheb(Id), plan_cheb2leg(Id)),
        (plan_ultra2ultra(Id, λ, μ), plan_ultra2ultra(Id, μ, λ)),
        (plan_jac2jac(Id, α, β, γ, δ), plan_jac2jac(Id, γ, δ, α, β)),
        (plan_lag2lag(Id, α, β), plan_lag2lag(Id, β, α)),
        (plan_jac2ultra(Id, α, β, λ), plan_ultra2jac(Id, λ, α, β)),
        (plan_jac2cheb(Id, α, β), plan_cheb2jac(Id, α, β)),
        (plan_ultra2cheb(Id, λ), plan_cheb2ultra(Id, λ)),
    )
        y = p1 * x
        z = p2 * y
        @test z  x
        y = p1 * x
        z = p1'y
        y = transpose(p1) * z
        z = transpose(p1) \ y
        y = p1' \ z
        z = p1 \ y
        @test z  x
        y = p2 * x
        z = p2'y
        y = transpose(p2) * z
        z = transpose(p2) \ y
        y = p2' \ z
        z = p2 \ y
        @test z  x
        P = p1 * Id
        Q = p2 * P
        @test_skip Q  Id
        P = p1 * Id
        Q = p1'P
        P = transpose(p1) * Q
        Q = transpose(p1) \ P
        P = p1' \ Q
        Q = p1 \ P
        @test_skip Q  Id
        P = p2 * Id
        Q = p2'P
        P = transpose(p2) * Q
        Q = transpose(p2) \ P
        P = p2' \ Q
        Q = p2 \ P
        @test_skip Q  Id
    end
end

#---

# for T in (Float64, Complex{Float64})
T = Float64
    A = T <: Real ? sphones(T, n, 2n - 1) :
        sphones(T, n, 2n - 1) + im * sphones(T, n, 2n - 1)
    p = plan_sph2fourier(A)
    ps = plan_sph_synthesis(A)
    pa = plan_sph_analysis(A)
    B = copy(A)
    C = ps * (p * A)
    A = p \ (pa * C)
    @test A  B

    A = T <: Real ? sphvones(T, n, 2n - 1) :
        sphvones(T, n, 2n - 1) + im * sphvones(T, n, 2n - 1)
    p = plan_sphv2fourier(A)
    ps = plan_sphv_synthesis(A)
    pa = plan_sphv_analysis(A)
    B = copy(A)
    C = ps * (p * A)
    A = p \ (pa * C)
    @test A  B

    A = T <: Real ? diskones(T, n, 4n - 3) :
        diskones(T, n, 4n - 3) + im * diskones(T, n, 4n - 3)
    p = plan_disk2cxf(A)
    ps = plan_disk_synthesis(A)
    pa = plan_disk_analysis(A)
    B = copy(A)
    C = ps * (p * A)
    A = p \ (pa * C)
    @test A  B

    A = T <: Real ? triones(T, n, n) : triones(T, n, n) + im * triones(T, n, n)
    p = plan_tri2cheb(A, α, β, γ)
    ps = plan_tri_synthesis(A)
    pa = plan_tri_analysis(A)
    B = copy(A)
    C = ps * (p * A)
    A = p \ (pa * C)
    @test A  B

    A = T <: Real ? tetones(T, n, n, n) :
        tetones(T, n, n, n) + im * tetones(T, n, n, n)
    p = plan_tet2cheb(A, α, β, γ, δ)
    ps = plan_tet_synthesis(A)
    pa = plan_tet_analysis(A)
    B = copy(A)
    C = ps * (p * A)
    A = p \ (pa * C)
    @test A  B
# end

#---
T =  Complex{Float64}
A = T <: Real ? sphones(T, n, 2n - 1) :
    sphones(T, n, 2n - 1) + im * sphones(T, n, 2n - 1)
p = plan_sph2fourier(A)
ps = plan_sph_synthesis(A)
pa = plan_sph_analysis(A)
B = copy(A)
C = ps * (p * A)
A = p \ (pa * C)
@test A  B

#---
A = T <: Real ? sphvones(T, n, 2n - 1) :
    sphvones(T, n, 2n - 1) + im * sphvones(T, n, 2n - 1)
p = plan_sphv2fourier(A)
ps = plan_sphv_synthesis(A)
pa = plan_sphv_analysis(A)
B = copy(A)
C = ps * (p * A)
A = p \ (pa * C)
@test A  B

#---
A = T <: Real ? diskones(T, n, 4n - 3) :
    diskones(T, n, 4n - 3) + im * diskones(T, n, 4n - 3)
p = plan_disk2cxf(A)
ps = plan_disk_synthesis(A)
pa = plan_disk_analysis(A)
B = copy(A)
C = ps * (p * A)
A = p \ (pa * C)
@test A  B

#---
A = T <: Real ? triones(T, n, n) : triones(T, n, n) + im * triones(T, n, n)
p = plan_tri2cheb(A, α, β, γ)
ps = plan_tri_synthesis(A)
pa = plan_tri_analysis(A)
B = copy(A)
C = ps * (p * A)
A = p \ (pa * C)
@test A  B

#---
A = T <: Real ? tetones(T, n, n, n) :
    tetones(T, n, n, n) + im * tetones(T, n, n, n)
p = plan_tet2cheb(A, α, β, γ, δ)
ps = plan_tet_synthesis(A)
pa = plan_tet_analysis(A)
B = copy(A)
C = ps * (p * A)
A = p \ (pa * C)
@test A  B
# end

but if I leave that last loop, then it freezes

@MikaelSlevinsky
Copy link
Member

Great, thanks for reporting this. I don’t know what’s going on, but it seems that all the ccall’s are ok (that would’ve been a much bigger problem). Perhaps it’s some kind of type inference bug in Julia itself?

Does it work when you use the Artifact, I.e. the default build? To re-trigger this, you’ll have to trick Julia into recompiling the package (and ensure that ENV[“FT_BUILD_FROM_SOURCE”]=“false” or is not set).

@AshtonSBradley
Copy link
Author

AshtonSBradley commented Dec 5, 2019

maybe aliasing? There is something strangely non-reproducible going on though. Each time starting fresh julia session.

This seems to be an MWE on the final block:

Works:

ENV["FT_BUILD_FROM_SOURCE"]="true"

using FastTransforms, LinearAlgebra, Test

FastTransforms.set_num_threads(ceil(Int, Base.Sys.CPU_THREADS/2))


n = 64

α, β, γ, δ, λ, μ = 0.1, 0.2, 0.3, 0.4, 0.5, 0.6

#---
for T in (Float64, Complex{Float64})
    A = T <: Real ? sphones(T, n, 2n - 1) :
        sphones(T, n, 2n - 1) + im * sphones(T, n, 2n - 1)
    p = plan_sph2fourier(A)
    ps = plan_sph_synthesis(A)
    pa = plan_sph_analysis(A)
    B = copy(A)
    C = ps * (p * A)
    A = p \ (pa * C)
    @test A  B

    # A = T <: Real ? sphvones(T, n, 2n - 1) :
    #     sphvones(T, n, 2n - 1) + im * sphvones(T, n, 2n - 1)
    # p = plan_sphv2fourier(A)
    # ps = plan_sphv_synthesis(A)
    # pa = plan_sphv_analysis(A)
    # B = copy(A)
    # C = ps * (p * A)
    # A = p \ (pa * C)
    # @test A ≈ B

    # A = T <: Real ? diskones(T, n, 4n - 3) :
    #     diskones(T, n, 4n - 3) + im * diskones(T, n, 4n - 3)
    # p = plan_disk2cxf(A)
    # ps = plan_disk_synthesis(A)
    # pa = plan_disk_analysis(A)
    # B = copy(A)
    # C = ps * (p * A)
    # A = p \ (pa * C)
    # @test A ≈ B

    # A = T <: Real ? triones(T, n, n) : triones(T, n, n) + im * triones(T, n, n)
    # p = plan_tri2cheb(A, α, β, γ)
    # ps = plan_tri_synthesis(A)
    # pa = plan_tri_analysis(A)
    # B = copy(A)
    # C = ps * (p * A)
    # A = p \ (pa * C)
    # @test A ≈ B

    # A = T <: Real ? tetones(T, n, n, n) :
    #     tetones(T, n, n, n) + im * tetones(T, n, n, n)
    # p = plan_tet2cheb(A, α, β, γ, δ)
    # ps = plan_tet_synthesis(A)
    # pa = plan_tet_analysis(A)
    # B = copy(A)
    # C = ps * (p * A)
    # A = p \ (pa * C)
    # @test A ≈ B
end

Hangs:

ENV["FT_BUILD_FROM_SOURCE"]="true"

using FastTransforms, LinearAlgebra, Test

FastTransforms.set_num_threads(ceil(Int, Base.Sys.CPU_THREADS/2))


n = 64

α, β, γ, δ, λ, μ = 0.1, 0.2, 0.3, 0.4, 0.5, 0.6

#---
for T in (Float64, Complex{Float64})
    A = T <: Real ? sphones(T, n, 2n - 1) :
        sphones(T, n, 2n - 1) + im * sphones(T, n, 2n - 1)
    p = plan_sph2fourier(A)
    ps = plan_sph_synthesis(A)
    pa = plan_sph_analysis(A)
    B = copy(A)
    C = ps * (p * A)
    A = p \ (pa * C)
    @test A  B

    A = T <: Real ? sphvones(T, n, 2n - 1) :
        sphvones(T, n, 2n - 1) + im * sphvones(T, n, 2n - 1)
    p = plan_sphv2fourier(A)
    ps = plan_sphv_synthesis(A)
    pa = plan_sphv_analysis(A)
    B = copy(A)
    C = ps * (p * A)
    A = p \ (pa * C)
    @test A  B

    A = T <: Real ? diskones(T, n, 4n - 3) :
        diskones(T, n, 4n - 3) + im * diskones(T, n, 4n - 3)
    p = plan_disk2cxf(A)
    ps = plan_disk_synthesis(A)
    pa = plan_disk_analysis(A)
    B = copy(A)
    C = ps * (p * A)
    A = p \ (pa * C)
    @test A  B
    
    A = T <: Real ? triones(T, n, n) : triones(T, n, n) + im * triones(T, n, n)
    p = plan_tri2cheb(A, α, β, γ)
    ps = plan_tri_synthesis(A)
    pa = plan_tri_analysis(A)
    B = copy(A)
    C = ps * (p * A)
    A = p \ (pa * C)
    @test A  B

    # A = T <: Real ? tetones(T, n, n, n) :
    #     tetones(T, n, n, n) + im * tetones(T, n, n, n)
    # p = plan_tet2cheb(A, α, β, γ, δ)
    # ps = plan_tet_synthesis(A)
    # pa = plan_tet_analysis(A)
    # B = copy(A)
    # C = ps * (p * A)
    # A = p \ (pa * C)
    # @test A ≈ B
end

Strangely, precisely how many of the intermediate blocks between 1 and 5 have to be un-commented to cause a freeze seems to vary from run to run. It could be as little as 1 and as many as 3

@AshtonSBradley
Copy link
Author

ah, it seems to depend on when saving happens in Juno... maybe... I don't know. I feel like a ghost has entered the machine

@MikaelSlevinsky
Copy link
Member

Does this version of the test set work for you? If so, I'll push to master.

@testset "libfasttransforms" begin
    n = 64
    α, β, γ, δ, λ, μ = 0.1, 0.2, 0.3, 0.4, 0.5, 0.6
    function test_1d_plans(p1, p2, x; skip::Bool=false)
        y = p1*x
        z = p2*y
        @test z  x
        y = p1*x
        z = p1'y
        y = transpose(p1)*z
        z = transpose(p1)\y
        y = p1'\z
        z = p1\y
        @test z  x
        y = p2*x
        z = p2'y
        y = transpose(p2)*z
        z = transpose(p2)\y
        y = p2'\z
        z = p2\y
        @test z  x
        P = p1*I
        Q = p2*P
        skip ? (@test_skip Q  I) : (@test Q  I)
        P = p1*I
        Q = p1'P
        P = transpose(p1)*Q
        Q = transpose(p1)\P
        P = p1'\Q
        Q = p1\P
        skip ? (@test_skip Q  I) : (@test Q  I)
        P = p2*I
        Q = p2'P
        P = transpose(p2)*Q
        Q = transpose(p2)\P
        P = p2'\Q
        Q = p2\P
        skip ? (@test_skip Q  I) : (@test Q  I)
    end
    for T in (Float32, Float64, Complex{Float32}, Complex{Float64})
        x = T(1)./(1:n)
        Id = Matrix{T}(I, n, n)
        for (p1, p2) in ((plan_leg2cheb(Id), plan_cheb2leg(Id)),
                          (plan_ultra2ultra(Id, λ, μ), plan_ultra2ultra(Id, μ, λ)),
                          (plan_jac2jac(Id, α, β, γ, δ), plan_jac2jac(Id, γ, δ, α, β)),
                          (plan_lag2lag(Id, α, β), plan_lag2lag(Id, β, α)),
                          (plan_jac2ultra(Id, α, β, λ), plan_ultra2jac(Id, λ, α, β)),
                          (plan_jac2cheb(Id, α, β), plan_cheb2jac(Id, α, β)),
                          (plan_ultra2cheb(Id, λ), plan_cheb2ultra(Id, λ)))
            test_1d_plans(p1, p2, x)
        end
    end
    for T in (BigFloat, Complex{BigFloat})
        x = T(1)./(1:n)
        Id = Matrix{T}(I, n, n)
        for (p1, p2) in ((plan_leg2cheb(Id), plan_cheb2leg(Id)),
                          (plan_ultra2ultra(Id, λ, μ), plan_ultra2ultra(Id, μ, λ)),
                          (plan_jac2jac(Id, α, β, γ, δ), plan_jac2jac(Id, γ, δ, α, β)),
                          (plan_lag2lag(Id, α, β), plan_lag2lag(Id, β, α)),
                          (plan_jac2ultra(Id, α, β, λ), plan_ultra2jac(Id, λ, α, β)),
                          (plan_jac2cheb(Id, α, β), plan_cheb2jac(Id, α, β)),
                          (plan_ultra2cheb(Id, λ), plan_cheb2ultra(Id, λ)))
            test_1d_plans(p1, p2, x; skip=true)
        end
    end
    function test_nd_plans(p, ps, pa, A)
        B = copy(A)
        C = ps*(p*A)
        A = p\(pa*C)
        @test A  B
    end
    for A in (sphones(Float64, n, 2n-1), sphones(Float64, n, 2n-1) + im*sphones(Float64, n, 2n-1))
        p = plan_sph2fourier(A)
        ps = plan_sph_synthesis(A)
        pa = plan_sph_analysis(A)
        test_nd_plans(p, ps, pa, A)
    end
    for A in (sphvones(Float64, n, 2n-1), sphvones(Float64, n, 2n-1) + im*sphvones(Float64, n, 2n-1))
        p = plan_sphv2fourier(A)
        ps = plan_sphv_synthesis(A)
        pa = plan_sphv_analysis(A)
        test_nd_plans(p, ps, pa, A)
    end
    for A in (diskones(Float64, n, 4n-3), diskones(Float64, n, 4n-3) + im*diskones(Float64, n, 4n-3))
        p = plan_disk2cxf(A)
        ps = plan_disk_synthesis(A)
        pa = plan_disk_analysis(A)
        test_nd_plans(p, ps, pa, A)
    end
    for A in (triones(Float64, n, n), triones(Float64, n, n) + im*triones(Float64, n, n))
        p = plan_tri2cheb(A, α, β, γ)
        ps = plan_tri_synthesis(A)
        pa = plan_tri_analysis(A)
        test_nd_plans(p, ps, pa, A)
    end
    for A in (tetones(Float64, n, n, n), tetones(Float64, n, n, n) + im*tetones(Float64, n, n, n))
        p = plan_tet2cheb(A, α, β, γ, δ)
        ps = plan_tet_synthesis(A)
        pa = plan_tet_analysis(A)
        test_nd_plans(p, ps, pa, A)
    end
end

@AshtonSBradley
Copy link
Author

Test Summary:     | Pass  Total
Special functions |   19     19
Test Summary:       | Pass  Total
Chebyshev transform |  250    250
Test Summary:                         | Pass  Total
Fejér and Clenshaw--Curtis quadrature |    9      9
libfasttransforms: Error During Test at /Users/abradley/.julia/packages/FastTransforms/OShrg/test/libfasttransformstests.jl:5
  Got exception outside of a @test
  MethodError: no method matching *(::FastTransforms.FTPlan{Float32,1,0}, ::UniformScaling{Bool})
  Closest candidates are:
    *(::Any, ::Any, !Matched::Any, !Matched::Any...) at operators.jl:529
    *(!Matched::BitArray{2}, ::UniformScaling) at /Users/sabae/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/LinearAlgebra/src/uniformscaling.jl:195
    *(!Matched::UniformScaling, ::UniformScaling) at /Users/sabae/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/LinearAlgebra/src/uniformscaling.jl:194
    ...
  Stacktrace:
   [1] (::var"#test_1d_plans#21#23")(::Bool, ::var"#test_1d_plans#22"{var"#test_1d_plans#21#23"}, ::FastTransforms.FTPlan{Float32,1,0}, ::FastTransforms.FTPlan{Float32,1,1}, ::Array{Float32,1}) at /Users/abradley/.julia/packages/FastTransforms/OShrg/test/libfasttransformstests.jl:26
   [2] (::var"#test_1d_plans#22"{var"#test_1d_plans#21#23"})(::FastTransforms.FTPlan{Float32,1,0}, ::FastTransforms.FTPlan{Float32,1,1}, ::Array{Float32,1}) at /Users/abradley/.julia/packages/FastTransforms/OShrg/test/libfasttransformstests.jl:9
   [3] top-level scope at /Users/abradley/.julia/packages/FastTransforms/OShrg/test/libfasttransformstests.jl:56
   [4] top-level scope at /Users/sabae/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Test/src/Test.jl:1107
   [5] top-level scope at /Users/abradley/.julia/packages/FastTransforms/OShrg/test/libfasttransformstests.jl:6
   [6] include at ./boot.jl:328 [inlined]
   [7] include_relative(::Module, ::String) at ./loading.jl:1105
   [8] include(::Module, ::String) at ./Base.jl:31
   [9] include(::String) at ./client.jl:424
   [10] top-level scope at /Users/abradley/.julia/packages/FastTransforms/OShrg/test/runtests.jl:10
   [11] include at ./boot.jl:328 [inlined]
   [12] include_relative(::Module, ::String) at ./loading.jl:1105
   [13] include(::Module, ::String) at ./Base.jl:31
   [14] include(::String) at ./client.jl:424
   [15] top-level scope at none:6
   [16] eval(::Module, ::Any) at ./boot.jl:330
   [17] exec_options(::Base.JLOptions) at ./client.jl:263
   [18] _start() at ./client.jl:460
  
Test Summary:     | Pass  Error  Total
libfasttransforms |    3      1      4
ERROR: LoadError: LoadError: Some tests did not pass: 3 passed, 0 failed, 1 errored, 0 broken.
in expression starting at /Users/abradley/.julia/packages/FastTransforms/OShrg/test/libfasttransformstests.jl:5
in expression starting at /Users/abradley/.julia/packages/FastTransforms/OShrg/test/runtests.jl:9
ERROR: Package FastTransforms errored during testing

@MikaelSlevinsky
Copy link
Member

Ah, sorry, I recently added some better syntax to handle p*I for I::UniformScaling.

Try this instead

@testset "libfasttransforms" begin
    n = 64
    α, β, γ, δ, λ, μ = 0.1, 0.2, 0.3, 0.4, 0.5, 0.6
    function test_1d_plans(p1, p2, x, Id; skip::Bool=false)
        y = p1*x
        z = p2*y
        @test z  x
        y = p1*x
        z = p1'y
        y = transpose(p1)*z
        z = transpose(p1)\y
        y = p1'\z
        z = p1\y
        @test z  x
        y = p2*x
        z = p2'y
        y = transpose(p2)*z
        z = transpose(p2)\y
        y = p2'\z
        z = p2\y
        @test z  x
        P = p1*Id
        Q = p2*P
        skip ? (@test_skip Q  Id) : (@test Q  Id)
        P = p1*Id
        Q = p1'P
        P = transpose(p1)*Q
        Q = transpose(p1)\P
        P = p1'\Q
        Q = p1\P
        skip ? (@test_skip Q  Id) : (@test Q  Id)
        P = p2*Id
        Q = p2'P
        P = transpose(p2)*Q
        Q = transpose(p2)\P
        P = p2'\Q
        Q = p2\P
        skip ? (@test_skip Q  Id) : (@test Q  Id)
    end
    for T in (Float32, Float64, Complex{Float32}, Complex{Float64})
        x = T(1)./(1:n)
        Id = Matrix{T}(I, n, n)
        for (p1, p2) in ((plan_leg2cheb(Id), plan_cheb2leg(Id)),
                          (plan_ultra2ultra(Id, λ, μ), plan_ultra2ultra(Id, μ, λ)),
                          (plan_jac2jac(Id, α, β, γ, δ), plan_jac2jac(Id, γ, δ, α, β)),
                          (plan_lag2lag(Id, α, β), plan_lag2lag(Id, β, α)),
                          (plan_jac2ultra(Id, α, β, λ), plan_ultra2jac(Id, λ, α, β)),
                          (plan_jac2cheb(Id, α, β), plan_cheb2jac(Id, α, β)),
                          (plan_ultra2cheb(Id, λ), plan_cheb2ultra(Id, λ)))
            test_1d_plans(p1, p2, x, Id)
        end
    end
    for T in (BigFloat, Complex{BigFloat})
        x = T(1)./(1:n)
        Id = Matrix{T}(I, n, n)
        for (p1, p2) in ((plan_leg2cheb(Id), plan_cheb2leg(Id)),
                          (plan_ultra2ultra(Id, λ, μ), plan_ultra2ultra(Id, μ, λ)),
                          (plan_jac2jac(Id, α, β, γ, δ), plan_jac2jac(Id, γ, δ, α, β)),
                          (plan_lag2lag(Id, α, β), plan_lag2lag(Id, β, α)),
                          (plan_jac2ultra(Id, α, β, λ), plan_ultra2jac(Id, λ, α, β)),
                          (plan_jac2cheb(Id, α, β), plan_cheb2jac(Id, α, β)),
                          (plan_ultra2cheb(Id, λ), plan_cheb2ultra(Id, λ)))
            test_1d_plans(p1, p2, x, Id; skip=true)
        end
    end
    function test_nd_plans(p, ps, pa, A)
        B = copy(A)
        C = ps*(p*A)
        A = p\(pa*C)
        @test A  B
    end
    for A in (sphones(Float64, n, 2n-1), sphones(Float64, n, 2n-1) + im*sphones(Float64, n, 2n-1))
        p = plan_sph2fourier(A)
        ps = plan_sph_synthesis(A)
        pa = plan_sph_analysis(A)
        test_nd_plans(p, ps, pa, A)
    end
    for A in (sphvones(Float64, n, 2n-1), sphvones(Float64, n, 2n-1) + im*sphvones(Float64, n, 2n-1))
        p = plan_sphv2fourier(A)
        ps = plan_sphv_synthesis(A)
        pa = plan_sphv_analysis(A)
        test_nd_plans(p, ps, pa, A)
    end
    for A in (diskones(Float64, n, 4n-3), diskones(Float64, n, 4n-3) + im*diskones(Float64, n, 4n-3))
        p = plan_disk2cxf(A)
        ps = plan_disk_synthesis(A)
        pa = plan_disk_analysis(A)
        test_nd_plans(p, ps, pa, A)
    end
    for A in (triones(Float64, n, n), triones(Float64, n, n) + im*triones(Float64, n, n))
        p = plan_tri2cheb(A, α, β, γ)
        ps = plan_tri_synthesis(A)
        pa = plan_tri_analysis(A)
        test_nd_plans(p, ps, pa, A)
    end
    for A in (tetones(Float64, n, n, n), tetones(Float64, n, n, n) + im*tetones(Float64, n, n, n))
        p = plan_tet2cheb(A, α, β, γ, δ)
        ps = plan_tet_synthesis(A)
        pa = plan_tet_analysis(A)
        test_nd_plans(p, ps, pa, A)
    end
end

@AshtonSBradley
Copy link
Author

same problem, frozen at the same place:

Test Summary:     | Pass  Total
Special functions |   19     19
Test Summary:       | Pass  Total
Chebyshev transform |  250    250
Test Summary:                         | Pass  Total
Fejér and Clenshaw--Curtis quadrature |    9      9

@MikaelSlevinsky
Copy link
Member

Just to isolate whether it's to do with the typing of the arrays (A = sphones(Float64, n, 2n-1) vs. the complex case) or if it has to do with threading, what happens when you set FastTransforms.set_num_threads(1)?

@AshtonSBradley
Copy link
Author

that doesn't fix it

@MikaelSlevinsky
Copy link
Member

MikaelSlevinsky commented Dec 5, 2019 via email

@AshtonSBradley
Copy link
Author

that worked in the original form

@MikaelSlevinsky MikaelSlevinsky changed the title tests have become very slow tests hang possibly due to type inference Dec 6, 2019
@AshtonSBradley
Copy link
Author

just checking this... it doesn't seem to be fixed @MikaelSlevinsky

@MikaelSlevinsky
Copy link
Member

Any chance v0.9.2 fixes this? (Probably not, but thought I’d ask just in case)

@AshtonSBradley
Copy link
Author

doesn't seem to have fixed it

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

No branches or pull requests

3 participants