concurrent write access in OpenCL kernel

guernika
Posts: 18
Joined: Fri May 07, 2010 2:20 pm

concurrent write access in OpenCL kernel

Post by guernika »

hello to all,

I was giving a look at the OpenCL soft-body solver SolvePositions.cl,
and I noticed the last two lines:

g_vertexPositions[node0] = (float4)(position0, 0.f);
g_vertexPositions[node1] = (float4)(position1, 0.f);

Am I wrong or they could give a concurrent write access?
Or is OpenCL preventing this?

Best regards

Francesco
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: concurrent write access in OpenCL kernel

Post by Erwin Coumans »

The kernel will be processed over many work items in parallel, writing to different g_vertexPositions.

The batching makes sure that there are no work items that share the same node.
Thanks,
Erwin
guernika
Posts: 18
Joined: Fri May 07, 2010 2:20 pm

Re: concurrent write access in OpenCL kernel

Post by guernika »

Hello and thanks for your reply,

you're right...I didn't notice the generateBatches method

Regards

Francesco