Looking for command for synchronization of threads

qznc qznc at go.to
Thu Jan 31 03:35:36 PST 2013


On Wednesday, 30 January 2013 at 22:58:36 UTC, Sparsh Mittal 
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.

You could look at this Rosetta Code snippet, which does something 
similiar for parallelism.

http://rosettacode.org/wiki/Checkpoint_synchronization#D


More information about the Digitalmars-d-learn mailing list