Skip to content

Conversation

dstahlke
Copy link

This allows calling reduce on MappedArrays types. That's nice because you can avoid allocating a large array to store the input. For example,

julia> using AcceleratedKernels, CUDA, MappedArrays
julia> AcceleratedKernels.sum(mappedarray(sin, 1:10_000_000_000), CUDABackend(false,false))

I'm creating a bare-bones pull request to get feedback on whether this is desired. If so, I can add a unit test.

@anicusan
Copy link
Member

This is great, one of the primary reasons I added an explicit backend argument to all functions was to allow unmaterialised types such as ranges - e.g. having any work over eachindex(v) instead of v directly for more complex conditions. I haven't tested that on reduce, for which the temp check was failing.

A test for such unmaterialised types - MappedArrays or simple ranges - would be very useful; and perhaps including such tests for the other functions, thanks!

@dstahlke
Copy link
Author

Unit tests added for range and mappedvector.

I tried to also get this working for mapreduce_nd. There are a variety of InvalidIRError, for example "unsupported dynamic function invocation (call to convert)" and "unsupported dynamic function invocation (call to print_to_string". Test case:

AK.mapreduce(x->x[1], +, CartesianIndices((12:345, 67:89)), CUDABackend(), init=10)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants