Skip to content

Commit 48703aa

Browse files
authored
update docs, remove useless code (#98)
1 parent 6e43a21 commit 48703aa

File tree

3 files changed

+21
-42
lines changed

3 files changed

+21
-42
lines changed

README.md

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Libtask Testing](https://github.com/TuringLang/Libtask.jl/workflows/Libtask%20Testing/badge.svg)](https://github.com/TuringLang/Libtask.jl/actions?branch=master)
44

5-
C shim for [task copying](https://github.com/JuliaLang/julia/issues/4085) in Turing
5+
Tape based task copying in Turing
66

77
## Getting Started
88

@@ -13,7 +13,7 @@ using Libtask
1313

1414
function f()
1515
t = 0
16-
while true
16+
for _ in 1:10
1717
produce(t)
1818
t = 1 + t
1919
end
@@ -39,7 +39,7 @@ using Libtask
3939

4040
function f()
4141
t = [0 1 2]
42-
while true
42+
for _ in 1:10
4343
produce(t[1])
4444
t[1] = 1 + t[1]
4545
end
@@ -58,17 +58,17 @@ a = copy(t)
5858
@show consume(ctask) # 5
5959
```
6060

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:
6464

6565
```julia
6666
using Libtask
6767

6868
function f()
6969
t = TArray(Int, 1)
7070
t[1] = 0
71-
while true
71+
for _ in 1:10
7272
produce(t[1])
7373
t[1] = 1 + t[1]
7474
end
@@ -87,20 +87,18 @@ a = copy(ctask)
8787
@show consume(ctask) # 3
8888
```
8989

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
92+
an efficient implementation of the [particle
93+
filtering](https://en.wikipedia.org/wiki/Particle_filter) sampling
94+
algorithm for arbitary order [Markov
95+
processes](https://en.wikipedia.org/wiki/Markov_model#Hidden_Markov_model).
9196

9297
## Disclaimer
9398

94-
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
103-
manually:
104-
```julia
105-
julia> ] add https://github.com/JuliaBinaryWrappers/Libtask_jll.jl.git
106-
```
99+
- This feature is still experimental and should only be used with caution:
100+
- Dynamic control flow is not supported yet.
101+
- From v0.6.0, Libtask is implemented by recording all the computing
102+
to a tape and copying that tape. Before that version, it is based on
103+
a tricky hack on the Julia internals. You can check the commit
104+
history of this repo to see the details.

src/tapedtask.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ function TapedTask(tf::TapedFunction, args...)
2525
rethrow()
2626
finally
2727
@static if VERSION >= v"1.4"
28+
# we don't do this under Julia 1.3, because `isempty` always hangs on
29+
# an empty channel.
2830
while !isempty(produce_ch)
2931
yield()
3032
end

utils/methods_of_array.jl

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)