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
In the following minimal example, an outer function executes the inner function many times in parallel and is itself executed multiple times. The problem is trivially parallelizable, i.e. there are no dependencies across tasks.
I'm running Julia with 22 threads:
julia> Base.Threads.nthreads()
22
Copy-pasteable example
using Dagger
# Inner functionfunctioninner_sleep()
sleep(2)
end# Outer functionfunctionouter_sleep()
@syncfor _ in1:10
Dagger.@spawninner_sleep()
end
Base.Threads.threadid()
end# Run outer task N times in parallel@timefetch.([Dagger.@spawnouter_sleep() for _ in1:2])
Results
If my understanding of the task-based parallelism approach is correct, this should take roughly 2 seconds regardless of how many outer tasks I'm spawning.
This actually takes ~4 seconds instead, on my machine.
The text was updated successfully, but these errors were encountered:
wolthom
changed the title
Parallelization across threads does appear to work correctly
Parallelization across threads does not appear to work correctly
Jul 13, 2024
Context
In the following minimal example, an outer function executes the inner function many times in parallel and is itself executed multiple times. The problem is trivially parallelizable, i.e. there are no dependencies across tasks.
I'm running Julia with 22 threads:
Copy-pasteable example
Results
If my understanding of the task-based parallelism approach is correct, this should take roughly 2 seconds regardless of how many outer tasks I'm spawning.
This actually takes ~4 seconds instead, on my machine.
The text was updated successfully, but these errors were encountered: