0
$\begingroup$

Compared to "vectors addition" which can naturally work independently for the summation of each of its corresponding elements, it allows parallel work by processors. Example:

[1 2 3] + [4 5 6] = [5 7 9]

Which only requires 1 iteration.

How to make the "cumulative sum" operation algorithm work in parallel on a vector? Consider the following sequential cumulative sum problem: Give vector

a_vector := [1 2 3]
empty_vector := []
Step 1 -> [1]
Step 2 -> [1 3]
Step 3 -> [1 3 6]

Those steps filling up the empty vector. So it takes 3 iterations longer.

Though both produce the same number of elements as the number of elements in its operand, so it can be said that both are elementwise operations.

asked Dec 31, 2023 at 12:55
$\endgroup$

1 Answer 1

1
$\begingroup$

Use a parallel prefix sum algorithm. See Wikipedia for some examples.

answered Jan 1, 2024 at 2:38
$\endgroup$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.