-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit 77c0672
authored
task splitting: change additive accumulation to multiplicative (#53408)
Issue raised
[here](https://discourse.julialang.org/t/linear-relationship-between-xoshiro-tasks/110454).
Given this definition, look at output values:
```jl
using .Threads
macro fetch(ex) :(fetch(@Spawn($(esc(ex))))) end
function taskCorrelatedXoshiros(+ = +)
r11, r10 = @fetch (@fetch(rand(UInt64)), rand(UInt64))
r01, r00 = (@fetch(rand(UInt64)), rand(UInt64))
r01 + r10 - (r00 + r11)
end
```
Before:
```jl
julia> sort!(unique(taskCorrelatedXoshiros() for _ = 1:1000))
9-element Vector{UInt64}:
0x0000000000000000
0x0000000000000001
0x00000000007fffff
0x0000000000800000
0x0000000000800001
0xffffffffff7fffff
0xffffffffff800000
0xffffffffff800001
0xffffffffffffffff
```
After:
```jl
julia> sort!(unique(taskCorrelatedXoshiros() for _ = 1:1000))
1000-element Vector{UInt64}:
0x000420647a085960
0x0038c5b889b585c6
0x007b29fae8107ff7
0x00e73b9e883ac1c8
⋮
0xfe68be9c0dde1e88
0xfeca042354218c35
0xfeeb8203e470c96b
0xfff5dbb8771307b9
julia> sort!(unique(taskCorrelatedXoshiros(*) for _ = 1:1000))
1000-element Vector{UInt64}:
0x00126f951c1e56dc
0x0025a82477ffac08
0x002dd82c9986457a
0x00a713c4d56a3dbc
⋮
0xfe2e40a5b345095e
0xfe77b90881967436
0xfea2559be63f1701
0xff88b5b28cefac5f
```1 parent c80a964 commit 77c0672Copy full SHA for 77c0672
File tree
Expand file treeCollapse file tree
1 file changed
+143
-198
lines changedFilter options
- src
Expand file treeCollapse file tree
1 file changed
+143
-198
lines changed
0 commit comments