Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Libtask.TapedTask #1778

Merged
merged 2 commits into from
Feb 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Turing"
uuid = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"
version = "0.20.2"
version = "0.20.3"

[deps]
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
Expand Down
3 changes: 1 addition & 2 deletions docs/src/using-turing/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,5 +191,4 @@ model = Turing.Model(modelf, (x = [1.5, 2.0],))

## Task Copying


Turing [copies](https://github.com/JuliaLang/julia/issues/4085) Julia tasks to deliver efficient inference algorithms, but it also provides alternative slower implementation as a fallback. Task copying is enabled by default. Task copying requires us to use the `CTask` facility which is provided by [Libtask](https://github.com/TuringLang/Libtask.jl) to create tasks.
Turing [copies](https://github.com/JuliaLang/julia/issues/4085) Julia tasks to deliver efficient inference algorithms, but it also provides alternative slower implementation as a fallback. Task copying is enabled by default. Task copying requires us to use the `TapedTask` facility which is provided by [Libtask](https://github.com/TuringLang/Libtask.jl) to create tasks.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good. By the way, soon we can also remove the TArray related docs since the new Libtask can deep-copy heap-allocated objects - we still need to activate it. See https://github.com/TuringLang/Libtask.jl/blob/4a85b47756259c2778c4336c69b7abc0b61a0fb9/src/tapedfunction.jl#L309

10 changes: 5 additions & 5 deletions src/essential/container.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ function AdvancedPS.reset_logprob!(f::TracedModel)
return
end

function Libtask.CTask(model::TracedModel)
return Libtask.CTask(model.evaluator[1], model.evaluator[2:end]...)
function Libtask.TapedTask(model::TracedModel)
return Libtask.TapedTask(model.evaluator[1], model.evaluator[2:end]...)
end

function Libtask.CTask(model::TracedModel, ::Random.AbstractRNG)
return Libtask.CTask(model)
end
function Libtask.TapedTask(model::TracedModel, ::Random.AbstractRNG)
return Libtask.TapedTask(model)
end