Data race in SYCL Guide code

Hello,
I’ve been trying to write a sum function in SYCL, so I took a look at the example given here
https://developer.codeplay.com/products/computecpp/ce/guides/sycl-guide/memory.
I believe there is a data race occuring in the full code since it doesn’t always give the correct sum. I guess there is no guarantee the work groups will work on the data at the start of the array first, so a partial sum could already be written to the buffer, and then read by another work group.

I thought I should flag it so others don’t get confused.

Finlay

Hi Finlay, thanks for reporting this. We will take a look and see if we need to make some adjustments to the code.
Thanks,
Rod.

Hello @finlaystudent,
Thanks for your feedback, We were able to find a data-race in the code and it should be fixed now. Can you tell us if it works ?
Best,
Michel