@@ -124,58 +124,26 @@ AK.accumulate!(+, v, alg=AK.ScanPrefixes())
124124function accumulate! (
125125 op, v:: AbstractArray , backend:: Backend = get_backend (v);
126126 init,
127- neutral= neutral_element (op, eltype (v)),
128- dims:: Union{Nothing, Int} = nothing ,
129- inclusive:: Bool = true ,
130-
131- # CPU settings
132- max_tasks:: Int = Threads. nthreads (),
133- min_elems:: Int = 2 ,
134-
135- # Algorithm choice
136- alg:: AccumulateAlgorithm = DecoupledLookback (),
137-
138- # GPU settings
139- block_size:: Int = 256 ,
140- temp:: Union{Nothing, AbstractArray} = nothing ,
141- temp_flags:: Union{Nothing, AbstractArray} = nothing ,
127+ kwargs...
142128)
143129 _accumulate_impl! (
144- op, v, backend,
145- init= init, neutral= neutral, dims= dims, inclusive= inclusive,
146- max_tasks= max_tasks, min_elems= min_elems,
147- alg= alg,
148- block_size= block_size, temp= temp, temp_flags= temp_flags,
130+ op, v, backend;
131+ init,
132+ kwargs...
149133 )
150134end
151135
152136
153137function accumulate! (
154138 op, dst:: AbstractArray , src:: AbstractArray , backend:: Backend = get_backend (dst);
155139 init,
156- neutral= neutral_element (op, eltype (dst)),
157- dims:: Union{Nothing, Int} = nothing ,
158- inclusive:: Bool = true ,
159-
160- # CPU settings
161- max_tasks:: Int = Threads. nthreads (),
162- min_elems:: Int = 2 ,
163-
164- # Algorithm choice
165- alg:: AccumulateAlgorithm = DecoupledLookback (),
166-
167- # GPU settings
168- block_size:: Int = 256 ,
169- temp:: Union{Nothing, AbstractArray} = nothing ,
170- temp_flags:: Union{Nothing, AbstractArray} = nothing ,
140+ kwargs...
171141)
172142 copyto! (dst, src)
173143 _accumulate_impl! (
174- op, dst, backend,
175- init= init, neutral= neutral, dims= dims, inclusive= inclusive,
176- max_tasks= max_tasks, min_elems= min_elems,
177- alg= alg,
178- block_size= block_size, temp= temp, temp_flags= temp_flags,
144+ op, dst, backend;
145+ init,
146+ kwargs...
179147 )
180148end
181149
@@ -200,17 +168,17 @@ function _accumulate_impl!(
200168)
201169 if isnothing (dims)
202170 return accumulate_1d! (
203- op, v, backend, alg,
204- init= init , neutral= neutral, inclusive = inclusive,
205- max_tasks= max_tasks, min_elems = min_elems,
206- block_size= block_size , temp= temp, temp_flags = temp_flags,
171+ op, v, backend, alg;
172+ init, neutral, inclusive,
173+ max_tasks, min_elems,
174+ block_size, temp, temp_flags,
207175 )
208176 else
209177 return accumulate_nd! (
210- op, v, backend,
211- init= init , neutral= neutral , dims= dims, inclusive = inclusive,
212- max_tasks= max_tasks, min_elems = min_elems,
213- block_size= block_size ,
178+ op, v, backend;
179+ init, neutral, dims, inclusive,
180+ max_tasks, min_elems,
181+ block_size,
214182 )
215183 end
216184end
@@ -242,31 +210,15 @@ Out-of-place version of [`accumulate!`](@ref).
242210function accumulate (
243211 op, v:: AbstractArray , backend:: Backend = get_backend (v);
244212 init,
245- neutral= neutral_element (op, eltype (v)),
246- dims:: Union{Nothing, Int} = nothing ,
247- inclusive:: Bool = true ,
248-
249- # CPU settings
250- max_tasks:: Int = Threads. nthreads (),
251- min_elems:: Int = 2 ,
252-
253- # Algorithm choice
254- alg:: AccumulateAlgorithm = DecoupledLookback (),
255-
256- # GPU settings
257- block_size:: Int = 256 ,
258- temp:: Union{Nothing, AbstractArray} = nothing ,
259- temp_flags:: Union{Nothing, AbstractArray} = nothing ,
213+ kwargs...
260214)
261215 dst_type = Base. promote_op (op, eltype (v), typeof (init))
262216 vcopy = similar (v, dst_type)
263217 copyto! (vcopy, v)
264218 accumulate! (
265219 op, vcopy, backend;
266- init= init, neutral= neutral, dims= dims, inclusive= inclusive,
267- max_tasks= max_tasks, min_elems= min_elems,
268- alg= alg,
269- block_size= block_size, temp= temp, temp_flags= temp_flags,
220+ init,
221+ kwargs...
270222 )
271223 vcopy
272224end
0 commit comments