Dan Stahlke
Dan Stahlke

Reputation: 1469

CUDA.jl mapreduce integer sequence without creating intermediate array

Is there a way to do the following without creating the cuArray?

using CUDA
a = CuArray(1:100_000_000)
sum(sin, a)

Claude suggests CUDA.sum(sin(x) for x in 1:100_000_000) but this seems to execute on CPU rather than GPU.

In C++ I'd use thrust::make_counting_iterator.

Though I phrased the question in terms of sum for simplicity, I'm actually more interested in findall. Presumably the same technique would apply to both.

Upvotes: 0

Views: 32

Answers (0)

Related Questions