Looking for command for synchronization of threads

Sean Kelly sean at invisibleduck.org
Wed Jan 30 16:20:28 PST 2013


On Jan 30, 2013, at 2:58 PM, Sparsh Mittal <sparsh0mittal at gmail.com> wrote:

> Background:
> I am implementing an iterative algorithm in parallel manner. The algorithm iteratively updates a matrix (2D grid) of data. So, I will "divide" the grid to different threads, which will work on it for single iteration. After each iteration, all threads should wait since next iteration depends on previous iteration.
> 
> My issue:
> To achieve synchronization,  I am looking for an equivalent of sync in Cilk or cudaEventSynchronize in CUDA. I saw "synchronized", but was not sure, if that is the answer. Please help me. I will put that command at end of "for" loop and it will be executed once per iteration.

I suggest looking at std.parallelism since it's designed for this kind of thing.  That aside, all traditional synchronization methods are in core.sync.  The equivalent of "sync" in Cylk would be core.sync.barrier.


More information about the Digitalmars-d-learn mailing list