diff --git a/NEWS.md b/NEWS.md index 9f228133e49d3..51e760b07772c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -34,6 +34,8 @@ New library features Standard library changes ------------------------ +* `pmap` now defaults to using a `CachingPool` ([#33892]). + #### Package Manager #### LinearAlgebra diff --git a/stdlib/Distributed/src/pmap.jl b/stdlib/Distributed/src/pmap.jl index f884d47fff98e..39acc4d1149b2 100644 --- a/stdlib/Distributed/src/pmap.jl +++ b/stdlib/Distributed/src/pmap.jl @@ -40,8 +40,8 @@ For multiple collection arguments, apply `f` elementwise. Note that `f` must be made available to all worker processes; see [Code Availability and Loading Packages](@ref code-availability) for details. -If a worker pool is not specified, all available workers, i.e., the default worker pool -is used. +If a worker pool is not specified all available workers will be used via a [`CachingPool`](@ref). + By default, `pmap` distributes the computation over all specified workers. To use only the local process and distribute over tasks, specify `distributed=false`. @@ -153,7 +153,7 @@ function pmap(f, p::AbstractWorkerPool, c; distributed=true, batch_size=1, on_er end pmap(f, p::AbstractWorkerPool, c1, c...; kwargs...) = pmap(a->f(a...), p, zip(c1, c...); kwargs...) -pmap(f, c; kwargs...) = pmap(f, default_worker_pool(), c; kwargs...) +pmap(f, c; kwargs...) = pmap(f, CachingPool(workers()), c; kwargs...) pmap(f, c1, c...; kwargs...) = pmap(a->f(a...), zip(c1, c...); kwargs...) function wrap_on_error(f, on_error; capture_data=false)