Skip to content

Support mapreduce with multiple source arrays #54

@christiangnrd

Description

@christiangnrd

In GPUArrays, this is implemented with broadcasting. This will probably require a breaking release since the backend argument will no longer be able to be the last argument.

julia> import AcceleratedKernels as AK; a = ones(5); b = ones(5);

julia> mapreduce(+,+,a,b)
10.0

julia> AK.mapreduce(+,+,a,b; init=0)
ERROR: MethodError: no method matching mapreduce(::typeof(+), ::typeof(+), ::Vector{Float64}, ::Vector{Float64}; init::Int64)
You may have intended to import Base.mapreduce
The function `mapreduce` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  mapreduce(::Any, ::Any, ::AbstractArray, ::KernelAbstractions.Backend; init, kwargs...)
   @ AcceleratedKernels ~/.julia/packages/AcceleratedKernels/xxjhi/src/reduce/reduce.jl:156
  mapreduce(::Any, ::Any, ::AbstractArray; ...)
   @ AcceleratedKernels ~/.julia/packages/AcceleratedKernels/xxjhi/src/reduce/reduce.jl:156

Stacktrace:
 [1] top-level scope
   @ REPL[10]:1
 [2] top-level scope
   @ ~/.julia/dev/Metal/src/initialization.jl:80
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions