Closed pazner closed 5 months ago
I think, that this is due to default_worker_pool
not being emptied from the rmprocs call. If we do a take!
after the rmprocs, the default_worker_pool is empty and the pmap call runs sequentially as expected. Unfortunately I don't know what is happening in this call of take!.
julia> addprocs(5);
julia> @time @sync pmap(i -> sleep(1), 1:10);
3.307411 seconds (115.06 k allocations: 5.953 MiB, 4.43% compilation time)
julia> default_worker_pool()
WorkerPool(Channel{Int64}(9223372036854775807), Set([35, 32, 36, 33, 34]), RemoteChannel{Channel{Any}}(1, 1, 28))
julia> wait(rmprocs(workers()...))
julia> default_worker_pool()
WorkerPool(Channel{Int64}(9223372036854775807), Set([35, 32, 36, 33, 34]), RemoteChannel{Channel{Any}}(1, 1, 28))
julia> take!(default_worker_pool())
1
julia> default_worker_pool()
WorkerPool(Channel{Int64}(9223372036854775807), Set{Int64}(), RemoteChannel{Channel{Any}}(1, 1, 28))
julia> @time @sync pmap(i -> sleep(1), 1:10);
10.144675 seconds (72.51 k allocations: 3.716 MiB, 1.19% compilation time)
seems working now as expected
julia> @time @sync pmap(i -> sleep(1), 1:10);
4.854871 seconds (2.19 M allocations: 110.307 MiB, 0.41% gc time, 26.33% compilation time)
julia> wait(rmprocs(workers()...))
julia> @time @sync pmap(i -> sleep(1), 1:10);
10.106080 seconds (81.12 k allocations: 4.103 MiB, 0.83% compilation time)
julia> @time @sync pmap(i -> sleep(1), 1:10);
10.106958 seconds (81.12 k allocations: 4.095 MiB, 0.83% compilation time)
even though default_worker_pool()
still has out-of-date info before take!
The first call to
pmap
after usingrmprocs
to remove all the workers still behaves as if it is running in parallel. The second call behaves normally:Version info: