Closed computablee closed 1 year ago
With the Critical
issue resolved, I think there's a framework in place for Single
. Anyone who would like to be assigned, let me know.
Assigning myself to this.
Ah, not bad. All unit tests pass, closing this. Pushed to features
branch.
Now that
Parallel.For
has been separated intoParallel.ParallelRegion
andParallel.For
(with the functionality of the originalParallel.For
being renamed toParallel.ParallelFor
), I'd like to start implementing more structures. I went ahead and implemented a barrier (underParallel.Barrier
) because it simplified the blocking behavior of#pragma omp for
. However, we should have an equivalent of#pragma omp single
and#pragma omp master
.Parallel.Master(Action<>)
should have the behavior where it is only ever run by the master thread (i.e., thread 0) in a parallel region, and all other threads should "ignore" it.Parallel.Single(Action<>)
should have the behavior where it is only run by one thread. The behavior forSingle
is a little more nuanced. Only one thread should ever execute aSingle
region, and it should be the first thread that encounters it (so on subsequent runs, the same thread will be "assigned" to the region). All other threads should ignore it.I suspect that we won't be able to implement
Single
as a static method (as I'm suspecting withCritical
). If we can think of a way to do this, that would be excellent, but if not, I'm open to suggestions for an easy, user-friendly alternative.