为什么这不能做我认为应该做的事情:
benjamin@benjamin-VirtualBox:~$ julia -p 3
julia> @everywhere(function foom(bar::Vector{Any}, k::Integer) println(repeat(bar[2],bar[1])); return bar; end)
julia> foo={{1,"a"},{2,"b"},{3,"c"}}
julia> pmap(foom, foo, 5)
From worker 2: a
1-element Array{Any,1}:
{1,"a"}
这就是它的全部输出。我期待 pmap 遍历 foo 中的每个元组并调用 foom 。
编辑:
当我不传递其他参数时,它可以正常工作:
julia> @everywhere(function foom(bar::Vector{Any}) println(repeat(bar[2],bar[1])); return bar; end)
julia> pmap(foom, foo)
From worker 3: bb
From worker 2: a
From worker 4: ccc
3-element Array{Any,1}:
{1,"a"}
{2,"b"}
{3,"c"}
如何将更多参数传递给 pmap?