@@ -57,7 +57,7 @@ include("mapreduce_nd.jl")
5757 op, src::AbstractArray, backend::Backend=get_backend(src);
5858 init,
5959 neutral=neutral_element(op, typeof(init)),
60- dims::Union{Nothing, Int, Tuple{Vararg{Int}}, Colon} =nothing,
60+ dims=nothing,
6161
6262 # CPU settings
6363 max_tasks::Int=Threads.nthreads(),
@@ -70,16 +70,16 @@ include("mapreduce_nd.jl")
7070 )
7171
7272Reduce `src` along dimensions `dims` using the binary operator `op`. If `dims` is `nothing` or
73- `:`, reduce `src` to a scalar. If `dims` is an integer or a tuple of integers, reduce `src` along
74- those dimension(s). The `init` value is used as the initial value for the reduction; `neutral` is
75- the neutral element for the operator `op`.
73+ `:`, reduce `src` to a scalar. If `dims` is an integer or a collection of integers, reduce `src`
74+ along those dimension(s). The `init` value is used as the initial value for the reduction; `neutral`
75+ is the neutral element for the operator `op`.
7676
7777The returned type is the same as `init` - to control output precision, specify `init` explicitly.
7878
7979## CPU settings
8080Use at most `max_tasks` threads with at least `min_elems` elements per task. For N-dimensional
81- arrays (`dims` is an integer or tuple ) multithreading currently only becomes faster for
82- `max_tasks >= 4`; all other cases are scaling linearly with the number of threads.
81+ arrays (`dims` is an integer or a collection of integers ) multithreading currently only becomes
82+ faster for `max_tasks >= 4`; all other cases are scaling linearly with the number of threads.
8383
8484Note that multithreading reductions only improves performance for cases with more compute-heavy
8585operations, which hide the memory latency and thread launch overhead - that includes:
@@ -93,8 +93,8 @@ The `block_size` parameter controls the number of threads per block and must be
9393
9494The `temp` parameter can be used to pass a pre-allocated temporary array. For reduction to a scalar
9595(`dims=nothing` or `dims=:`), `length(temp) >= 2 * (length(src) + 2 * block_size - 1) ÷ (2 *
96- block_size)` is required. For reduction along dimensions (`dims` is an integer or tuple), `temp` is
97- used as the destination array, and thus must have the exact dimensions required - i.e. same
96+ block_size)` is required. For reduction along dimensions (`dims` is an integer or a collection of
97+ integers), `temp` is used as the destination array, and thus must have the exact dimensions required - i.e. same
9898dimensionwise sizes as `src`, except for the reduced dimension(s) which become 1; there are some
9999corner cases when one dimension is zero, check against `Base.reduce` for CPU arrays for exact
100100behavior.
142142 f, op, src::AbstractArray, backend::Backend=get_backend(src);
143143 init,
144144 neutral=neutral_element(op, typeof(init)),
145- dims::Union{Nothing, Int, Tuple{Vararg{Int}}, Colon} =nothing,
145+ dims=nothing,
146146
147147 # CPU settings
148148 max_tasks::Int=Threads.nthreads(),
158158 mapreduce(f, op, A::AbstractArray, B::AbstractArray, As::AbstractArray..., backend::Backend; init, kwargs...)
159159
160160Reduce `src` along dimensions `dims` using the binary operator `op` after applying `f` elementwise.
161- If `dims` is `nothing` or `:`, reduce `src` to a scalar. If `dims` is an integer or a tuple of
161+ If `dims` is `nothing` or `:`, reduce `src` to a scalar. If `dims` is an integer or a collection of
162162integers, reduce `src` along those dimension(s). The `init` value is used as the initial value for
163163the reduction (i.e. after mapping).
164164
@@ -175,16 +175,16 @@ are reduced without materializing the intermediate array. Mismatched axes throw
175175
176176## CPU settings
177177Use at most `max_tasks` threads with at least `min_elems` elements per task. For N-dimensional
178- arrays (`dims` is an integer or tuple ) multithreading currently only becomes faster for
179- `max_tasks >= 4`; all other cases are scaling linearly with the number of threads.
178+ arrays (`dims` is an integer or a collection of integers ) multithreading currently only becomes
179+ faster for `max_tasks >= 4`; all other cases are scaling linearly with the number of threads.
180180
181181## GPU settings
182182The `block_size` parameter controls the number of threads per block and must be a power of two.
183183
184184The `temp` parameter can be used to pass a pre-allocated temporary array. For reduction to a scalar
185185(`dims=nothing` or `dims=:`), `length(temp) >= 2 * (length(src) + 2 * block_size - 1) ÷ (2 *
186- block_size)` is required. For reduction along dimensions (`dims` is an integer or tuple), `temp` is
187- used as the destination array, and thus must have the exact dimensions required - i.e. same
186+ block_size)` is required. For reduction along dimensions (`dims` is an integer or a collection of
187+ integers), `temp` is used as the destination array, and thus must have the exact dimensions required - i.e. same
188188dimensionwise sizes as `src`, except for the reduced dimension(s) which become 1; there are some
189189corner cases when one dimension is zero, check against `Base.reduce` for CPU arrays for exact
190190behavior.
@@ -281,7 +281,7 @@ function _mapreduce_impl(
281281 f, op, src:: MapReduceSource , backend:: Backend ;
282282 init,
283283 neutral= neutral_element (op, typeof (init)),
284- dims:: Union{Nothing, Int, Tuple{Vararg{Int}}, Colon} = nothing ,
284+ dims = nothing ,
285285
286286 # CPU settings
287287 max_tasks:: Int = Threads. nthreads (),
0 commit comments