You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
C shim for [task copying](https://github.com/JuliaLang/julia/issues/4085) in Turing
5
+
Tape based task copying in Turing
6
6
7
7
## Getting Started
8
8
@@ -13,7 +13,7 @@ using Libtask
13
13
14
14
functionf()
15
15
t =0
16
-
whiletrue
16
+
for _ in1:10
17
17
produce(t)
18
18
t =1+ t
19
19
end
@@ -39,7 +39,7 @@ using Libtask
39
39
40
40
functionf()
41
41
t = [012]
42
-
whiletrue
42
+
for _ in1:10
43
43
produce(t[1])
44
44
t[1] =1+ t[1]
45
45
end
@@ -58,17 +58,17 @@ a = copy(t)
58
58
@showconsume(ctask) # 5
59
59
```
60
60
61
-
`TArray` implements a copy-on-write array. This is useful for task copying.
62
-
In constrast to standard arrays, which are only shallow copied during task copying,
63
-
`TArray` are deep copied after task copying:
61
+
In constrast to standard arrays, which are only shallow copied during
62
+
task copying, `TArray`, an array data structure provided by Libtask,
63
+
is deep copied during the copying process of a task:
64
64
65
65
```julia
66
66
using Libtask
67
67
68
68
functionf()
69
69
t =TArray(Int, 1)
70
70
t[1] =0
71
-
whiletrue
71
+
for _ in1:10
72
72
produce(t[1])
73
73
t[1] =1+ t[1]
74
74
end
@@ -87,20 +87,18 @@ a = copy(ctask)
87
87
@showconsume(ctask) # 3
88
88
```
89
89
90
-
Note: The [Turing](https://github.com/TuringLang/Turing.jl) probabilistic programming language uses this task copying feature in an efficient implementation of the [particle filtering](https://en.wikipedia.org/wiki/Particle_filter) sampling algorithm for arbitary order [Markov processes](https://en.wikipedia.org/wiki/Markov_model#Hidden_Markov_model).
90
+
Note: The [Turing](https://github.com/TuringLang/Turing.jl)
91
+
probabilistic programming language uses this task copying feature in
This feature is still experimental and should only be used with caution. Some discussions on its potential caveats can be found [here](https://github.com/JuliaLang/julia/pull/15078).
95
-
96
-
## Julia nightly
97
-
98
-
Libtask uses the `libtask_julia` library which is pre-built for Julia versions 1.3, 1.4, and 1.5 and
99
-
distributed via the [Libtask_jll](https://github.com/JuliaBinaryWrappers/Libtask_jll.jl/) package.
100
-
101
-
Julia nightly might not be compatible with the latest version of the `libtask_julia` library and is
102
-
not officially supported. If you want to use Julia nightly, you have to add the Libtask_jll package
0 commit comments