diff --git a/.github/workflows/version_check.jl b/.github/workflows/version_check.jl index 555c5758b..35e70bc42 100644 --- a/.github/workflows/version_check.jl +++ b/.github/workflows/version_check.jl @@ -1,6 +1,6 @@ # Set up a temporary environment just to run this script using Pkg -Pkg.activate(temp=true) +Pkg.activate(temp = true) Pkg.add(["YAML", "TOML", "JSON", "HTTP"]) import YAML import TOML @@ -18,7 +18,10 @@ end function major_minor_patch_match(vs...) first = vs[1] - all(v.:major == first.:major && v.:minor == first.:minor && v.:patch == first.:patch for v in vs) + all( + v.:major == first.:major && v.:minor == first.:minor && v.:patch == first.:patch for + v in vs + ) end """ @@ -34,7 +37,10 @@ function update_project_toml(filename, target_version::VersionNumber) open(filename, "w") do io for line in lines if occursin(r"^Turing\s*=\s*\"\d+\.\d+\"\s*$", line) - println(io, "Turing = \"$(target_version.:major).$(target_version.:minor)\"") + println( + io, + "Turing = \"$(target_version.:major).$(target_version.:minor)\"", + ) else println(io, line) end @@ -54,7 +60,10 @@ function update_quarto_yml(filename, target_version::VersionNumber) for line in lines m = match(r"^(\s+)- text:\s*\"v\d+\.\d+\"\s*$", line) if m !== nothing - println(io, "$(m[1])- text: \"v$(target_version.:major).$(target_version.:minor)\"") + println( + io, + "$(m[1])- text: \"v$(target_version.:major).$(target_version.:minor)\"", + ) else println(io, line) end @@ -108,7 +117,7 @@ if ENV["TARGET_IS_MAIN"] == "true" old_env = Pkg.project().path Pkg.activate(".") try - Pkg.add(name="Turing", version=latest_version) + Pkg.add(name = "Turing", version = latest_version) catch e # If the Manifest couldn't be updated, the error will be shown later println(e) @@ -118,14 +127,20 @@ if ENV["TARGET_IS_MAIN"] == "true" manifest_toml = TOML.parsefile(MANIFEST_TOML_PATH) manifest_version = VersionNumber(manifest_toml["deps"]["Turing"][1]["version"]) if !major_minor_patch_match(latest_version, manifest_version) - push!(errors, "Failed to update $(MANIFEST_TOML_PATH) to match latest Turing.jl version") + push!( + errors, + "Failed to update $(MANIFEST_TOML_PATH) to match latest Turing.jl version", + ) end end if isempty(errors) println("All good") else - error("The following errors occurred during version checking: \n", join(errors, "\n")) + error( + "The following errors occurred during version checking: \n", + join(errors, "\n"), + ) end else @@ -135,10 +150,12 @@ else # work as it would involve paging through the list of releases). Instead, # we just check that the minor versions match. if !major_minor_match(quarto_version, project_version, manifest_version) - error("The minor versions of Turing.jl in _quarto.yml, Project.toml, and Manifest.toml are inconsistent: - - _quarto.yml: $quarto_version_str - - Project.toml: $project_version_str - - Manifest.toml: $manifest_version - ") + error( + "The minor versions of Turing.jl in _quarto.yml, Project.toml, and Manifest.toml are inconsistent: + - _quarto.yml: $quarto_version_str + - Project.toml: $project_version_str + - Manifest.toml: $manifest_version + ", + ) end end diff --git a/Manifest.toml b/Manifest.toml index 722bbca36..e41cb809e 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -1,6 +1,6 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.11.5" +julia_version = "1.11.6" manifest_format = "2.0" project_hash = "296b7e06e398e8898b40f44ed92b4d60c484484c" @@ -40,9 +40,9 @@ version = "5.6.3" [[deps.AbstractPPL]] deps = ["AbstractMCMC", "Accessors", "DensityInterface", "JSON", "Random", "StatsBase"] -git-tree-sha1 = "fc3a433ade4210c5c82d8454ff060014ed94d6f0" +git-tree-sha1 = "478b0b6176125cf0a5e6e9fd69fdd0923754531c" uuid = "7a57a42e-76ec-4ea3-a279-07e840d6d9cf" -version = "0.11.0" +version = "0.12.0" [[deps.AbstractTrees]] git-tree-sha1 = "2d9c9a55f9c93e8887ad391fbae72f8ef55e1177" @@ -298,10 +298,10 @@ version = "0.1.1" [[deps.Bijectors]] deps = ["ArgCheck", "ChainRulesCore", "ChangesOfVariables", "Distributions", "DocStringExtensions", "Functors", "InverseFunctions", "IrrationalConstants", "LinearAlgebra", "LogExpFunctions", "MappedArrays", "Random", "Reexport", "Roots", "SparseArrays", "Statistics"] -git-tree-sha1 = "8dbfc7cdb433ffbbcaaa7807c53a90c97c431a27" +git-tree-sha1 = "5eb5a58ed34e012d7f8d665cb5198252e128e907" uuid = "76274a88-744f-5084-9051-94815aaf08c4" -version = "0.15.7" -weakdeps = ["ChainRules", "DistributionsAD", "EnzymeCore", "ForwardDiff", "LazyArrays", "Mooncake", "ReverseDiff", "Tracker", "Zygote"] +version = "0.15.8" +weakdeps = ["ChainRules", "DistributionsAD", "EnzymeCore", "ForwardDiff", "LazyArrays", "Mooncake", "ReverseDiff", "Tracker"] [deps.Bijectors.extensions] BijectorsDistributionsADExt = "DistributionsAD" @@ -312,7 +312,6 @@ weakdeps = ["ChainRules", "DistributionsAD", "EnzymeCore", "ForwardDiff", "LazyA BijectorsReverseDiffChainRulesExt = ["ChainRules", "ReverseDiff"] BijectorsReverseDiffExt = "ReverseDiff" BijectorsTrackerExt = "Tracker" - BijectorsZygoteExt = "Zygote" [[deps.BitFlags]] git-tree-sha1 = "0691e34b3bb8be9307330f88d1a3c3f25466c24d" @@ -339,39 +338,39 @@ version = "5.18.0" [[deps.BoundaryValueDiffEqAscher]] deps = ["ADTypes", "AlmostBlockDiagonals", "BoundaryValueDiffEqCore", "ConcreteStructs", "DiffEqBase", "DifferentiationInterface", "FastClosures", "ForwardDiff", "LinearAlgebra", "PreallocationTools", "RecursiveArrayTools", "Reexport", "SciMLBase", "Setfield"] -git-tree-sha1 = "64a777e06d995f677c86c7ddbb85f393074a0877" +git-tree-sha1 = "47c833c459738a3f27c5b458ecf7832a4731ef4d" uuid = "7227322d-7511-4e07-9247-ad6ff830280e" -version = "1.7.0" +version = "1.8.0" [[deps.BoundaryValueDiffEqCore]] deps = ["ADTypes", "Adapt", "ArrayInterface", "ConcreteStructs", "DiffEqBase", "ForwardDiff", "LineSearch", "LinearAlgebra", "Logging", "NonlinearSolveFirstOrder", "PreallocationTools", "RecursiveArrayTools", "Reexport", "SciMLBase", "Setfield", "SparseArrays", "SparseConnectivityTracer", "SparseMatrixColorings"] -git-tree-sha1 = "c83bf97da90dd379b1e3f4d9c6f3d0ae48eb0b29" +git-tree-sha1 = "9b302ba0af3e17e8d468ae95af13415016be8ab0" uuid = "56b672f2-a5fe-4263-ab2d-da677488eb3a" -version = "1.10.0" +version = "1.11.0" [[deps.BoundaryValueDiffEqFIRK]] deps = ["ADTypes", "ArrayInterface", "BandedMatrices", "BoundaryValueDiffEqCore", "ConcreteStructs", "DiffEqBase", "DifferentiationInterface", "FastAlmostBandedMatrices", "FastClosures", "ForwardDiff", "LinearAlgebra", "PreallocationTools", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "SciMLBase", "Setfield", "SparseArrays"] -git-tree-sha1 = "e58ee9acfc6dce6dcc368fc0483952bec5625513" +git-tree-sha1 = "325e6981a414cfa5181218936c23f0e16dee8f08" uuid = "85d9eb09-370e-4000-bb32-543851f73618" -version = "1.8.1" +version = "1.9.0" [[deps.BoundaryValueDiffEqMIRK]] deps = ["ADTypes", "ArrayInterface", "BandedMatrices", "BoundaryValueDiffEqCore", "ConcreteStructs", "DiffEqBase", "DifferentiationInterface", "FastAlmostBandedMatrices", "FastClosures", "ForwardDiff", "LinearAlgebra", "PreallocationTools", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "SciMLBase", "Setfield", "SparseArrays"] -git-tree-sha1 = "43debeee94167e2dc744f4a385213c4f0d16b4c3" +git-tree-sha1 = "da6ae5e564ad06ced4d7504929c58130558007dd" uuid = "1a22d4ce-7765-49ea-b6f2-13c8438986a6" -version = "1.8.1" +version = "1.9.0" [[deps.BoundaryValueDiffEqMIRKN]] deps = ["ADTypes", "ArrayInterface", "BandedMatrices", "BoundaryValueDiffEqCore", "ConcreteStructs", "DiffEqBase", "DifferentiationInterface", "FastAlmostBandedMatrices", "FastClosures", "ForwardDiff", "LinearAlgebra", "PreallocationTools", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "SciMLBase", "Setfield", "SparseArrays"] -git-tree-sha1 = "1d92c9f7567b627514e143a3caf93af6d235c2db" +git-tree-sha1 = "609c2d03ea024df0d475fee483b93cf0e87c29d6" uuid = "9255f1d6-53bf-473e-b6bd-23f1ff009da4" -version = "1.7.1" +version = "1.8.0" [[deps.BoundaryValueDiffEqShooting]] deps = ["ADTypes", "ArrayInterface", "BandedMatrices", "BoundaryValueDiffEqCore", "ConcreteStructs", "DiffEqBase", "DifferentiationInterface", "FastAlmostBandedMatrices", "FastClosures", "ForwardDiff", "LinearAlgebra", "PreallocationTools", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "SciMLBase", "Setfield", "SparseArrays"] -git-tree-sha1 = "1460c449c91c9bc4c8fb08fb5e878811ab38d667" +git-tree-sha1 = "ba9bd1f31b58bfd5e48a56da0a426bcbd3462546" uuid = "ed55bfe0-3725-4db6-871e-a1dc9f42a757" -version = "1.8.1" +version = "1.9.0" [[deps.BracketingNonlinearSolve]] deps = ["CommonSolve", "ConcreteStructs", "NonlinearSolveBase", "PrecompileTools", "Reexport", "SciMLBase"] @@ -493,9 +492,9 @@ version = "0.7.8" [[deps.ColorSchemes]] deps = ["ColorTypes", "ColorVectorSpace", "Colors", "FixedPointNumbers", "PrecompileTools", "Random"] -git-tree-sha1 = "403f2d8e209681fcbd9468a8514efff3ea08452e" +git-tree-sha1 = "a656525c8b46aa6a1c76891552ed5381bb32ae7b" uuid = "35d6a980-a343-548e-a6ea-1d62b119f2f4" -version = "3.29.0" +version = "3.30.0" [[deps.ColorTypes]] deps = ["FixedPointNumbers", "Random"] @@ -546,9 +545,9 @@ version = "1.0.0" [[deps.Compat]] deps = ["TOML", "UUIDs"] -git-tree-sha1 = "8ae8d32e09f0dcf42a36b90d4e17f5dd2e4c4215" +git-tree-sha1 = "3a3dfb30697e96a440e4149c8c51bf32f818c0f3" uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" -version = "4.16.0" +version = "4.17.0" weakdeps = ["Dates", "LinearAlgebra"] [deps.Compat.extensions] @@ -704,9 +703,9 @@ version = "0.4.0" [[deps.DiffEqBase]] deps = ["ArrayInterface", "ConcreteStructs", "DataStructures", "DocStringExtensions", "EnumX", "EnzymeCore", "FastBroadcast", "FastClosures", "FastPower", "FunctionWrappers", "FunctionWrappersWrappers", "LinearAlgebra", "Logging", "Markdown", "MuladdMacro", "Parameters", "PrecompileTools", "Printf", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "SciMLStructures", "Setfield", "Static", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "TruncatedStacktraces"] -git-tree-sha1 = "2d87d7bd165c1ca0d11923a9fabe90a9d71e88a6" +git-tree-sha1 = "e9b34e0eb3443492f396c97e7fed08630752a4f2" uuid = "2b5f629d-d688-5b77-993f-72d75c75574e" -version = "6.176.0" +version = "6.177.2" [deps.DiffEqBase.extensions] DiffEqBaseCUDAExt = "CUDA" @@ -778,9 +777,9 @@ version = "7.16.1" [[deps.DifferentiationInterface]] deps = ["ADTypes", "LinearAlgebra"] -git-tree-sha1 = "210933c93f39f832d92f9efbbe69a49c453db36d" +git-tree-sha1 = "c092fd1dd0d94e609cd0d29e13897b2825c804bb" uuid = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63" -version = "0.7.1" +version = "0.7.2" [deps.DifferentiationInterface.extensions] DifferentiationInterfaceChainRulesCoreExt = "ChainRulesCore" @@ -828,15 +827,14 @@ version = "0.7.1" [[deps.DispatchDoctor]] deps = ["MacroTools", "Preferences"] -git-tree-sha1 = "f8768e80847f15f91b01a84df19ea0cf3661e51e" +git-tree-sha1 = "fc34127e78323c49984e1a146d577d0f890dd2b4" uuid = "8d63f2c5-f18a-4cf2-ba9d-b3f60fc568c8" -version = "0.4.20" -weakdeps = ["ChainRulesCore", "EnzymeCore", "Mooncake"] +version = "0.4.26" +weakdeps = ["ChainRulesCore", "EnzymeCore"] [deps.DispatchDoctor.extensions] DispatchDoctorChainRulesCoreExt = "ChainRulesCore" DispatchDoctorEnzymeCoreExt = "EnzymeCore" - DispatchDoctorMooncakeExt = "Mooncake" [[deps.Distances]] deps = ["LinearAlgebra", "Statistics", "StatsAPI"] @@ -897,9 +895,9 @@ version = "3.5.1" [[deps.DynamicPPL]] deps = ["ADTypes", "AbstractMCMC", "AbstractPPL", "Accessors", "BangBang", "Bijectors", "Chairmarks", "Compat", "ConstructionBase", "DifferentiationInterface", "Distributions", "DocStringExtensions", "InteractiveUtils", "LinearAlgebra", "LogDensityProblems", "MacroTools", "OrderedCollections", "Random", "Requires", "Statistics", "Test"] -git-tree-sha1 = "3738067172de6585ebed513da5623ad5b5301e66" +git-tree-sha1 = "07218fc45d4f1abc9de4498e8cf966b6672c84f0" uuid = "366bfd00-2699-11ea-058f-f148b4cae6d8" -version = "0.36.12" +version = "0.36.15" [deps.DynamicPPL.extensions] DynamicPPLChainRulesCoreExt = ["ChainRulesCore"] @@ -931,9 +929,9 @@ version = "1.0.5" [[deps.Enzyme]] deps = ["CEnum", "EnzymeCore", "Enzyme_jll", "GPUCompiler", "InteractiveUtils", "LLVM", "Libdl", "LinearAlgebra", "ObjectFile", "PrecompileTools", "Preferences", "Printf", "Random", "SparseArrays"] -git-tree-sha1 = "de7f70d73805f4e1a32395afc9d580e4ffc62924" +git-tree-sha1 = "6d85ffa95b11e51f82dd72efea1f88b88d7ec444" uuid = "7da242da-08ed-463a-9acd-ee780be4f1d9" -version = "0.13.51" +version = "0.13.59" [deps.Enzyme.extensions] EnzymeBFloat16sExt = "BFloat16s" @@ -962,9 +960,9 @@ weakdeps = ["Adapt"] [[deps.Enzyme_jll]] deps = ["Artifacts", "JLLWrappers", "LazyArtifacts", "Libdl", "TOML"] -git-tree-sha1 = "97e0a9a3fa1c51ebd94dd076dd847c037b79fd79" +git-tree-sha1 = "7ea609b06402406450cd8c73bc6adbbb1f7fffc0" uuid = "7cc45869-7501-5eee-bdea-0790c847d4ef" -version = "0.0.183+0" +version = "0.0.185+0" [[deps.EpollShim_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] @@ -1250,9 +1248,9 @@ version = "0.2.0" [[deps.GPUCompiler]] deps = ["ExprTools", "InteractiveUtils", "LLVM", "Libdl", "Logging", "PrecompileTools", "Preferences", "Scratch", "Serialization", "TOML", "Tracy", "UUIDs"] -git-tree-sha1 = "bbb7004345fb6141989835fc9f2f9e93bba3c806" +git-tree-sha1 = "eb1e212e12cc058fa16712082d44be499d23638c" uuid = "61eb1bfa-7361-4325-ad38-22787b887f55" -version = "1.5.3" +version = "1.6.1" [[deps.GR]] deps = ["Artifacts", "Base64", "DelimitedFiles", "Downloads", "GR_jll", "HTTP", "JSON", "Libdl", "LinearAlgebra", "Preferences", "Printf", "Qt6Wayland_jll", "Random", "Serialization", "Sockets", "TOML", "Tar", "Test", "p7zip_jll"] @@ -1499,9 +1497,9 @@ weakdeps = ["FastBroadcast"] [[deps.KernelAbstractions]] deps = ["Adapt", "Atomix", "InteractiveUtils", "MacroTools", "PrecompileTools", "Requires", "StaticArrays", "UUIDs"] -git-tree-sha1 = "602c0e9efadafb8abfe8281c3fbf9cf6f406fc03" +git-tree-sha1 = "38a03910123867c11af988e8718d12c98bf6a234" uuid = "63c18a36-062a-441e-b654-da1e3ab1ce7c" -version = "0.9.35" +version = "0.9.37" weakdeps = ["EnzymeCore", "LinearAlgebra", "SparseArrays"] [deps.KernelAbstractions.extensions] @@ -1511,9 +1509,9 @@ weakdeps = ["EnzymeCore", "LinearAlgebra", "SparseArrays"] [[deps.KernelDensity]] deps = ["Distributions", "DocStringExtensions", "FFTW", "Interpolations", "StatsBase"] -git-tree-sha1 = "7d703202e65efa1369de1279c162b915e245eed1" +git-tree-sha1 = "ba51324b894edaf1df3ab16e2cc6bc3280a2f1a7" uuid = "5ab0869b-81aa-558d-bb23-cbf5423bbe9b" -version = "0.6.9" +version = "0.6.10" [[deps.KernelFunctions]] deps = ["ChainRulesCore", "Compat", "CompositionsBase", "Distances", "FillArrays", "Functors", "IrrationalConstants", "LinearAlgebra", "LogExpFunctions", "Random", "Requires", "SpecialFunctions", "Statistics", "StatsBase", "TensorCore", "Test", "ZygoteRules"] @@ -1529,9 +1527,9 @@ version = "0.10.1" [[deps.LAME_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] -git-tree-sha1 = "170b660facf5df5de098d866564877e119141cbd" +git-tree-sha1 = "059aabebaa7c82ccb853dd4a0ee9d17796f7e1bc" uuid = "c1c5ebd0-6772-5130-a774-d5fcae4a789d" -version = "3.100.2+0" +version = "3.100.3+0" [[deps.LBFGSB]] deps = ["L_BFGS_B_jll"] @@ -1866,9 +1864,9 @@ version = "1.1.0" [[deps.Lux]] deps = ["ADTypes", "Adapt", "ArgCheck", "ArrayInterface", "ChainRulesCore", "Compat", "ConcreteStructs", "DiffResults", "DispatchDoctor", "EnzymeCore", "FastClosures", "ForwardDiff", "Functors", "GPUArraysCore", "LinearAlgebra", "LuxCore", "LuxLib", "MLDataDevices", "MacroTools", "Markdown", "NNlib", "Optimisers", "Preferences", "Random", "Reexport", "SIMDTypes", "Setfield", "Static", "StaticArraysCore", "Statistics", "WeightInitializers"] -git-tree-sha1 = "9f081e4adc791fea3288e065b8266f60019aa3ad" +git-tree-sha1 = "c05e5c3dca1810e728429771763b485057322ad2" uuid = "b2108857-7c20-44ae-9111-449ecde12c47" -version = "1.13.5" +version = "1.16.0" [deps.Lux.extensions] LuxComponentArraysExt = "ComponentArrays" @@ -1878,6 +1876,7 @@ version = "1.13.5" LuxMLUtilsExt = "MLUtils" LuxMPIExt = "MPI" LuxMPINCCLExt = ["CUDA", "MPI", "NCCL"] + LuxMooncakeExt = "Mooncake" LuxReactantExt = ["Enzyme", "Reactant", "ReactantCore"] LuxReverseDiffExt = ["FunctionWrappers", "ReverseDiff"] LuxSimpleChainsExt = "SimpleChains" @@ -1893,6 +1892,7 @@ version = "1.13.5" LossFunctions = "30fc2ffe-d236-52d8-8643-a9d8f7c094a7" MLUtils = "f1d291b0-491e-4a28-83b9-f70985020b54" MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195" + Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" NCCL = "3fe64909-d7a1-4096-9b7d-7a0f12cf0f6b" Reactant = "3c362404-f566-11ee-1572-e11a4b42c853" ReactantCore = "a3311ec8-5e00-46d5-b541-4f83e724a433" @@ -1931,9 +1931,9 @@ version = "1.2.6" [[deps.LuxLib]] deps = ["ArrayInterface", "CPUSummary", "ChainRulesCore", "Compat", "DispatchDoctor", "EnzymeCore", "FastClosures", "ForwardDiff", "Functors", "KernelAbstractions", "LinearAlgebra", "LuxCore", "MLDataDevices", "Markdown", "NNlib", "Polyester", "Preferences", "Random", "Reexport", "Static", "StaticArraysCore", "Statistics"] -git-tree-sha1 = "b06b83e48cfbfc2ea25ec673537e7eb7e69879e9" +git-tree-sha1 = "a3c5d3485c6cdf0c13d81678b9c82a6f4e5e4eca" uuid = "82251201-b29d-42c6-8e01-566dec8acb11" -version = "1.8.0" +version = "1.10.0" [deps.LuxLib.extensions] LuxLibAppleAccelerateExt = "AppleAccelerate" @@ -1942,6 +1942,7 @@ version = "1.8.0" LuxLibEnzymeExt = "Enzyme" LuxLibLoopVectorizationExt = "LoopVectorization" LuxLibMKLExt = "MKL" + LuxLibMooncakeExt = "Mooncake" LuxLibOctavianExt = ["Octavian", "LoopVectorization"] LuxLibReactantExt = "Reactant" LuxLibReverseDiffExt = "ReverseDiff" @@ -1958,6 +1959,7 @@ version = "1.8.0" Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9" LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890" MKL = "33e6dc65-8f57-5167-99aa-e5a354878fb2" + Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" Octavian = "6fd5a793-0b7e-452c-907f-f8bfe9c57db4" Reactant = "3c362404-f566-11ee-1572-e11a4b42c853" ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267" @@ -1991,9 +1993,9 @@ version = "1.0.0" [[deps.MLDataDevices]] deps = ["Adapt", "Compat", "Functors", "Preferences", "Random"] -git-tree-sha1 = "a47f08b67298dee5778cf279a9a735ca2d11a890" +git-tree-sha1 = "209390b236bb04b289c708054fe1df06a4b314b5" uuid = "7e8f7934-dd98-4c1a-8fe8-92b47a384d40" -version = "1.10.0" +version = "1.11.0" [deps.MLDataDevices.extensions] MLDataDevicesAMDGPUExt = "AMDGPU" @@ -2190,10 +2192,10 @@ uuid = "78c3b35d-d492-501b-9361-3d52fe80e533" version = "0.8.1" [[deps.Mooncake]] -deps = ["ADTypes", "ChainRules", "ChainRulesCore", "DiffRules", "ExprTools", "FunctionWrappers", "GPUArraysCore", "Graphs", "InteractiveUtils", "LinearAlgebra", "MistyClosures", "Random", "Test"] -git-tree-sha1 = "877c9084a22143d03c2a4f99228f89cb5728ecb4" +deps = ["ADTypes", "ChainRules", "ChainRulesCore", "DiffRules", "DispatchDoctor", "ExprTools", "FunctionWrappers", "GPUArraysCore", "Graphs", "InteractiveUtils", "LinearAlgebra", "MistyClosures", "Random", "Test"] +git-tree-sha1 = "005e57fd321b90e9ae47c7cbb5dbdfff78651623" uuid = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" -version = "0.4.128" +version = "0.4.138" [deps.Mooncake.extensions] MooncakeAllocCheckExt = "AllocCheck" @@ -2219,9 +2221,9 @@ version = "0.4.128" [[deps.Moshi]] deps = ["ExproniconLite", "Jieko"] -git-tree-sha1 = "d5198869af7a8aec7354dc8559ae71aba77a625a" +git-tree-sha1 = "53f817d3e84537d84545e0ad749e483412dd6b2a" uuid = "2e0e35c7-a2e4-4343-998d-7ef72827ed2d" -version = "0.3.6" +version = "0.3.7" [[deps.MozillaCACerts_jll]] uuid = "14a3606d-f60d-562e-9121-12d972cd8159" @@ -2246,9 +2248,9 @@ version = "7.10.0" [[deps.NLopt]] deps = ["CEnum", "NLopt_jll"] -git-tree-sha1 = "35a8d661041aa6a237d10e12c29a7251a58bf488" +git-tree-sha1 = "de3a001641c8b9fb52b96082327f5f99ae302fcc" uuid = "76087f3c-5699-56af-9a33-bf431cd00edd" -version = "1.1.4" +version = "1.2.0" [deps.NLopt.extensions] NLoptMathOptInterfaceExt = ["MathOptInterface"] @@ -2317,9 +2319,9 @@ version = "1.0.0" [[deps.NearestNeighbors]] deps = ["Distances", "StaticArrays"] -git-tree-sha1 = "8a3271d8309285f4db73b4f662b1b290c715e85e" +git-tree-sha1 = "ca7e18198a166a1f3eb92a3650d53d94ed8ca8a1" uuid = "b8a86587-4115-5ab1-83bc-aa920d37bbce" -version = "0.4.21" +version = "0.4.22" [[deps.NetworkOptions]] uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" @@ -2420,10 +2422,10 @@ weakdeps = ["Adapt"] OffsetArraysAdaptExt = "Adapt" [[deps.Ogg_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "887579a3eb005446d514ab7aeac5d1d027658b8f" +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "b6aa4566bb7ae78498a5e68943863fa8b5231b59" uuid = "e7412a2a-1a6e-54c0-be00-318e2571c051" -version = "1.3.5+1" +version = "1.3.6+0" [[deps.OneHotArrays]] deps = ["Adapt", "ChainRulesCore", "Compat", "GPUArraysCore", "LinearAlgebra", "NNlib"] @@ -2455,9 +2457,9 @@ version = "1.5.0" [[deps.OpenSSL_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] -git-tree-sha1 = "9216a80ff3682833ac4b733caa8c00390620ba5d" +git-tree-sha1 = "87510f7292a2b21aeff97912b0898f9553cc5c2c" uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95" -version = "3.5.0+0" +version = "3.5.1+0" [[deps.OpenSpecFun_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl"] @@ -2541,9 +2543,9 @@ version = "0.4.3" [[deps.Opus_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] -git-tree-sha1 = "6703a85cb3781bd5909d48730a67205f3f31a575" +git-tree-sha1 = "c392fc5dd032381919e3b22dd32d6443760ce7ea" uuid = "91d4177d-7536-5919-b921-800302f37372" -version = "1.3.3+0" +version = "1.5.2+0" [[deps.OrderedCollections]] git-tree-sha1 = "05868e21324cede2207c6f0f466b4bfef6d5e7ee" @@ -2570,19 +2572,20 @@ version = "1.6.0" [[deps.OrdinaryDiffEqCore]] deps = ["ADTypes", "Accessors", "Adapt", "ArrayInterface", "DataStructures", "DiffEqBase", "DocStringExtensions", "EnumX", "FastBroadcast", "FastClosures", "FastPower", "FillArrays", "FunctionWrappersWrappers", "InteractiveUtils", "LinearAlgebra", "Logging", "MacroTools", "MuladdMacro", "Polyester", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "SciMLStructures", "SimpleUnPack", "Static", "StaticArrayInterface", "StaticArraysCore", "SymbolicIndexingInterface", "TruncatedStacktraces"] -git-tree-sha1 = "08dac9c6672a4548439048089bac293759a897fd" +git-tree-sha1 = "1bd20b621e8dee5f2d170ae31631bf573ab77eec" uuid = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" -version = "1.26.1" -weakdeps = ["EnzymeCore"] +version = "1.26.2" +weakdeps = ["EnzymeCore", "Mooncake"] [deps.OrdinaryDiffEqCore.extensions] OrdinaryDiffEqCoreEnzymeCoreExt = "EnzymeCore" + OrdinaryDiffEqCoreMooncakeExt = "Mooncake" [[deps.OrdinaryDiffEqDefault]] deps = ["ADTypes", "DiffEqBase", "EnumX", "LinearAlgebra", "LinearSolve", "OrdinaryDiffEqBDF", "OrdinaryDiffEqCore", "OrdinaryDiffEqRosenbrock", "OrdinaryDiffEqTsit5", "OrdinaryDiffEqVerner", "PrecompileTools", "Preferences", "Reexport"] -git-tree-sha1 = "8eeed32442874d1bdcc2192a874a73f1a9a07e31" +git-tree-sha1 = "7e2f4ec76ebac709401064fd2cf73ad993d1e694" uuid = "50262376-6c5a-4cf5-baba-aaf4f84d72d7" -version = "1.4.0" +version = "1.5.0" [[deps.OrdinaryDiffEqDifferentiation]] deps = ["ADTypes", "ArrayInterface", "ConcreteStructs", "ConstructionBase", "DiffEqBase", "DifferentiationInterface", "FastBroadcast", "FiniteDiff", "ForwardDiff", "FunctionWrappersWrappers", "LinearAlgebra", "LinearSolve", "OrdinaryDiffEqCore", "SciMLBase", "SciMLOperators", "SparseArrays", "SparseMatrixColorings", "StaticArrayInterface", "StaticArrays"] @@ -2804,9 +2807,9 @@ version = "1.4.3" [[deps.Plots]] deps = ["Base64", "Contour", "Dates", "Downloads", "FFMPEG", "FixedPointNumbers", "GR", "JLFzf", "JSON", "LaTeXStrings", "Latexify", "LinearAlgebra", "Measures", "NaNMath", "Pkg", "PlotThemes", "PlotUtils", "PrecompileTools", "Printf", "REPL", "Random", "RecipesBase", "RecipesPipeline", "Reexport", "RelocatableFolders", "Requires", "Scratch", "Showoff", "SparseArrays", "Statistics", "StatsBase", "TOML", "UUIDs", "UnicodeFun", "UnitfulLatexify", "Unzip"] -git-tree-sha1 = "28ea788b78009c695eb0d637587c81d26bdf0e36" +git-tree-sha1 = "55818b50883d7141bd98cdf5fc2f4ced96ee075f" uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" -version = "1.40.14" +version = "1.40.16" [deps.Plots.extensions] FileIOExt = "FileIO" @@ -2823,10 +2826,10 @@ version = "1.40.14" Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" [[deps.PoissonRandom]] -deps = ["Random"] -git-tree-sha1 = "a0f1159c33f846aa77c3f30ebbc69795e5327152" +deps = ["LogExpFunctions", "Random"] +git-tree-sha1 = "bb178012780b34046c6d1600a315d8dbee89d83d" uuid = "e409e4f3-bfea-5376-8464-e040bb5c01ab" -version = "0.4.4" +version = "0.4.5" [[deps.Polyester]] deps = ["ArrayInterface", "BitTwiddlingConvenienceFunctions", "CPUSummary", "IfElse", "ManualMemory", "PolyesterWeave", "Static", "StaticArrayInterface", "StrideArraysCore", "ThreadingUtilities"] @@ -2854,9 +2857,9 @@ version = "0.2.4" [[deps.PreallocationTools]] deps = ["Adapt", "ArrayInterface", "ForwardDiff"] -git-tree-sha1 = "6d98eace73d82e47f5b16c393de198836d9f790a" +git-tree-sha1 = "7a5e02659e293b25a4bfaeeb6cd268acd0742eba" uuid = "d236fae5-4411-538c-8e31-a6e3d9e00b46" -version = "0.4.27" +version = "0.4.28" weakdeps = ["ReverseDiff", "SparseConnectivityTracer"] [deps.PreallocationTools.extensions] @@ -3011,13 +3014,14 @@ version = "0.6.12" [[deps.RecursiveArrayTools]] deps = ["Adapt", "ArrayInterface", "DocStringExtensions", "GPUArraysCore", "IteratorInterfaceExtensions", "LinearAlgebra", "RecipesBase", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "Tables"] -git-tree-sha1 = "2e154f7d7e38db1af0a14ec751aba33360c3bef9" +git-tree-sha1 = "efc718978d97745c58e69c5115a35c51a080e45e" uuid = "731186ca-8d62-57ce-b412-fbd966d074cd" -version = "3.33.0" +version = "3.34.1" [deps.RecursiveArrayTools.extensions] RecursiveArrayToolsFastBroadcastExt = "FastBroadcast" RecursiveArrayToolsForwardDiffExt = "ForwardDiff" + RecursiveArrayToolsKernelAbstractionsExt = "KernelAbstractions" RecursiveArrayToolsMeasurementsExt = "Measurements" RecursiveArrayToolsMonteCarloMeasurementsExt = "MonteCarloMeasurements" RecursiveArrayToolsReverseDiffExt = ["ReverseDiff", "Zygote"] @@ -3029,6 +3033,7 @@ version = "3.33.0" [deps.RecursiveArrayTools.weakdeps] FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" + KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c" Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7" MonteCarloMeasurements = "0987c9cc-fe09-11e8-30f0-b96dd679fdca" ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267" @@ -3121,9 +3126,9 @@ version = "0.5.0" [[deps.SciMLBase]] deps = ["ADTypes", "Accessors", "Adapt", "ArrayInterface", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "EnumX", "FunctionWrappersWrappers", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "Moshi", "PrecompileTools", "Preferences", "Printf", "RecipesBase", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLOperators", "SciMLStructures", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface"] -git-tree-sha1 = "31587e20cdea9fba3a689033313e658dfc9aae78" +git-tree-sha1 = "e6a28a9a2dd9bc3ed46391fa0e6c35839bde4028" uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462" -version = "2.102.1" +version = "2.103.0" [deps.SciMLBase.extensions] SciMLBaseChainRulesCoreExt = "ChainRulesCore" @@ -3165,9 +3170,9 @@ weakdeps = ["SparseArrays", "StaticArraysCore"] [[deps.SciMLSensitivity]] deps = ["ADTypes", "Accessors", "Adapt", "ArrayInterface", "ChainRulesCore", "DiffEqBase", "DiffEqCallbacks", "DiffEqNoiseProcess", "Distributions", "Enzyme", "FastBroadcast", "FiniteDiff", "ForwardDiff", "FunctionProperties", "FunctionWrappersWrappers", "Functors", "GPUArraysCore", "LinearAlgebra", "LinearSolve", "Markdown", "OrdinaryDiffEqCore", "PreallocationTools", "QuadGK", "Random", "RandomNumbers", "RecursiveArrayTools", "Reexport", "ReverseDiff", "SciMLBase", "SciMLJacobianOperators", "SciMLStructures", "StaticArrays", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "Tracker", "Zygote"] -git-tree-sha1 = "3228b1943c449d0f21b3dcd8741deff054b9ace7" +git-tree-sha1 = "f4af350e4b1e7200a2143a4fb16362133f2ef288" uuid = "1ed8b502-d754-442c-8d5d-10ac956f44a1" -version = "7.86.1" +version = "7.87.0" weakdeps = ["Mooncake"] [deps.SciMLSensitivity.extensions] @@ -3376,9 +3381,9 @@ version = "1.4.3" [[deps.StatisticalTraits]] deps = ["ScientificTypesBase"] -git-tree-sha1 = "542d979f6e756f13f862aa00b224f04f9e445f11" +git-tree-sha1 = "89f86d9376acd18a1a4fbef66a56335a3a7633b8" uuid = "64bff920-2084-43da-a3e6-9bb72801c0c9" -version = "3.4.0" +version = "3.5.0" [[deps.Statistics]] deps = ["LinearAlgebra"] @@ -3445,9 +3450,9 @@ version = "0.5.7" [[deps.Strided]] deps = ["LinearAlgebra", "StridedViews", "TupleTools"] -git-tree-sha1 = "4a1128f5237b5d0170d934a2eb4fa7a273639c9f" +git-tree-sha1 = "c2e72c33ac8871d104901db736aecb36b223f10c" uuid = "5e0ebb24-38b0-5f93-81fe-25c709ecae67" -version = "2.3.0" +version = "2.3.2" [[deps.StridedViews]] deps = ["LinearAlgebra", "PackageExtensionCompat"] @@ -3616,9 +3621,9 @@ weakdeps = ["PDMats"] [[deps.Tracy]] deps = ["ExprTools", "LibTracyClient_jll", "Libdl"] -git-tree-sha1 = "16439d004690d4086da35528f0c6b4d7006d6dae" +git-tree-sha1 = "91dbaee0f50faa4357f7e9fc69442c7b6364dfe5" uuid = "e689c965-62c8-4b79-b2c5-8359227902fd" -version = "0.1.4" +version = "0.1.5" [deps.Tracy.extensions] TracyProfilerExt = "TracyProfiler_jll" @@ -3672,9 +3677,9 @@ version = "1.6.0" [[deps.Turing]] deps = ["ADTypes", "AbstractMCMC", "AbstractPPL", "Accessors", "AdvancedHMC", "AdvancedMH", "AdvancedPS", "AdvancedVI", "BangBang", "Bijectors", "Compat", "DataStructures", "Distributions", "DistributionsAD", "DocStringExtensions", "DynamicPPL", "EllipticalSliceSampling", "ForwardDiff", "Libtask", "LinearAlgebra", "LogDensityProblems", "MCMCChains", "NamedArrays", "Optimization", "OptimizationOptimJL", "OrderedCollections", "Printf", "Random", "Reexport", "SciMLBase", "SpecialFunctions", "Statistics", "StatsAPI", "StatsBase", "StatsFuns"] -git-tree-sha1 = "a2f0daaef3563e3e4fb94ced7cb22b7a0e18912f" +git-tree-sha1 = "ed8145c83b824e67a94b5bbe5be231991deda154" uuid = "fce5fe82-541a-59a6-adf8-730c64b5f9a0" -version = "0.39.3" +version = "0.39.4" weakdeps = ["DynamicHMC", "Optim"] [deps.Turing.extensions] @@ -3682,9 +3687,9 @@ weakdeps = ["DynamicHMC", "Optim"] TuringOptimExt = "Optim" [[deps.URIs]] -git-tree-sha1 = "24c1c558881564e2217dcf7840a8b2e10caeb0f9" +git-tree-sha1 = "bef26fb046d031353ef97a82e3fdb6afe7f21b1a" uuid = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" -version = "1.6.0" +version = "1.6.1" [[deps.UUIDs]] deps = ["Random", "SHA"] @@ -3746,10 +3751,10 @@ uuid = "a44049a8-05dd-5a78-86c9-5fde0876e88c" version = "1.3.243+0" [[deps.Wayland_jll]] -deps = ["Artifacts", "EpollShim_jll", "Expat_jll", "JLLWrappers", "Libdl", "Libffi_jll", "XML2_jll"] -git-tree-sha1 = "53ab3e9c94f4343c68d5905565be63002e13ec8c" +deps = ["Artifacts", "EpollShim_jll", "Expat_jll", "JLLWrappers", "Libdl", "Libffi_jll"] +git-tree-sha1 = "96478df35bbc2f3e1e791bc7a3d0eeee559e60e9" uuid = "a2964d1f-97da-50d4-b82a-358c7fce9d89" -version = "1.23.1+1" +version = "1.24.0+0" [[deps.WeakRefStrings]] deps = ["DataAPI", "InlineStrings", "Parsers"] @@ -3798,12 +3803,6 @@ git-tree-sha1 = "cd1659ba0d57b71a464a29e64dbc67cfe83d54e7" uuid = "76eceee3-57b5-4d4a-8e66-0e911cebbf60" version = "1.6.1" -[[deps.XML2_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Libiconv_jll", "Zlib_jll"] -git-tree-sha1 = "b8b243e47228b4a3877f1dd6aee0c5d56db7fcf4" -uuid = "02c8fc9c-b97f-50b9-bbe4-9be30ff0a78a" -version = "2.13.6+1" - [[deps.XZ_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] git-tree-sha1 = "fee71455b0aaa3440dfdd54a9a36ccef829be7d4" @@ -4032,9 +4031,9 @@ version = "1.13.4+0" [[deps.libfdk_aac_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] -git-tree-sha1 = "8a22cf860a7d27e4f3498a0fe0811a7957badb38" +git-tree-sha1 = "646634dd19587a56ee2f1199563ec056c5f228df" uuid = "f638f0a6-7fb0-5443-88ba-1cc74229b280" -version = "2.0.3+0" +version = "2.0.4+0" [[deps.libinput_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "eudev_jll", "libevdev_jll", "mtdev_jll"] @@ -4044,15 +4043,15 @@ version = "1.28.1+0" [[deps.libpng_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Zlib_jll"] -git-tree-sha1 = "cd155272a3738da6db765745b89e466fa64d0830" +git-tree-sha1 = "07b6a107d926093898e82b3b1db657ebe33134ec" uuid = "b53b4c65-9356-5827-b1ea-8c7a1a84506f" -version = "1.6.49+0" +version = "1.6.50+0" [[deps.libvorbis_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Ogg_jll", "Pkg"] -git-tree-sha1 = "490376214c4721cdaca654041f635213c6165cb3" +deps = ["Artifacts", "JLLWrappers", "Libdl", "Ogg_jll"] +git-tree-sha1 = "11e1772e7f3cc987e9d3de991dd4f6b2602663a5" uuid = "f27f6e37-5d2b-51aa-960f-b287f2bc3b7a" -version = "1.3.7+2" +version = "1.3.8+0" [[deps.mtdev_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] diff --git a/_quarto.yml b/_quarto.yml index fbb6b868c..e9bba3b7b 100644 --- a/_quarto.yml +++ b/_quarto.yml @@ -24,6 +24,8 @@ website: text: Get Started - href: tutorials/coin-flipping/ text: Tutorials + - href: faq/ + text: FAQ - href: https://turinglang.org/library/ text: Libraries - href: https://turinglang.org/news/ diff --git a/faq/index.qmd b/faq/index.qmd new file mode 100644 index 000000000..635ba098c --- /dev/null +++ b/faq/index.qmd @@ -0,0 +1,141 @@ +--- +title: "Frequently Asked Questions" +description: "Common questions and answers about using Turing.jl" +--- + +## Why is this variable being treated as random instead of observed? + +This is a common source of confusion. In Turing.jl, you can only condition or fix expressions that explicitly appear on the left-hand side (LHS) of a `~` statement. + +For example, if your model contains: +```julia +x ~ filldist(Normal(), 2) +``` + +You cannot directly condition on `x[2]` using `condition(model, @varname(x[2]) => 1.0)` because `x[2]` never appears on the LHS of a `~` statement. Only `x` as a whole appears there. + +However, there is an important exception: when you use the broadcasting operator `.~` with a univariate distribution, each element is treated as being separately drawn from that distribution, allowing you to condition on individual elements: + +```julia +@model function f1() + x = Vector{Float64}(undef, 3) + x .~ Normal() # Each element is a separate draw +end + +m1 = f1() | (@varname(x[1]) => 1.0) +sample(m1, NUTS(), 100) # This works! +``` + +In contrast, you cannot condition on parts of a multivariate distribution because it represents a single distribution over the entire vector: + +```julia +@model function f2() + x = Vector{Float64}(undef, 3) + x ~ MvNormal(zeros(3), I) # Single multivariate distribution +end + +m2 = f2() | (@varname(x[1]) => 1.0) +sample(m2, NUTS(), 100) # This doesn't work! +``` + +The key insight is that `filldist` creates a single distribution (not N independent distributions), which is why you cannot condition on individual elements. The distinction is not just about what appears on the LHS of `~`, but whether you're dealing with separate distributions (`.~` with univariate) or a single distribution over multiple values (`~` with multivariate or `filldist`). + +To understand more about how Turing determines whether a variable is treated as random or observed, see: +- [Core Functionality]({{< meta core-functionality >}}) - basic explanation of the `~` notation and conditioning + + +## Can I use parallelism / threads in my model? + +Yes, but with important caveats! There are two types of parallelism to consider: + +### 1. Parallel Sampling (Multiple Chains) +Turing.jl fully supports sampling multiple chains in parallel: +- **Multithreaded sampling**: Use `MCMCThreads()` to run one chain per thread +- **Distributed sampling**: Use `MCMCDistributed()` for distributed computing + +See the [Core Functionality guide](../core-functionality/#sampling-multiple-chains) for examples. + +### 2. Threading Within Models +Using threads inside your model (e.g., `Threads.@threads`) requires more care: + +```julia +@model function f(y) + x = Vector{Float64}(undef, length(y)) + Threads.@threads for i in eachindex(y) + x[i] ~ Normal() # UNSAFE: `assume` statements in @threads can crash! + y[i] ~ Normal(x[i]) # `observe` statements are okay + end +end +``` + +**Important limitations:** +- **Observe statements**: Generally safe to use in threaded loops +- **Assume statements** (sampling statements): Often crash unpredictably or produce incorrect results +- **AD backend compatibility**: Many AD backends don't support threading. Check the [multithreaded column in ADTests](https://turinglang.org/ADTests/) for compatibility + +For safe parallelism within models, consider vectorized operations instead of explicit threading. + +## How do I check the type stability of my Turing model? + +Type stability is crucial for performance. Check out: +- [Performance Tips]({{< meta usage-performance-tips >}}) - includes specific advice on type stability +- Use `DynamicPPL.DebugUtils.model_warntype` to check type stability of your model + +## How do I debug my Turing model? + +For debugging both statistical and syntactical issues: +- [Troubleshooting Guide]({{< meta usage-troubleshooting >}}) - common errors and their solutions +- For more advanced debugging, DynamicPPL provides [the `DynamicPPL.DebugUtils` module](https://turinglang.org/DynamicPPL.jl/stable/api/#Debugging-Utilities) for inspecting model internals + +## What are the main differences between Turing and Stan syntax? + +Key syntactic differences include: + +- **Parameter blocks**: Stan requires explicit `data`, `parameters`, and `model` blocks. In Turing, everything is defined within the `@model` macro +- **Variable declarations**: Stan requires upfront type declarations in parameter blocks. Turing infers types from the sampling statements +- **Transformed data**: Stan has a `transformed data` block for preprocessing. In Turing, data transformations should be done before defining the model +- **Generated quantities**: Stan has a `generated quantities` block. In Turing, use the approach described in [Tracking Extra Quantities]({{< meta usage-tracking-extra-quantities >}}) + +Example comparison: +```stan +// Stan +data { + int N; + vector[N] y; +} +parameters { + real mu; + real sigma; +} +model { + mu ~ normal(0, 1); + sigma ~ normal(0, 1); + y ~ normal(mu, sigma); +} +``` + +```julia +# Turing +@model function my_model(y) + mu ~ Normal(0, 1) + sigma ~ truncated(Normal(0, 1); lower=0) + y ~ Normal(mu, sigma) +end +``` + +## Which automatic differentiation backend should I use? + +The choice of AD backend can significantly impact performance. See: +- [Automatic Differentiation Guide]({{< meta usage-automatic-differentiation >}}) - comprehensive comparison of ForwardDiff, Mooncake, ReverseDiff, and other backends +- [Performance Tips]({{< meta usage-performance-tips >}}#choose-your-ad-backend) - quick guide on choosing backends +- [AD Backend Benchmarks](https://turinglang.org/ADTests/) - performance comparisons across various models + +## I changed one line of my model and now it's so much slower; why? + +Small changes can have big performance impacts. Common culprits include: +- Type instability introduced by the change +- Switching from vectorized to scalar operations (or vice versa) +- Inadvertently causing AD backend incompatibilities +- Breaking assumptions that allowed compiler optimizations + +See our [Performance Tips]({{< meta usage-performance-tips >}}) and [Troubleshooting Guide]({{< meta usage-troubleshooting >}}) for debugging performance regressions. \ No newline at end of file pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy