-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a
cache
flag to delayed
- result will be cached until a memo…
…ry limit is reached on each worker. Default memory limit is 50% of memory / number of workers in the node
- Loading branch information
Shashi Gowda
committed
May 2, 2017
1 parent
d27a967
commit dee4971
Showing
6 changed files
with
176 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Base.Test | ||
using Dagger | ||
@testset "cache" begin | ||
# set available memory to 8MB on each worker | ||
test_extra = 8*10^6 | ||
map(workers()) do pid | ||
pid=>remotecall_fetch(pid) do | ||
totsz = sum(map(x->x.size, Dagger._token_order)) | ||
Dagger.MAX_MEMORY[] = totsz + test_extra | ||
end | ||
end | ||
|
||
thunks1 = map(delayed(_ -> (println(myid()); rand(10^5)), cache=true), workers()) | ||
sum1 = delayed((x...)->sum([x...]))(map(delayed(sum), thunks1)...) | ||
thunks2 = map(delayed(-), thunks1) | ||
sum2 = delayed((x...)->sum([x...]))(map(delayed(sum), thunks2)...) | ||
s1 = gather(sum1) | ||
@test -s1 == gather(sum2) | ||
@test s1 == gather(sum1) | ||
@test -gather(sum1) == gather(sum2) | ||
|
||
thunks1 = map(delayed(_ -> rand(10^6), cache=true), workers()) | ||
sum1 = delayed((x...)->sum([x...]))(map(delayed(sum), thunks1)...) | ||
thunks2 = map(delayed(-), thunks1) | ||
sum2 = delayed((x...)->sum([x...]))(map(delayed(sum), thunks2)...) | ||
s1 = gather(sum1) # this should evict thunk1s from memory | ||
@test -s1 != gather(sum2) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ using Dagger | |
|
||
include("domain.jl") | ||
include("array.jl") | ||
include("cache.jl") |