Skip to content

Commit

Permalink
simpler way to calculate maximum grain size
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwindiff committed Mar 9, 2023
1 parent c214237 commit 4af969b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/mapreduce.jl
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,7 @@ function GPUArrays.mapreducedim!(f::F, op::OP, R::WrappedMtlArray{T},
#
# also, make sure the grain size is not too high so as to starve threads of work.
other_groups = length(Rother)
while grain > 1 && length(Rreduce) <= reduce_threads * prevpow(2, grain)
grain >>= 1
end
grain = min(grain, prevpow(2, cld(length(Rreduce), reduce_threads)))
reduce_groups = cld(length(Rreduce), reduce_threads * grain)

# determine the launch configuration
Expand Down

0 comments on commit 4af969b

Please sign in to comment.