[Omp] repeated encounters of work-sharing constructs
Shah, Sanjiv
sanjiv.shah at intel.com
Sat Mar 26 19:14:02 PST 2005
That's right, you don't have to do the bookkeeping, the implementation
does.
Your intent is perfectly legal.
Sanjiv
--
Sanjiv, 217-403-4244
-----Original Message-----
From: Omp-bounces at openmp.org [mailto:Omp-bounces at openmp.org] On Behalf
Of Richard Henderson
Sent: Saturday, March 26, 2005 3:56 PM
To: omp at openmp.org
Subject: [Omp] repeated encounters of work-sharing constructs
I'm thinking of the following toy,
int main()
{
#pragma omp parallel num_threads(6)
{
int nthr = omp_get_num_threads ();
int iam = omp_get_thread_num ();
for (int i = 0; i < 5; i++)
{
#pragma omp for nowait schedule(dynamic,2)
for (int j = 0; j < nthr * 2; ++j)
sleep (iam + 1);
}
}
}
The idea being that thread 0 will complete the inner loop in 2 seconds,
and the entire parallel in 10 seconds. While thread 5 will take 12
seconds to complete the inner loop and 60 seconds to entire parallel.
So thread 0 will have completed all 5 iterations of the inner loop and
block at the implicit barrier at the end of the parallel before thread 5
has completed its first iteration.
My question is whether or not this is a legal use of the nowait clause.
It doesn't *appear* to violate the execution model in section 1.3, in
that all threads do encounter the 5 iterations of the for work-share
in the same order.
I guess I am merely hoping that the answer is no such that I do not in
fact need to do the bookkeeping required to track N simultaneous
instantiations of the same (i.e. lexically same) work-share construct...
r~
_______________________________________________
Omp mailing list
Omp at openmp.org
http://openmp.org/mailman/listinfo/omp_openmp.org
More information about the Omp
mailing list