Skip to content
Draft
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
10 changes: 7 additions & 3 deletions ext/AdvancedPSLibtaskExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ TapedGlobals(rng::Random.AbstractRNG) = TapedGlobals(rng, nothing)
State wrapper to hold `Libtask.CTask` model initiated from `f`.
"""
function AdvancedPS.LibtaskModel(
f::AdvancedPS.AbstractGenericModel, rng::Random.AbstractRNG, args...
f::AdvancedPS.AbstractGenericModel, rng::Random.AbstractRNG
) # Changed the API, need to take care of the RNG properly
return AdvancedPS.LibtaskModel(f, Libtask.TapedTask(TapedGlobals(rng), f, args...))
return AdvancedPS.LibtaskModel(
f, Libtask.TapedTask(TapedGlobals(rng), f.fargs...; f.kwargs...)
)
end

"""
Expand Down Expand Up @@ -114,7 +116,9 @@ function AdvancedPS.forkr(trace::LibtaskTrace)
newf = AdvancedPS.reset_model(trace.model.f)
Random123.set_counter!(rng, 1)

ctask = Libtask.TapedTask(TapedGlobals(rng, get_other_global(trace)), newf)
ctask = Libtask.TapedTask(
TapedGlobals(rng, get_other_global(trace)), newf.fargs...; newf.kwargs...
)
new_tapedmodel = AdvancedPS.LibtaskModel(newf, ctask)

# add backward reference
Expand Down