Search code examples
arraysmultithreadinggpuprefix-sum

How to a thread performs Binary Search on the Prefix-Sum array


In the context of Parallel programming and GPU, we have an array that is called Prefix-Sum array. In Dynamic Mapping, each thread performs a binary search on the Prefix-Sum to find the corresponding Work-Item.

Thread to Work-Item

It is a question for me, How a thread know for which work-item or work-unit will be searched?


Solution

  • Thread 5 does a binary search for its own identity 5

    5 <25
    5 < 9
    5 > 3
    4 (work item 2)