From 7e6f69591068a479ed3ab4eeb445dfe66460d629 Mon Sep 17 00:00:00 2001 From: Nikolas Siccha Date: Thu, 19 Dec 2024 12:59:06 +0100 Subject: [PATCH] Add @dynamicstruct and bump version --- docs/.gitignore | 10 +- docs/Manifest.toml | 891 +++++++++++++++++++++++++++++++++++++++++++++ docs/Project.toml | 13 +- docs/_quarto.yml | 18 + docs/index.qmd | 217 +++++++++++ docs/make.jl | 13 - docs/src/index.md | 11 - 7 files changed, 1147 insertions(+), 26 deletions(-) create mode 100644 docs/Manifest.toml create mode 100644 docs/_quarto.yml create mode 100644 docs/index.qmd delete mode 100644 docs/make.jl delete mode 100644 docs/src/index.md diff --git a/docs/.gitignore b/docs/.gitignore index 8a53584..e93534d 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1,3 +1,11 @@ build/ site/ -quarto \ No newline at end of file +quarto +getopt +os +sys +sysconfig +*.quarto_ipynb +cache +/.quarto/ +_site \ No newline at end of file diff --git a/docs/Manifest.toml b/docs/Manifest.toml new file mode 100644 index 0000000..8d33dfb --- /dev/null +++ b/docs/Manifest.toml @@ -0,0 +1,891 @@ +# This file is machine-generated - editing it directly is not advised + +julia_version = "1.10.7" +manifest_format = "2.0" +project_hash = "bf8effaeda48312d6345d1d63f773aa08499b825" + +[[deps.ADTypes]] +git-tree-sha1 = "72af59f5b8f09faee36b4ec48e014a79210f2f4f" +uuid = "47edcb42-4c32-4615-8424-f2b9edc5f35b" +version = "1.11.0" +weakdeps = ["ChainRulesCore", "ConstructionBase", "EnzymeCore"] + + [deps.ADTypes.extensions] + ADTypesChainRulesCoreExt = "ChainRulesCore" + ADTypesConstructionBaseExt = "ConstructionBase" + ADTypesEnzymeCoreExt = "EnzymeCore" + +[[deps.AbstractTrees]] +git-tree-sha1 = "2d9c9a55f9c93e8887ad391fbae72f8ef55e1177" +uuid = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" +version = "0.4.5" + +[[deps.Adapt]] +deps = ["LinearAlgebra", "Requires"] +git-tree-sha1 = "50c3c56a52972d78e8be9fd135bfb91c9574c140" +uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" +version = "4.1.1" +weakdeps = ["StaticArrays"] + + [deps.Adapt.extensions] + AdaptStaticArraysExt = "StaticArrays" + +[[deps.AliasTables]] +deps = ["PtrArrays", "Random"] +git-tree-sha1 = "9876e1e164b144ca45e9e3198d0b689cadfed9ff" +uuid = "66dad0bd-aa9a-41b7-9441-69ab47430ed8" +version = "1.1.3" + +[[deps.ArgCheck]] +git-tree-sha1 = "680b3b8759bd4c54052ada14e52355ab69e07876" +uuid = "dce04be8-c92d-5529-be00-80e4d2c0e197" +version = "2.4.0" + +[[deps.ArgTools]] +uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" +version = "1.1.1" + +[[deps.ArnoldiMethod]] +deps = ["LinearAlgebra", "Random", "StaticArrays"] +git-tree-sha1 = "d57bd3762d308bded22c3b82d033bff85f6195c6" +uuid = "ec485272-7323-5ecc-a04f-4719b315124d" +version = "0.4.0" + +[[deps.Artifacts]] +uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" + +[[deps.Base64]] +uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" + +[[deps.BridgeStan]] +deps = ["Downloads", "Inflate", "TOML", "Tar"] +git-tree-sha1 = "c645b8279083d42096d1af21b3c029204668abeb" +uuid = "c88b6f0a-829e-4b0b-94b7-f06ab5908f5a" +version = "2.6.0" + +[[deps.CEnum]] +git-tree-sha1 = "389ad5c84de1ae7cf0e28e381131c98ea87d54fc" +uuid = "fa961155-64e5-5f13-b03f-caf6b980ea82" +version = "0.5.0" + +[[deps.ChainRules]] +deps = ["Adapt", "ChainRulesCore", "Compat", "Distributed", "GPUArraysCore", "IrrationalConstants", "LinearAlgebra", "Random", "RealDot", "SparseArrays", "SparseInverseSubset", "Statistics", "StructArrays", "SuiteSparse"] +git-tree-sha1 = "bcffdcaed50d3453673b852f3522404a94b50fad" +uuid = "082447d4-558c-5d27-93f4-14fc19e9eca2" +version = "1.72.1" + +[[deps.ChainRulesCore]] +deps = ["Compat", "LinearAlgebra"] +git-tree-sha1 = "3e4b134270b372f2ed4d4d0e936aabaefc1802bc" +uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" +version = "1.25.0" +weakdeps = ["SparseArrays"] + + [deps.ChainRulesCore.extensions] + ChainRulesCoreSparseArraysExt = "SparseArrays" + +[[deps.Chairmarks]] +deps = ["Printf", "Random"] +git-tree-sha1 = "9a49491e67e7a4d6f885c43d00bb101e6e5a434b" +uuid = "0ca39b1e-fe0b-4e98-acfc-b1656634c4de" +version = "1.3.1" +weakdeps = ["Statistics"] + + [deps.Chairmarks.extensions] + StatisticsChairmarksExt = ["Statistics"] + +[[deps.Compat]] +deps = ["TOML", "UUIDs"] +git-tree-sha1 = "8ae8d32e09f0dcf42a36b90d4e17f5dd2e4c4215" +uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" +version = "4.16.0" +weakdeps = ["Dates", "LinearAlgebra"] + + [deps.Compat.extensions] + CompatLinearAlgebraExt = "LinearAlgebra" + +[[deps.CompilerSupportLibraries_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" +version = "1.1.1+0" + +[[deps.Conda]] +deps = ["Downloads", "JSON", "VersionParsing"] +git-tree-sha1 = "b19db3927f0db4151cb86d073689f2428e524576" +uuid = "8f4d0f93-b110-5947-807f-2305c1781a2d" +version = "1.10.2" + +[[deps.ConstructionBase]] +git-tree-sha1 = "76219f1ed5771adbb096743bff43fb5fdd4c1157" +uuid = "187b0558-2788-49d3-abe0-74a17ed4e7c9" +version = "1.5.8" + + [deps.ConstructionBase.extensions] + ConstructionBaseIntervalSetsExt = "IntervalSets" + ConstructionBaseLinearAlgebraExt = "LinearAlgebra" + ConstructionBaseStaticArraysExt = "StaticArrays" + + [deps.ConstructionBase.weakdeps] + IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953" + LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" + StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" + +[[deps.DataAPI]] +git-tree-sha1 = "abe83f3a2f1b857aac70ef8b269080af17764bbe" +uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a" +version = "1.16.0" + +[[deps.DataStructures]] +deps = ["Compat", "InteractiveUtils", "OrderedCollections"] +git-tree-sha1 = "1d0a14036acb104d9e89698bd408f63ab58cdc82" +uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" +version = "0.18.20" + +[[deps.DataValueInterfaces]] +git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6" +uuid = "e2d170a0-9d28-54be-80f0-106bbe20a464" +version = "1.0.0" + +[[deps.Dates]] +deps = ["Printf"] +uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" + +[[deps.DiffRules]] +deps = ["IrrationalConstants", "LogExpFunctions", "NaNMath", "Random", "SpecialFunctions"] +git-tree-sha1 = "23163d55f885173722d1e4cf0f6110cdbaf7e272" +uuid = "b552c78f-8df3-52c6-915a-8e097449b14b" +version = "1.15.1" + +[[deps.DiffTests]] +deps = ["LinearAlgebra", "SparseArrays", "Statistics"] +git-tree-sha1 = "b92beb1933df01bf4915d3a05e54c2a0aad312c7" +uuid = "de460e47-3fe3-5279-bb4a-814414816d5d" +version = "0.1.2" + +[[deps.Distributed]] +deps = ["Random", "Serialization", "Sockets"] +uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" + +[[deps.Distributions]] +deps = ["AliasTables", "FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SpecialFunctions", "Statistics", "StatsAPI", "StatsBase", "StatsFuns"] +git-tree-sha1 = "4b138e4643b577ccf355377c2bc70fa975af25de" +uuid = "31c24e10-a181-5473-b8eb-7969acd0382f" +version = "0.25.115" + + [deps.Distributions.extensions] + DistributionsChainRulesCoreExt = "ChainRulesCore" + DistributionsDensityInterfaceExt = "DensityInterface" + DistributionsTestExt = "Test" + + [deps.Distributions.weakdeps] + ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" + DensityInterface = "b429d917-457f-4dbc-8f4c-0cc954292b1d" + Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[[deps.DocStringExtensions]] +deps = ["LibGit2"] +git-tree-sha1 = "2fb1e02f2b635d0845df5d7c167fec4dd739b00d" +uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" +version = "0.9.3" + +[[deps.Downloads]] +deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] +uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" +version = "1.6.0" + +[[deps.DynamicObjects]] +deps = ["Serialization"] +path = ".." +uuid = "23d02862-63fe-4c6e-8fdb-1d52cbbd39d5" +version = "0.2.0" + +[[deps.Enzyme]] +deps = ["CEnum", "EnzymeCore", "Enzyme_jll", "GPUCompiler", "LLVM", "Libdl", "LinearAlgebra", "ObjectFile", "PrecompileTools", "Preferences", "Printf", "Random", "SparseArrays"] +git-tree-sha1 = "40f76a10909b3633fcc07413c33a59d63f72116e" +uuid = "7da242da-08ed-463a-9acd-ee780be4f1d9" +version = "0.13.24" + + [deps.Enzyme.extensions] + EnzymeBFloat16sExt = "BFloat16s" + EnzymeChainRulesCoreExt = "ChainRulesCore" + EnzymeLogExpFunctionsExt = "LogExpFunctions" + EnzymeSpecialFunctionsExt = "SpecialFunctions" + EnzymeStaticArraysExt = "StaticArrays" + + [deps.Enzyme.weakdeps] + BFloat16s = "ab4f0b2a-ad5b-11e8-123f-65d77653426b" + ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" + LogExpFunctions = "2ab3a3ac-af41-5b50-aa03-7779005ae688" + SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" + StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" + +[[deps.EnzymeCore]] +git-tree-sha1 = "0cdb7af5c39e92d78a0ee8d0a447d32f7593137e" +uuid = "f151be2c-9106-41f4-ab19-57ee4f262869" +version = "0.8.8" +weakdeps = ["Adapt"] + + [deps.EnzymeCore.extensions] + AdaptExt = "Adapt" + +[[deps.Enzyme_jll]] +deps = ["Artifacts", "JLLWrappers", "LazyArtifacts", "Libdl", "TOML"] +git-tree-sha1 = "e27c2863bf92622bcf89465c078379b8c2c61d2d" +uuid = "7cc45869-7501-5eee-bdea-0790c847d4ef" +version = "0.0.168+0" + +[[deps.ExprTools]] +git-tree-sha1 = "27415f162e6028e81c72b82ef756bf321213b6ec" +uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04" +version = "0.1.10" + +[[deps.FileWatching]] +uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" + +[[deps.FillArrays]] +deps = ["LinearAlgebra"] +git-tree-sha1 = "6a70198746448456524cb442b8af316927ff3e1a" +uuid = "1a297f60-69ca-5386-bcde-b61e274b549b" +version = "1.13.0" +weakdeps = ["PDMats", "SparseArrays", "Statistics"] + + [deps.FillArrays.extensions] + FillArraysPDMatsExt = "PDMats" + FillArraysSparseArraysExt = "SparseArrays" + FillArraysStatisticsExt = "Statistics" + +[[deps.FunctionWrappers]] +git-tree-sha1 = "d62485945ce5ae9c0c48f124a84998d755bae00e" +uuid = "069b7b12-0de2-55c6-9aab-29f3d0a68a2e" +version = "1.1.3" + +[[deps.Future]] +deps = ["Random"] +uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820" + +[[deps.GPUArraysCore]] +deps = ["Adapt"] +git-tree-sha1 = "83cf05ab16a73219e5f6bd1bdfa9848fa24ac627" +uuid = "46192b85-c4d5-4398-a991-12ede77f4527" +version = "0.2.0" + +[[deps.GPUCompiler]] +deps = ["ExprTools", "InteractiveUtils", "LLVM", "Libdl", "Logging", "PrecompileTools", "Preferences", "Scratch", "Serialization", "TOML", "TimerOutputs", "UUIDs"] +git-tree-sha1 = "72408a76694e87e735f515a499ba1e069d232d39" +uuid = "61eb1bfa-7361-4325-ad38-22787b887f55" +version = "1.0.1" + +[[deps.Graphs]] +deps = ["ArnoldiMethod", "Compat", "DataStructures", "Distributed", "Inflate", "LinearAlgebra", "Random", "SharedArrays", "SimpleTraits", "SparseArrays", "Statistics"] +git-tree-sha1 = "1dc470db8b1131cfc7fb4c115de89fe391b9e780" +uuid = "86223c79-3864-5bf0-83f7-82e725a168b6" +version = "1.12.0" + +[[deps.HypergeometricFunctions]] +deps = ["LinearAlgebra", "OpenLibm_jll", "SpecialFunctions"] +git-tree-sha1 = "b1c2585431c382e3fe5805874bda6aea90a95de9" +uuid = "34004b35-14d8-5ef3-9330-4cdb6864b03a" +version = "0.3.25" + +[[deps.IJulia]] +deps = ["Base64", "Conda", "Dates", "InteractiveUtils", "JSON", "Libdl", "Logging", "Markdown", "MbedTLS", "Pkg", "Printf", "REPL", "Random", "SoftGlobalScope", "Test", "UUIDs", "ZMQ"] +git-tree-sha1 = "1b1299f7d6617291f3d260e9f5b0250afdaac8c0" +uuid = "7073ff75-c697-5162-941a-fcdaad2a7d2a" +version = "1.26.0" + +[[deps.Inflate]] +git-tree-sha1 = "d1b1b796e47d94588b3757fe84fbf65a5ec4a80d" +uuid = "d25df0c9-e2be-5dd7-82c8-3ad0b3e990b9" +version = "0.1.5" + +[[deps.InteractiveUtils]] +deps = ["Markdown"] +uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" + +[[deps.IrrationalConstants]] +git-tree-sha1 = "630b497eafcc20001bba38a4651b327dcfc491d2" +uuid = "92d709cd-6900-40b7-9082-c6be49f344b6" +version = "0.2.2" + +[[deps.IteratorInterfaceExtensions]] +git-tree-sha1 = "a3f24677c21f5bbe9d2a714f95dcd58337fb2856" +uuid = "82899510-4779-5014-852e-03e436cf321d" +version = "1.0.0" + +[[deps.JLLWrappers]] +deps = ["Artifacts", "Preferences"] +git-tree-sha1 = "be3dc50a92e5a386872a493a10050136d4703f9b" +uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210" +version = "1.6.1" + +[[deps.JSON]] +deps = ["Dates", "Mmap", "Parsers", "Unicode"] +git-tree-sha1 = "31e996f0a15c7b280ba9f76636b3ff9e2ae58c9a" +uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" +version = "0.21.4" + +[[deps.JSON3]] +deps = ["Dates", "Mmap", "Parsers", "PrecompileTools", "StructTypes", "UUIDs"] +git-tree-sha1 = "1d322381ef7b087548321d3f878cb4c9bd8f8f9b" +uuid = "0f8b85d8-7281-11e9-16c2-39a750bddbf1" +version = "1.14.1" + + [deps.JSON3.extensions] + JSON3ArrowExt = ["ArrowTypes"] + + [deps.JSON3.weakdeps] + ArrowTypes = "31f734f8-188a-4ce0-8406-c8a06bd891cd" + +[[deps.LLVM]] +deps = ["CEnum", "LLVMExtra_jll", "Libdl", "Preferences", "Printf", "Unicode"] +git-tree-sha1 = "d422dfd9707bec6617335dc2ea3c5172a87d5908" +uuid = "929cbde3-209d-540e-8aea-75f648917ca0" +version = "9.1.3" + + [deps.LLVM.extensions] + BFloat16sExt = "BFloat16s" + + [deps.LLVM.weakdeps] + BFloat16s = "ab4f0b2a-ad5b-11e8-123f-65d77653426b" + +[[deps.LLVMExtra_jll]] +deps = ["Artifacts", "JLLWrappers", "LazyArtifacts", "Libdl", "TOML"] +git-tree-sha1 = "05a8bd5a42309a9ec82f700876903abce1017dd3" +uuid = "dad2f222-ce93-54a1-a47d-0025e8a3acab" +version = "0.0.34+0" + +[[deps.LazyArtifacts]] +deps = ["Artifacts", "Pkg"] +uuid = "4af54fe1-eca0-43a8-85a7-787d91b784e3" + +[[deps.LibCURL]] +deps = ["LibCURL_jll", "MozillaCACerts_jll"] +uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" +version = "0.6.4" + +[[deps.LibCURL_jll]] +deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] +uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" +version = "8.4.0+0" + +[[deps.LibGit2]] +deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"] +uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" + +[[deps.LibGit2_jll]] +deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"] +uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5" +version = "1.6.4+0" + +[[deps.LibSSH2_jll]] +deps = ["Artifacts", "Libdl", "MbedTLS_jll"] +uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" +version = "1.11.0+1" + +[[deps.Libdl]] +uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" + +[[deps.LinearAlgebra]] +deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"] +uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" + +[[deps.LogDensityProblems]] +deps = ["ArgCheck", "DocStringExtensions", "Random"] +git-tree-sha1 = "4e0128c1590d23a50dcdb106c7e2dbca99df85c0" +uuid = "6fdf6af0-433a-55f7-b3ed-c6c6e0b8df7c" +version = "2.1.2" + +[[deps.LogExpFunctions]] +deps = ["DocStringExtensions", "IrrationalConstants", "LinearAlgebra"] +git-tree-sha1 = "13ca9e2586b89836fd20cccf56e57e2b9ae7f38f" +uuid = "2ab3a3ac-af41-5b50-aa03-7779005ae688" +version = "0.3.29" + + [deps.LogExpFunctions.extensions] + LogExpFunctionsChainRulesCoreExt = "ChainRulesCore" + LogExpFunctionsChangesOfVariablesExt = "ChangesOfVariables" + LogExpFunctionsInverseFunctionsExt = "InverseFunctions" + + [deps.LogExpFunctions.weakdeps] + ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" + ChangesOfVariables = "9e997f8a-9a97-42d5-a9f1-ce6bfc15e2c0" + InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112" + +[[deps.Logging]] +uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" + +[[deps.MacroTools]] +deps = ["Markdown", "Random"] +git-tree-sha1 = "2fa9ee3e63fd3a4f7a9a4f4744a52f4856de82df" +uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" +version = "0.5.13" + +[[deps.Markdown]] +deps = ["Base64"] +uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" + +[[deps.MbedTLS]] +deps = ["Dates", "MbedTLS_jll", "MozillaCACerts_jll", "NetworkOptions", "Random", "Sockets"] +git-tree-sha1 = "c067a280ddc25f196b5e7df3877c6b226d390aaf" +uuid = "739be429-bea8-5141-9913-cc70e7f3736d" +version = "1.1.9" + +[[deps.MbedTLS_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" +version = "2.28.2+1" + +[[deps.Missings]] +deps = ["DataAPI"] +git-tree-sha1 = "ec4f7fbeab05d7747bdf98eb74d130a2a2ed298d" +uuid = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28" +version = "1.2.0" + +[[deps.MistyClosures]] +git-tree-sha1 = "1142aefd845c608f3c70e4c202c4aae725cab67b" +uuid = "dbe65cb8-6be2-42dd-bbc5-4196aaced4f4" +version = "2.0.0" + +[[deps.Mmap]] +uuid = "a63ad114-7e13-5084-954f-fe012c677804" + +[[deps.Mooncake]] +deps = ["ADTypes", "ChainRules", "ChainRulesCore", "DiffRules", "DiffTests", "ExprTools", "FunctionWrappers", "Graphs", "InteractiveUtils", "LinearAlgebra", "MistyClosures", "Random", "Setfield", "Test"] +git-tree-sha1 = "1d44680928dabf8072c4c6b7746fa9068cdba3bf" +uuid = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" +version = "0.4.65" + + [deps.Mooncake.extensions] + MooncakeAllocCheckExt = "AllocCheck" + MooncakeCUDAExt = "CUDA" + MooncakeJETExt = "JET" + MooncakeLuxLibExt = "LuxLib" + MooncakeLuxLibSLEEFPiratesExtension = ["LuxLib", "SLEEFPirates"] + MooncakeNNlibExt = "NNlib" + MooncakeSpecialFunctionsExt = "SpecialFunctions" + + [deps.Mooncake.weakdeps] + AllocCheck = "9b6a8646-10ed-4001-bbdc-1d2f46dfbb1a" + CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" + JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" + LuxLib = "82251201-b29d-42c6-8e01-566dec8acb11" + NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd" + SLEEFPirates = "476501e8-09a2-5ece-8869-fb82de89a1fa" + SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" + +[[deps.MozillaCACerts_jll]] +uuid = "14a3606d-f60d-562e-9121-12d972cd8159" +version = "2023.1.10" + +[[deps.NaNMath]] +deps = ["OpenLibm_jll"] +git-tree-sha1 = "0877504529a3e5c3343c6f8b4c0381e57e4387e4" +uuid = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" +version = "1.0.2" + +[[deps.NetworkOptions]] +uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" +version = "1.2.0" + +[[deps.ObjectFile]] +deps = ["Reexport", "StructIO"] +git-tree-sha1 = "7249afa1c4dfd86bfbcc9b28939ab6ef844f4e11" +uuid = "d8793406-e978-5875-9003-1fc021f44a92" +version = "0.4.2" + +[[deps.OnlineStats]] +deps = ["AbstractTrees", "Dates", "Distributions", "LinearAlgebra", "OnlineStatsBase", "OrderedCollections", "Random", "RecipesBase", "SpecialFunctions", "Statistics", "StatsBase", "StatsFuns"] +git-tree-sha1 = "8437102a36046b73a50af12430ec3e8e98768d80" +uuid = "a15396b6-48d5-5d58-9928-6d29437db91e" +version = "1.7.1" + +[[deps.OnlineStatsBase]] +deps = ["AbstractTrees", "Dates", "LinearAlgebra", "OrderedCollections", "Statistics", "StatsBase"] +git-tree-sha1 = "a5a5a68d079ce531b0220e99789e0c1c8c5ed215" +uuid = "925886fa-5bf2-5e8e-b522-a9147a512338" +version = "1.7.1" + +[[deps.OpenBLAS_jll]] +deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] +uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" +version = "0.3.23+4" + +[[deps.OpenLibm_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "05823500-19ac-5b8b-9628-191a04bc5112" +version = "0.8.1+2" + +[[deps.OpenSpecFun_jll]] +deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "13652491f6856acfd2db29360e1bbcd4565d04f1" +uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e" +version = "0.5.5+0" + +[[deps.OrderedCollections]] +git-tree-sha1 = "12f1439c4f986bb868acda6ea33ebc78e19b95ad" +uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" +version = "1.7.0" + +[[deps.PDMats]] +deps = ["LinearAlgebra", "SparseArrays", "SuiteSparse"] +git-tree-sha1 = "949347156c25054de2db3b166c52ac4728cbad65" +uuid = "90014a1f-27ba-587c-ab20-58faa44d9150" +version = "0.11.31" + +[[deps.Parsers]] +deps = ["Dates", "PrecompileTools", "UUIDs"] +git-tree-sha1 = "8489905bcdbcfac64d1daa51ca07c0d8f0283821" +uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" +version = "2.8.1" + +[[deps.Pkg]] +deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] +uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" +version = "1.10.0" + +[[deps.PosteriorDB]] +deps = ["Artifacts", "Compat", "JSON3", "OrderedCollections", "ZipFile"] +git-tree-sha1 = "835bd415df5b8fcf73fa2c7b3795feecb37d903e" +uuid = "1c4bc282-d2f5-44f9-b6d1-8c4424a23ad4" +version = "0.5.3" + +[[deps.PrecompileTools]] +deps = ["Preferences"] +git-tree-sha1 = "5aa36f7049a63a1528fe8f7c3f2113413ffd4e1f" +uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a" +version = "1.2.1" + +[[deps.Preferences]] +deps = ["TOML"] +git-tree-sha1 = "9306f6085165d270f7e3db02af26a400d580f5c6" +uuid = "21216c6a-2e73-6563-6e65-726566657250" +version = "1.4.3" + +[[deps.Printf]] +deps = ["Unicode"] +uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" + +[[deps.PtrArrays]] +git-tree-sha1 = "77a42d78b6a92df47ab37e177b2deac405e1c88f" +uuid = "43287f4e-b6f4-7ad1-bb20-aadabca52c3d" +version = "1.2.1" + +[[deps.QuadGK]] +deps = ["DataStructures", "LinearAlgebra"] +git-tree-sha1 = "cda3b045cf9ef07a08ad46731f5a3165e56cf3da" +uuid = "1fd47b50-473d-5c70-9696-f719f8f3bcdc" +version = "2.11.1" +weakdeps = ["Enzyme"] + + [deps.QuadGK.extensions] + QuadGKEnzymeExt = "Enzyme" + +[[deps.REPL]] +deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] +uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" + +[[deps.Random]] +deps = ["SHA"] +uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" + +[[deps.RealDot]] +deps = ["LinearAlgebra"] +git-tree-sha1 = "9f0a1b71baaf7650f4fa8a1d168c7fb6ee41f0c9" +uuid = "c1ae055f-0cd5-4b69-90a6-9a35b1a98df9" +version = "0.1.0" + +[[deps.RecipesBase]] +deps = ["PrecompileTools"] +git-tree-sha1 = "5c3d09cc4f31f5fc6af001c250bf1278733100ff" +uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" +version = "1.3.4" + +[[deps.Reexport]] +git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b" +uuid = "189a3867-3050-52da-a836-e630ba90ab69" +version = "1.2.2" + +[[deps.Requires]] +deps = ["UUIDs"] +git-tree-sha1 = "838a3a4188e2ded87a4f9f184b4b0d78a1e91cb7" +uuid = "ae029012-a4dd-5104-9daa-d747884805df" +version = "1.3.0" + +[[deps.Rmath]] +deps = ["Random", "Rmath_jll"] +git-tree-sha1 = "852bd0f55565a9e973fcfee83a84413270224dc4" +uuid = "79098fc4-a85e-5d69-aa6a-4863f24498fa" +version = "0.8.0" + +[[deps.Rmath_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "58cdd8fb2201a6267e1db87ff148dd6c1dbd8ad8" +uuid = "f50d1b31-88e8-58de-be2c-1cc44531875f" +version = "0.5.1+0" + +[[deps.SHA]] +uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" +version = "0.7.0" + +[[deps.Scratch]] +deps = ["Dates"] +git-tree-sha1 = "3bac05bc7e74a75fd9cba4295cde4045d9fe2386" +uuid = "6c6a2e73-6563-6170-7368-637461726353" +version = "1.2.1" + +[[deps.Serialization]] +uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" + +[[deps.Setfield]] +deps = ["ConstructionBase", "Future", "MacroTools", "StaticArraysCore"] +git-tree-sha1 = "e2cc6d8c88613c05e1defb55170bf5ff211fbeac" +uuid = "efcf1570-3423-57d1-acb7-fd33fddbac46" +version = "1.1.1" + +[[deps.SharedArrays]] +deps = ["Distributed", "Mmap", "Random", "Serialization"] +uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383" + +[[deps.SimpleTraits]] +deps = ["InteractiveUtils", "MacroTools"] +git-tree-sha1 = "5d7e3f4e11935503d3ecaf7186eac40602e7d231" +uuid = "699a6c99-e7fa-54fc-8d76-47d257e15c1d" +version = "0.9.4" + +[[deps.Sockets]] +uuid = "6462fe0b-24de-5631-8697-dd941f90decc" + +[[deps.SoftGlobalScope]] +deps = ["REPL"] +git-tree-sha1 = "986ec2b6162ccb95de5892ed17832f95badf770c" +uuid = "b85f4697-e234-5449-a836-ec8e2f98b302" +version = "1.1.0" + +[[deps.SortingAlgorithms]] +deps = ["DataStructures"] +git-tree-sha1 = "66e0a8e672a0bdfca2c3f5937efb8538b9ddc085" +uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c" +version = "1.2.1" + +[[deps.SparseArrays]] +deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] +uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" +version = "1.10.0" + +[[deps.SparseInverseSubset]] +deps = ["LinearAlgebra", "SparseArrays", "SuiteSparse"] +git-tree-sha1 = "52962839426b75b3021296f7df242e40ecfc0852" +uuid = "dc90abb0-5640-4711-901d-7e5b23a2fada" +version = "0.1.2" + +[[deps.SpecialFunctions]] +deps = ["IrrationalConstants", "LogExpFunctions", "OpenLibm_jll", "OpenSpecFun_jll"] +git-tree-sha1 = "64cca0c26b4f31ba18f13f6c12af7c85f478cfde" +uuid = "276daf66-3868-5448-9aa4-cd146d93841b" +version = "2.5.0" +weakdeps = ["ChainRulesCore"] + + [deps.SpecialFunctions.extensions] + SpecialFunctionsChainRulesCoreExt = "ChainRulesCore" + +[[deps.StanBlocks]] +deps = ["Distributions", "LinearAlgebra", "LogExpFunctions", "Statistics"] +path = "../../StanBlocks.jl" +uuid = "2e771a56-c23a-4e0b-9282-20c2e37157e9" +version = "0.1.0" + + [deps.StanBlocks.extensions] + LogDensityProblemsExt = "LogDensityProblems" + OrdinaryDiffEqExt = "OrdinaryDiffEq" + PosteriorDBExt = "PosteriorDB" + + [deps.StanBlocks.weakdeps] + LogDensityProblems = "6fdf6af0-433a-55f7-b3ed-c6c6e0b8df7c" + OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" + PosteriorDB = "1c4bc282-d2f5-44f9-b6d1-8c4424a23ad4" + +[[deps.StanLogDensityProblems]] +deps = ["BridgeStan", "LogDensityProblems", "Requires"] +git-tree-sha1 = "427191b9e8983c92cb8a3d6d45beaf41ae646414" +uuid = "a545de4d-8dba-46db-9d34-4e41d3f07807" +version = "0.1.5" +weakdeps = ["PosteriorDB"] + + [deps.StanLogDensityProblems.extensions] + StanLogDensityProblemsPosteriorDBExt = "PosteriorDB" + +[[deps.StaticArrays]] +deps = ["LinearAlgebra", "PrecompileTools", "Random", "StaticArraysCore"] +git-tree-sha1 = "777657803913ffc7e8cc20f0fd04b634f871af8f" +uuid = "90137ffa-7385-5640-81b9-e52037218182" +version = "1.9.8" +weakdeps = ["ChainRulesCore", "Statistics"] + + [deps.StaticArrays.extensions] + StaticArraysChainRulesCoreExt = "ChainRulesCore" + StaticArraysStatisticsExt = "Statistics" + +[[deps.StaticArraysCore]] +git-tree-sha1 = "192954ef1208c7019899fbf8049e717f92959682" +uuid = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" +version = "1.4.3" + +[[deps.Statistics]] +deps = ["LinearAlgebra", "SparseArrays"] +uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" +version = "1.10.0" + +[[deps.StatsAPI]] +deps = ["LinearAlgebra"] +git-tree-sha1 = "1ff449ad350c9c4cbc756624d6f8a8c3ef56d3ed" +uuid = "82ae8749-77ed-4fe6-ae5f-f523153014b0" +version = "1.7.0" + +[[deps.StatsBase]] +deps = ["AliasTables", "DataAPI", "DataStructures", "LinearAlgebra", "LogExpFunctions", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "StatsAPI"] +git-tree-sha1 = "29321314c920c26684834965ec2ce0dacc9cf8e5" +uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" +version = "0.34.4" + +[[deps.StatsFuns]] +deps = ["HypergeometricFunctions", "IrrationalConstants", "LogExpFunctions", "Reexport", "Rmath", "SpecialFunctions"] +git-tree-sha1 = "b423576adc27097764a90e163157bcfc9acf0f46" +uuid = "4c63d2b9-4356-54db-8cca-17b64c39e42c" +version = "1.3.2" + + [deps.StatsFuns.extensions] + StatsFunsChainRulesCoreExt = "ChainRulesCore" + StatsFunsInverseFunctionsExt = "InverseFunctions" + + [deps.StatsFuns.weakdeps] + ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" + InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112" + +[[deps.StructArrays]] +deps = ["ConstructionBase", "DataAPI", "Tables"] +git-tree-sha1 = "5a3a31c41e15a1e042d60f2f4942adccba05d3c9" +uuid = "09ab397b-f2b6-538f-b94a-2f83cf4a842a" +version = "0.7.0" + + [deps.StructArrays.extensions] + StructArraysAdaptExt = "Adapt" + StructArraysGPUArraysCoreExt = ["GPUArraysCore", "KernelAbstractions"] + StructArraysLinearAlgebraExt = "LinearAlgebra" + StructArraysSparseArraysExt = "SparseArrays" + StructArraysStaticArraysExt = "StaticArrays" + + [deps.StructArrays.weakdeps] + Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" + GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527" + KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c" + LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" + SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" + StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" + +[[deps.StructIO]] +git-tree-sha1 = "c581be48ae1cbf83e899b14c07a807e1787512cc" +uuid = "53d494c1-5632-5724-8f4c-31dff12d585f" +version = "0.3.1" + +[[deps.StructTypes]] +deps = ["Dates", "UUIDs"] +git-tree-sha1 = "159331b30e94d7b11379037feeb9b690950cace8" +uuid = "856f2bd8-1eba-4b0a-8007-ebc267875bd4" +version = "1.11.0" + +[[deps.SuiteSparse]] +deps = ["Libdl", "LinearAlgebra", "Serialization", "SparseArrays"] +uuid = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9" + +[[deps.SuiteSparse_jll]] +deps = ["Artifacts", "Libdl", "libblastrampoline_jll"] +uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" +version = "7.2.1+1" + +[[deps.TOML]] +deps = ["Dates"] +uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" +version = "1.0.3" + +[[deps.TableTraits]] +deps = ["IteratorInterfaceExtensions"] +git-tree-sha1 = "c06b2f539df1c6efa794486abfb6ed2022561a39" +uuid = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c" +version = "1.0.1" + +[[deps.Tables]] +deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "OrderedCollections", "TableTraits"] +git-tree-sha1 = "598cd7c1f68d1e205689b1c2fe65a9f85846f297" +uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" +version = "1.12.0" + +[[deps.Tar]] +deps = ["ArgTools", "SHA"] +uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" +version = "1.10.0" + +[[deps.Test]] +deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] +uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[[deps.TimerOutputs]] +deps = ["ExprTools", "Printf"] +git-tree-sha1 = "d7298ebdfa1654583468a487e8e83fae9d72dac3" +uuid = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f" +version = "0.5.26" + +[[deps.UUIDs]] +deps = ["Random", "SHA"] +uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" + +[[deps.Unicode]] +uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" + +[[deps.VersionParsing]] +git-tree-sha1 = "58d6e80b4ee071f5efd07fda82cb9fbe17200868" +uuid = "81def892-9a0e-5fdd-b105-ffc91e053289" +version = "1.3.0" + +[[deps.ZMQ]] +deps = ["FileWatching", "PrecompileTools", "Sockets", "ZeroMQ_jll"] +git-tree-sha1 = "33333bdded3835f81b9b6353da9243dc4ec62e0f" +uuid = "c2297ded-f4af-51ae-bb23-16f91089e4e1" +version = "1.4.0" + +[[deps.ZeroMQ_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "libsodium_jll"] +git-tree-sha1 = "f02ce8f0fda1ed40f4d0d59a2ad05e35e8ac9b0e" +uuid = "8f1865be-045e-5c20-9c9f-bfbfb0764568" +version = "4.3.5+1" + +[[deps.ZipFile]] +deps = ["Libdl", "Printf", "Zlib_jll"] +git-tree-sha1 = "f492b7fe1698e623024e873244f10d89c95c340a" +uuid = "a5390f91-8eb1-5f08-bee0-b1d1ffed6cea" +version = "0.10.1" + +[[deps.Zlib_jll]] +deps = ["Libdl"] +uuid = "83775a58-1f1d-513f-b197-d71354ab007a" +version = "1.2.13+1" + +[[deps.libblastrampoline_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" +version = "5.11.0+0" + +[[deps.libsodium_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "f76d682d87eefadd3f165d8d9fda436464213142" +uuid = "a9144af2-ca23-56d9-984f-0d03f7b5ccf8" +version = "1.0.20+1" + +[[deps.nghttp2_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" +version = "1.52.0+1" + +[[deps.p7zip_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" +version = "17.4.0+2" diff --git a/docs/Project.toml b/docs/Project.toml index d624477..4b68b17 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,3 +1,14 @@ [deps] -Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +BridgeStan = "c88b6f0a-829e-4b0b-94b7-f06ab5908f5a" +Chairmarks = "0ca39b1e-fe0b-4e98-acfc-b1656634c4de" +Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" DynamicObjects = "23d02862-63fe-4c6e-8fdb-1d52cbbd39d5" +Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9" +IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a" +LogDensityProblems = "6fdf6af0-433a-55f7-b3ed-c6c6e0b8df7c" +Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" +Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" +OnlineStats = "a15396b6-48d5-5d58-9928-6d29437db91e" +PosteriorDB = "1c4bc282-d2f5-44f9-b6d1-8c4424a23ad4" +StanBlocks = "2e771a56-c23a-4e0b-9282-20c2e37157e9" +StanLogDensityProblems = "a545de4d-8dba-46db-9d34-4e41d3f07807" diff --git a/docs/_quarto.yml b/docs/_quarto.yml new file mode 100644 index 0000000..2df7d57 --- /dev/null +++ b/docs/_quarto.yml @@ -0,0 +1,18 @@ +author: "Nikolas Siccha" +project: + type: website +website: + title: "DynamicObjects.jl" + navbar: + left: + - icon: github + href: https://github.com/nsiccha/DynamicObjects.jl +format: + html: + page-layout: full + toc: true +jupyter: julia-1.10 +execute: + echo: true + cache: true + daemon: 60000 diff --git a/docs/index.qmd b/docs/index.qmd new file mode 100644 index 0000000..9d44253 --- /dev/null +++ b/docs/index.qmd @@ -0,0 +1,217 @@ +--- +title: "Example: Evaluating AD performance" +--- + +See [https://nsiccha.github.io/StanBlocks.jl/performance.html#visualization](https://nsiccha.github.io/StanBlocks.jl/performance.html#visualization) for the full performance evaluation. + +```{julia} +#| code-fold: true +#| code-summary: "Setup code not using DynamicObjects.jl" + +cd(dirname(Base.active_project())) +using PosteriorDB, StanLogDensityProblems, LogDensityProblems, Logging, Random, StanBlocks, Statistics, LinearAlgebra, Chairmarks, Pkg, OnlineStats, Distributions, BridgeStan, Enzyme, Mooncake +const BRIDGESTAN_VERSION = filter(x->x.second.name=="BridgeStan", Pkg.dependencies()) |> x->first(x)[2].version +const ENZYME_VERSION = filter(x->x.second.name=="Enzyme", Pkg.dependencies()) |> x->first(x)[2].version +const MOONCAKE_VERSION = filter(x->x.second.name=="Mooncake", Pkg.dependencies()) |> x->first(x)[2].version +const pdb = PosteriorDB.database() +adaptive_median(f; n=100) = median([f() for i in 1:n]) +nonzero(x) = x == zero(x) ? one(x) : x +tune_evals(f; timing_target) = begin + rng = Xoshiro(0) + @time rv = f(rng) + @time rv = f(rng) + count = 0 + t0 = t1 = time_ns() + while t1 - t0 < timing_target + rv = f(rng) + t1 = time_ns() + count += 1 + end + count +end +struct RuntimeIterator{F,X,N} + f::F + x::X + n::N +end +Base.iterate(r::RuntimeIterator) = begin + stats = @timed begin + rv = r.f(r.x) + Base.donotdelete(rv) + for i in 1:r.n-1 + rv = r.f(r.x) + Base.donotdelete(rv) + end + end + (stats.time - stats.gctime) / r.n +end +adaptive_benchmark(fs::NamedTuple; n_evals, kwargs...) = NamedTuple{keys(fs)}(adaptive_mean(map(f->RuntimeIterator(f, Xoshiro(0), n_evals), values(fs)); kwargs...)) +adaptive_mean(itrs::Tuple; q=.01, kwargs...) = adaptive_mean(itrs, [UncertainMean(q) for itr in itrs]; kwargs...) +call(f, x) = f(x) +adaptive_mean(itrs::Tuple, ms::Vector; n_min=10, n_max=100, rtol=.01) = begin + N = length(itrs) + vmeans = map(mean, ms) + perm = sortperm(vmeans) + draws = map(iterate, itrs) + n_start = 1+minimum(OnlineStats.nobs, ms) + n_start > 1 && display("Resuming at $n_start") + for i in n_start:n_max + draws = map(iterate, itrs) + map(OnlineStats.fit!, ms, draws) + i < n_min && continue + is_precise = all(m->Main.rtol(m) < rtol, ms) + !is_precise && continue + map!(mean, vmeans, ms) + sortperm!(perm, vmeans) + is_sorted = all(i->ms[perm[i-1]] < ms[perm[i]], 2:N) + !is_sorted && continue + display("Stopping early at i=$i") + end + ms +end +struct UncertainMean{V,Q} + var::V + qmul::Q +end +round2(x) = round(x; sigdigits=2) +Base.show(io::IO, s::UncertainMean) = print(io, round2(mean(lower(s))), rtol(s) < .05 ? "" : " ± $(round2(atol(s)))", " (via ", OnlineStats.nobs(s), " evaluations)") +Base.show(io::IO, ::MIME"text/plain", s::UncertainMean) = show(io, s) +UncertainMean(q::Real) = UncertainMean(OnlineStats.Variance(), quantile(Normal(), 1-q)) +OnlineStats.fit!(s::UncertainMean, args...) = OnlineStats.fit!(s.var, args...) +OnlineStats.nobs(s::UncertainMean) = OnlineStats.nobs(s.var) +se(s::UncertainMean) = sqrt(var(s.var)/OnlineStats.nobs(s.var)) +Statistics.mean(s::UncertainMean) = mean(s.var) +upper(s::UncertainMean) = mean(s) + atol(s) +lower(s::UncertainMean) = mean(s) - atol(s) +atol(s::UncertainMean) = s.qmul * se(s) +rtol(s::UncertainMean) = atol(s) / abs(mean(s)) +Base.:isless(s1::UncertainMean, s2::UncertainMean) = upper(s1) < lower(s2) ? true : false +allocations(f, x) = begin + f(x) + @allocations f(x) +end +nothing +``` + +# Setup code using `@dynamicstruct` +```{julia} +using DynamicObjects +@dynamicstruct struct PosteriorEvaluation + "Fixed properties are defined as standard fields and are immutable." + posterior_name::String + """ + Dynamic properties are defined via assignment. Any fixed or dynamic property is directly accessible via its name. + Once an object's dynamic property gets accessed, it gets stored in a mutable NamedTuple belonging to that object. + """ + posterior = PosteriorDB.posterior(pdb, posterior_name) + """ + We are using cached properties below, so we have to provide a base `cache_path`. + Cached properties will be written to and read from disk if available. + """ + cache_path = joinpath("cache", posterior_name) + stan_path = PosteriorDB.path(PosteriorDB.implementation(PosteriorDB.model(posterior), "stan")) + stan_problem = with_logger(ConsoleLogger(stderr, Logging.Error)) do + StanProblem( + stan_path, + PosteriorDB.load(PosteriorDB.dataset(posterior), String); + nan_on_error=true + ) + end + stan_lpdf = Base.Fix1(LogDensityProblems.logdensity, stan_problem) + julia_lpdf = StanBlocks.julia_implementation(posterior) + dimension = LogDensityProblems.dimension(stan_problem) + "x, g1 and g2 will be allocated only once per object." + x = zeros(dimension) + g1 = zeros(dimension) + g2 = zeros(dimension) + "Cached properties will be written to and read from disk if available." + @cached lpdf_difference = adaptive_median() do + randn!(x) + (julia_lpdf(x)-stan_lpdf(x)) + end + @cached lpdf_accuracy = adaptive_median() do + randn!(x) + norm(julia_lpdf(x)-stan_lpdf(x)-lpdf_difference)/nonzero(norm(stan_lpdf(x))) + end + usable = !isnothing(lpdf_accuracy) && lpdf_accuracy <= (posterior_name in ("sir-sir","one_comp_mm_elim_abs-one_comp_mm_elim_abs", "soil_carbon-soil_incubation", "hudson_lynx_hare-lotka_volterra") ? 1e-4 : 1e-8) + timing_target = 3e4 + @cached n_evals = tune_evals(bstan_lpdf; timing_target) + """ + Use `let x=...` to prevent accessing the dynamic property `x`. + `x` below does not refer to the object's property `object.x`. + Use `let julia_lpdf` or `let julia_lpdf=julia_lpdf` + to capture `object.julia_lpdf` as the local variable `julia_lpdf`. + """ + bjulia_lpdf = let x = zeros(dimension), julia_lpdf + (rng) -> julia_lpdf(randn!(rng, x)) + end + bstan_lpdf = let x = zeros(dimension), stan_lpdf + (rng) -> stan_lpdf(randn!(rng, x)) + end + @cached lpdf_comparison = merge( + adaptive_benchmark((;bstan_lpdf, bjulia_lpdf); n_evals), + (;BRIDGESTAN_VERSION) + ) + stan_gradient! = let stan_problem, x=nothing + (x, g)->(BridgeStan.log_density_gradient!(stan_problem.model, x, g)) + end + enzyme! = let julia_lpdf, x=nothing + (x, g)->(Enzyme.autodiff( + Enzyme.set_runtime_activity(Enzyme.ReverseWithPrimal), Enzyme.Const(julia_lpdf), + Enzyme.Active, + Enzyme.Duplicated(x, (g .= 0.)) + )[2], g) + end + mooncake! = let julia_lpdf, x=nothing + rule = Mooncake.build_rrule(julia_lpdf, randn(e.dimension)) + mooncake_lpdf = Mooncake.CoDual(julia_lpdf, zero_tangent(julia_lpdf)) + (x,g)->(Mooncake.__value_and_gradient!!( + rule, mooncake_lpdf, Mooncake.CoDual(x, (g .= 0.)) + )[1], g) + end + bstan_gradient! = let stan_gradient!, x=zeros(dimension), g=zeros(dimension) + (rng) -> stan_gradient!(randn!(rng, x), g) + end + benzyme! = let enzyme!, x=zeros(dimension), g=zeros(dimension) + (rng) -> enzyme!(randn!(rng, x), g) + end + bmooncake! = let mooncake!, x=zeros(dimension), g=zeros(dimension) + (rng) -> mooncake!(randn!(rng, x), g) + end + @cached gradient_comparison = merge( + adaptive_benchmark((;bstan_gradient!, benzyme!, bmooncake!); n_evals), + (;BRIDGESTAN_VERSION, ENZYME_VERSION, MOONCAKE_VERSION) + ) + @cached allocations = map(f->Main.allocations(f, Xoshiro(0)), (;bstan_lpdf, bjulia_lpdf, bstan_gradient!, benzyme!, bmooncake!)) + @cached enzyme_accuracy = adaptive_median() do + randn!(x) + stan_gradient!(x, g1) + enzyme!(x, g2) + norm(g1-g2)/nonzero(max(norm(g1),norm(g2))) + end + @cached mooncake_accuracy = adaptive_median() do + randn!(x) + stan_gradient!(x, g1) + mooncake!(x, g2) + norm(g1-g2)/nonzero(max(norm(g1),norm(g2))) + end + info = (;posterior_name, dimension, lpdf_difference, lpdf_accuracy, usable, enzyme_accuracy, mooncake_accuracy, lpdf_comparison, gradient_comparison) +end +``` +# Using the defined dynamic struct + +```{julia} +e = PosteriorEvaluation("diamonds-diamonds") +``` +Accessing `e.info` the first time will compute and store the cached properties involved. +```{julia} +@time e.info +``` +Accessing `e.info` the second time will retrieve `info` directly from `e`'s `NamedTuple` cache. +```{julia} +@time e.info +``` +Accessing the `info` property of a new object (with the same cache path) the first time will compute `info` anew, but will read cached properties from disk if available. +```{julia} +@time PosteriorEvaluation("diamonds-diamonds").info +``` \ No newline at end of file diff --git a/docs/make.jl b/docs/make.jl deleted file mode 100644 index 74fc3a2..0000000 --- a/docs/make.jl +++ /dev/null @@ -1,13 +0,0 @@ -using Documenter -push!(LOAD_PATH,"src/") -using DynamicObjects - -makedocs( - sitename = "DynamicObjects", - format = Documenter.HTML(), - modules = [DynamicObjects] -) - -deploydocs( - repo = "github.com/nsiccha/DynamicObjects.jl.git" -) diff --git a/docs/src/index.md b/docs/src/index.md deleted file mode 100644 index 1ef79a4..0000000 --- a/docs/src/index.md +++ /dev/null @@ -1,11 +0,0 @@ -# DynamicObjects.jl - -Documentation for [DynamicObjects.jl](https://github.com/nsiccha/DynamicObjects.jl). - -```@docs -DynamicObject{T} -``` - -```@docs -@dynamic_object -``` \ No newline at end of file