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
I came up with the following version which still fails, but for reasons related to @spawn in @spawn lock(() -> fit!(agg(), data), lck).
using Dagger:@spawn, @shardusing Distributed
# add two further julia processes which could run on other machinesaddprocs(2, exeflags="--threads=2")
# Distributed.@everywhere execute code on all machines@everywhereusing Dagger, DataFrames, OnlineStats
# Dagger uses both Threads and Machines as processes
Dagger.all_processors()
# let's distributes some calculations
aggregators = [Mean, Variance, Extrema]
df =DataFrame()
# @sync waits until all enclosed calls to @spawn are ready@syncfor i in1:1000
data =@spawnrand(10000)
# This creates a lock per worker. If the task is run on# a worker, the correct lock is automatically picked up.# Needed for multi-threading access to data.
lck =@shardReentrantLock()
for agg in aggregators
res =@spawnlock(() ->fit!(agg(), data), lck)
push!(df, (i=i, aggregator=nameof(agg), result=res))
endend
df.result .=fetch.(df.result)
This is not exactly a bug per-se, as we've always only unwrapped EagerThunk dependencies when passed as explicit arguments to Dagger.@spawn.
Yet, it is also desirable to allow something like this, where the EagerThunk is embedded within a closure. I have a branch where I've worked on this, but it never materialized since we need to both pull out such implicit arguments from the closure, but also put them back into the same closure, which I couldn't figure out how to do.
Anyway, I agree that it's worth doing this, but it will take some time to implement, and it's not my top priority. In the meantime, either use Dagger.spawn or instead pass it as an explicit argument.
While trying to workaround #478
I came up with the following version which still fails, but for reasons related to
@spawn
in@spawn lock(() -> fit!(agg(), data), lck)
.results in the following error
This might relate to #357, but I am unsure.
The text was updated successfully, but these errors were encountered: