Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ceiling division #253

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/dreduce.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ See also: [Parallel processing tutorial](@ref tutorial-parallel),

# Keyword Arguments
- `pool::AbstractWorkerPool`: Passed to `Distributed.remotecall`.
- `basesize::Integer = length(array) ÷ nworkers()`: A size of chunk in
- `basesize::Integer = length(array) / nworkers()`: A size of chunk in
`array` that is processed by each worker. A smaller size may be
required when computation time for processing each item can
fluctuate a lot.
- `threads_basesize::Integer = basesize ÷ nthreads()`: A size of chunk
- `threads_basesize::Integer = basesize / nthreads()`: A size of chunk
in `array` that is processed by each task in each worker process.
The default setting assumes that the number of threads used in all
workers are the same. For heterogeneous setup where each worker
Expand All @@ -50,8 +50,8 @@ See [`dreduce`](@ref) and [`transduce`](@ref).
function dtransduce(
xform::Transducer, step, init, coll;
simd::SIMDFlag = Val(false),
basesize::Integer = max(1, length(coll) ÷ Distributed.nworkers()),
threads_basesize::Integer = max(1, basesize ÷ Threads.nthreads()),
basesize::Integer = max(1, cld(length(coll), Distributed.nworkers())),
threads_basesize::Integer = max(1, cld(basesize, Threads.nthreads())),
pool::Distributed.AbstractWorkerPool = Distributed.default_worker_pool(),
_remote_reduce = _transduce_assoc_nocomplete,
)
Expand Down
6 changes: 3 additions & 3 deletions src/reduce.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ See also: [Parallel processing tutorial](@ref tutorial-parallel),
[`foldl`](@ref), [`dreduce`](@ref).

# Keyword Arguments
- `basesize::Integer = length(reducible) ÷ nthreads()`: A size of
- `basesize::Integer = length(reducible) / nthreads()`: bA size of
chunk in `reducible` that is processed by each worker. A smaller
size may be required when:
* computation time for processing each item fluctuates a lot
Expand Down Expand Up @@ -135,7 +135,7 @@ function transduce_assoc(
init,
coll;
simd::SIMDFlag = Val(false),
basesize::Integer = length(coll) ÷ Threads.nthreads(),
basesize::Integer = cld(length(coll), Threads.nthreads()),
stoppable::Union{Bool,Nothing} = nothing,
)
rf = maybe_usesimd(Reduction(xform, step), simd)
Expand Down Expand Up @@ -424,7 +424,7 @@ function tcopy(
::typeof(Map(identity)),
T::Type{<:AbstractSet},
array::PartitionableArray;
basesize::Integer = max(1, length(array) ÷ Threads.nthreads()),
basesize::Integer = max(1, cld(length(array), Threads.nthreads())),
kwargs...,
)
@argcheck basesize >= 1
Expand Down