JuliaLang / JuliaLang/Distributed.jl

Calling pmap within threads hangs

Open
#69 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
55
Forks
19
PR merge metrics
No merged PRs in 30d

Description

Hi, for some reason the code snippet below hangs. Does any one have an explanation as to why this hangs

using distributed
addprocs(2)
tasks = Vector{Task}(undef,4)
@sync for i in 1:4
       tasks[i] = Threads.@spawn begin
           pmap(x->x, WorkerPool(workers()), 1:10)
       end
end
fetch.(tasks)

Surprisingly if i first run pmap(x->x, WorkerPool(workers()), 1:10) before running the code above everything works as expected.

julia> versioninfo()
Julia Version 1.4.1
Commit 381693d3df* (2020-04-14 17:20 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i3-5005U CPU @ 2.00GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-8.0.1 (ORCJIT, broadwell)
Environment:
JULIA_NUM_THREADS = 4

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Julia 1.4.1 example using JULIA_NUM_THREADS=4, addprocs(2), Threads.@spawn, and pmap with WorkerPool(workers()). Compare it with the version that runs pmap once beforehand; done means identifying why the threaded calls hang and documenting or correcting the behavior with a reliable verification.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.