Skip to content

Specifically, calling sample() seems inordinately slow on 1.10 #2570

@penelopeysm

Description

@penelopeysm

The testsets that involve actual AD evaluation (i.e. DynamicPPL.TestUtils.AD.run_ad) have quite similar runtimes, but the moment we call sample, all hell breaks loose (and we are barely even sampling!):

@testset verbose = true "AD / Gibbs sampling" begin
    # Make sure that Gibbs sampling doesn't fall over when using AD.
    @testset "adtype=$adtype" for adtype in ADTYPES
        spl = Gibbs(
            @varname(s) => HMC(0.1, 10; adtype=adtype),
            @varname(m) => HMC(0.1, 10; adtype=adtype),
        )
        @testset "model=$(model.f)" for model in DEMO_MODELS
            @test sample(model, spl, 2) isa Any
        end
    end
end

This testset on 1.10:

    AD / Gibbs sampling                             |   39     39   93m39.7s
      adtype=ADTypes.AutoForwardDiff()              |   13     13   13m57.6s
      adtype=ADTypes.AutoReverseDiff()              |   13     13   36m59.2s
      adtype=ADTypes.AutoMooncake{Nothing}(nothing) |   13     13   42m42.9s

This testset on 1.11:

     AD / Gibbs sampling                             |   39     39  12m58.3s
      adtype=ADTypes.AutoForwardDiff()              |   13     13   2m33.9s
      adtype=ADTypes.AutoReverseDiff()              |   13     13   2m13.8s
      adtype=ADTypes.AutoMooncake{Nothing}(nothing) |   13     13   8m10.6s

It's only two iterations --- is it compilation time that's the problem??

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions