We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm seeing some very strange behavior with compiled ReverseDiff.jl:
It gets the correct results when linking, but not when we don't link.
julia> using Turing, Zygote, ReverseDiff, LogDensityProblems, LogDensityProblemsAD julia> # Test model. @model function demo(x, y) s ~ InverseGamma(2, 3) m ~ Normal(0, sqrt(s)) x ~ Normal(m, sqrt(s)) y ~ Normal(m, sqrt(s)) end demo (generic function with 2 methods) julia> model = demo(1.5, 2.0); julia> # Make the benchmark suite. backends = [ Turing.Essential.ForwardDiffAD{0}(), Turing.Essential.ReverseDiffAD{false}(), Turing.Essential.ReverseDiffAD{true}() ]; julia> context = DynamicPPL.DefaultContext(); julia> varinfo = DynamicPPL.VarInfo(model); julia> θ = varinfo[:] 2-element Vector{Float64}: 0.877721788997423 -0.4609132411104931 julia> for backend in backends f = LogDensityProblemsAD.ADgradient( backend, DynamicPPL.LogDensityFunction( DynamicPPL.unflatten(varinfo, θ), model, context ) ) @info "$backend" LogDensityProblems.logdensity_and_gradient(f, θ) end ┌ Info: Turing.Essential.ForwardDiffAD{0, true}() └ LogDensityProblems.logdensity_and_gradient(f, θ) = (-9.15196013596708, [5.331170301312024, 5.562969706960088]) ┌ Info: Turing.Essential.ReverseDiffAD{false}() └ LogDensityProblems.logdensity_and_gradient(f, θ) = (-9.15196013596708, [5.331170301312024, 5.562969706960087]) ┌ Info: Turing.Essential.ReverseDiffAD{true}() └ LogDensityProblems.logdensity_and_gradient(f, θ) = (-9.26758782412419, [6.332605592854213, 5.498758418990619]) julia> varinfo_linked = DynamicPPL.link!!( DynamicPPL.VarInfo(model), model ); julia> θ_linked = varinfo_linked[:] 2-element Vector{Float64}: -0.41309731702034985 -0.2283878061115611 julia> for backend in backends f_linked = LogDensityProblemsAD.ADgradient( backend, DynamicPPL.LogDensityFunction( DynamicPPL.unflatten(varinfo_linked, θ_linked), model, context ) ) @info "$backend" LogDensityProblems.logdensity_and_gradient(f_linked, θ_linked) end ┌ Info: Turing.Essential.ForwardDiffAD{0, true}() └ LogDensityProblems.logdensity_and_gradient(f_linked, θ_linked) = (-9.698123276822646, [7.084372864116072, 6.325841497112945]) ┌ Info: Turing.Essential.ReverseDiffAD{false}() └ LogDensityProblems.logdensity_and_gradient(f_linked, θ_linked) = (-9.698123276822646, [7.084372864116072, 6.325841497112945]) ┌ Info: Turing.Essential.ReverseDiffAD{true}() └ LogDensityProblems.logdensity_and_gradient(f_linked, θ_linked) = (-9.698123276822646, [7.084372864116072, 6.325841497112945])
Notice the differences in the first computations.
What in the world is this? Seen this before @devmotion @willtebbutt @yebai ?
julia> versioninfo() Julia Version 1.9.3 Commit bed2cd540a1 (2023-08-24 14:43 UTC) Build Info: Official https://julialang.org/ release Platform Info: OS: Linux (x86_64-linux-gnu) CPU: 12 × Intel(R) Core(TM) i7-10710U CPU @ 1.10GHz WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-14.0.6 (ORCJIT, skylake) Threads: 1 on 12 virtual cores (jl_f3oaDw) pkg> st --manifest Status `/tmp/jl_f3oaDw/Manifest.toml` [47edcb42] ADTypes v0.2.4 [621f4979] AbstractFFTs v1.5.0 [80f14c24] AbstractMCMC v4.4.2 [7a57a42e] AbstractPPL v0.6.2 [1520ce14] AbstractTrees v0.4.4 [79e6a3ab] Adapt v3.6.2 [0bf59076] AdvancedHMC v0.5.5 [5b7e9947] AdvancedMH v0.7.5 [576499cb] AdvancedPS v0.4.3 [b5ca4192] AdvancedVI v0.2.4 [dce04be8] ArgCheck v2.3.0 [4fba245c] ArrayInterface v7.4.11 [a9b6321e] Atomix v0.1.0 [13072b0f] AxisAlgorithms v1.0.1 [39de3d68] AxisArrays v0.4.7 [198e06fe] BangBang v0.3.39 [9718e550] Baselet v0.1.1 [76274a88] Bijectors v0.13.7 [fa961155] CEnum v0.4.2 [49dc2e85] Calculus v0.5.1 [082447d4] ChainRules v1.54.0 [d360d2e6] ChainRulesCore v1.16.0 [9e997f8a] ChangesOfVariables v0.1.8 [861a8166] Combinatorics v1.0.2 [38540f10] CommonSolve v0.2.4 [bbf7d656] CommonSubexpressions v0.3.0 [34da2185] Compat v4.9.0 [a33af91c] CompositionsBase v0.1.2 [88cd18e8] ConsoleProgressMonitor v0.1.2 [187b0558] ConstructionBase v1.5.4 [a8cc5b0e] Crayons v4.1.1 [9a962f9c] DataAPI v1.15.0 [864edb3b] DataStructures v0.18.15 [e2d170a0] DataValueInterfaces v1.0.0 [244e2a9f] DefineSingletons v0.1.2 [8bb1440f] DelimitedFiles v1.9.1 [b429d917] DensityInterface v0.4.0 [163ba53b] DiffResults v1.1.0 [b552c78f] DiffRules v1.15.1 [31c24e10] Distributions v0.25.100 [ced4e74d] DistributionsAD v0.6.52 [ffbed154] DocStringExtensions v0.9.3 [fa6b7ba4] DualNumbers v0.6.8 [366bfd00] DynamicPPL v0.23.17 [cad2338a] EllipticalSliceSampling v1.1.0 [4e289a0a] EnumX v1.0.4 [e2ba6199] ExprTools v0.1.10 [7a1cc6ca] FFTW v1.7.1 [1a297f60] FillArrays v1.6.1 [59287772] Formatting v0.4.2 [f6369f11] ForwardDiff v0.10.36 [069b7b12] FunctionWrappers v1.1.3 [77dc65aa] FunctionWrappersWrappers v0.1.3 [d9f16b24] Functors v0.4.5 [0c68f7d7] GPUArrays v9.0.0 [46192b85] GPUArraysCore v0.1.5 [34004b35] HypergeometricFunctions v0.3.23 [7869d1d1] IRTools v0.4.10 [22cec73e] InitialValues v0.3.1 [505f98c9] InplaceOps v0.3.0 [a98d9a8b] Interpolations v0.14.7 [8197267c] IntervalSets v0.7.7 [3587e190] InverseFunctions v0.1.12 [41ab1584] InvertedIndices v1.3.0 [92d709cd] IrrationalConstants v0.2.2 [c8e1da08] IterTools v1.8.0 [82899510] IteratorInterfaceExtensions v1.0.0 [692b3bcd] JLLWrappers v1.5.0 [63c18a36] KernelAbstractions v0.9.8 [5ab0869b] KernelDensity v0.6.7 [929cbde3] LLVM v6.2.1 [8ac3fa9e] LRUCache v1.5.0 [b964fa9f] LaTeXStrings v1.3.0 [50d2b5c4] Lazy v0.15.1 [1d6d02ad] LeftChildRightSiblingTrees v0.2.0 [6f1fad26] Libtask v0.8.6 [6fdf6af0] LogDensityProblems v2.1.1 ⌃ [996a588d] LogDensityProblemsAD v1.5.0 [2ab3a3ac] LogExpFunctions v0.3.26 [e6f89c97] LoggingExtras v1.0.2 [c7f686f2] MCMCChains v6.0.3 [be115224] MCMCDiagnosticTools v0.3.5 [e80e1ace] MLJModelInterface v1.9.2 [1914dd2f] MacroTools v0.5.11 [dbb5928d] MappedArrays v0.4.2 [128add7d] MicroCollections v0.1.4 [e1d29d7a] Missings v1.1.0 [872c559c] NNlib v0.9.5 [77ba4419] NaNMath v1.0.2 [86f7a689] NamedArrays v0.10.0 [c020b1a1] NaturalSort v1.0.0 [6fe1bfb0] OffsetArrays v1.12.10 ⌅ [3bd65402] Optimisers v0.2.20 [bac558e1] OrderedCollections v1.6.2 [90014a1f] PDMats v0.11.17 [aea7be01] PrecompileTools v1.2.0 [21216c6a] Preferences v1.4.0 [08abe8d2] PrettyTables v2.2.7 [33c8b6b6] ProgressLogging v0.1.4 [92933f4c] ProgressMeter v1.9.0 [1fd47b50] QuadGK v2.8.2 [74087812] Random123 v1.6.1 [e6cf234a] RandomNumbers v1.5.3 [b3c3ace0] RangeArrays v0.3.2 [c84ed2f1] Ratios v0.4.5 [c1ae055f] RealDot v0.1.0 [3cdcf5f2] RecipesBase v1.3.4 [731186ca] RecursiveArrayTools v2.38.10 [189a3867] Reexport v1.2.2 [ae029012] Requires v1.3.0 [37e2e3b7] ReverseDiff v1.15.1 [79098fc4] Rmath v0.7.1 [f2b01f46] Roots v2.0.19 [7e49a35a] RuntimeGeneratedFunctions v0.5.12 [0bca4576] SciMLBase v1.98.0 [c0aeaf25] SciMLOperators v0.3.6 [30f210dd] ScientificTypesBase v3.0.0 [efcf1570] Setfield v1.1.1 [ce78b400] SimpleUnPack v1.1.0 [a2af1166] SortingAlgorithms v1.1.1 [dc90abb0] SparseInverseSubset v0.1.1 [276daf66] SpecialFunctions v2.3.1 [171d559e] SplittablesBase v0.1.15 [90137ffa] StaticArrays v1.6.3 [1e83bf80] StaticArraysCore v1.4.2 [64bff920] StatisticalTraits v3.2.0 [82ae8749] StatsAPI v1.7.0 [2913bbd2] StatsBase v0.34.0 [4c63d2b9] StatsFuns v1.3.0 [892a3eda] StringManipulation v0.3.4 [09ab397b] StructArrays v0.6.16 [2efcf032] SymbolicIndexingInterface v0.2.2 [3783bdb8] TableTraits v1.0.1 [bd369af6] Tables v1.11.0 [5d786b92] TerminalLoggers v0.1.7 [9f7883ad] Tracker v0.2.26 [28d57a85] Transducers v0.4.78 [410a4b4d] Tricks v0.1.7 [781d530d] TruncatedStacktraces v1.4.0 [fce5fe82] Turing v0.29.1 [013be700] UnsafeAtomics v0.2.1 [d80eeb9a] UnsafeAtomicsLLVM v0.1.3 [efce3f68] WoodburyMatrices v0.5.5 [e88e6eb3] Zygote v0.6.64 [700de1a5] ZygoteRules v0.2.3 [f5851436] FFTW_jll v3.3.10+0 [1d5cc7b8] IntelOpenMP_jll v2023.2.0+0 [dad2f222] LLVMExtra_jll v0.0.25+0 [856f044c] MKL_jll v2023.2.0+0 [efe28fd5] OpenSpecFun_jll v0.5.5+0 [f50d1b31] Rmath_jll v0.4.0+0 [0dad84c5] ArgTools v1.1.1 [56f22d72] Artifacts [2a0f44e3] Base64 [ade2ca70] Dates [8ba89e20] Distributed [f43a241f] Downloads v1.6.0 [7b1f6079] FileWatching [9fa8497b] Future [b77e0a4c] InteractiveUtils [4af54fe1] LazyArtifacts [b27032c2] LibCURL v0.6.3 [76f85450] LibGit2 [8f399da3] Libdl [37e2e46d] LinearAlgebra [56ddb016] Logging [d6f4376e] Markdown [a63ad114] Mmap [ca575930] NetworkOptions v1.2.0 [44cfe95a] Pkg v1.9.2 [de0858da] Printf [3fa0cd96] REPL [9a3f8284] Random [ea8e919c] SHA v0.7.0 [9e88b42a] Serialization [1a1011a3] SharedArrays [6462fe0b] Sockets [2f01184e] SparseArrays [10745b16] Statistics v1.9.0 [4607b0f0] SuiteSparse [fa267f1f] TOML v1.0.3 [a4e569a6] Tar v1.10.0 [8dfed614] Test [cf7118a7] UUIDs [4ec0a83e] Unicode [e66e0078] CompilerSupportLibraries_jll v1.0.5+0 [deac9b47] LibCURL_jll v7.84.0+0 [29816b5a] LibSSH2_jll v1.10.2+0 [c8ffd9c3] MbedTLS_jll v2.28.2+0 [14a3606d] MozillaCACerts_jll v2022.10.11 [4536629a] OpenBLAS_jll v0.3.21+4 [05823500] OpenLibm_jll v0.8.1+0 [bea87d4a] SuiteSparse_jll v5.10.1+6 [83775a58] Zlib_jll v1.2.13+0 [8e850b90] libblastrampoline_jll v5.8.0+0 [8e850ede] nghttp2_jll v1.48.0+0 [3f19e933] p7zip_jll v17.4.0+0 Info Packages marked with ⌃ and ⌅ have new versions available, but those with ⌅ are restricted by compatibility constraints from upgrading. To see why use `status --outdated -m`
The text was updated successfully, but these errors were encountered:
This was resolve by #2097
Sorry, something went wrong.
No branches or pull requests
I'm seeing some very strange behavior with compiled ReverseDiff.jl:
It gets the correct results when linking, but not when we don't link.
Notice the differences in the first computations.
What in the world is this? Seen this before @devmotion @willtebbutt @yebai ?
Environment
The text was updated successfully, but these errors were encountered: