OpenMP: omp parallel vs. omp parallel for?

I don't think there is any difference, one is a shortcut for the other. Although your exact implementation might deal with them differently.

Up vote 5 down vote favorite 1 share g+ share fb share tw.

A #pragma omp parallel { #pragma omp for for(1...100) { } } B #pragma omp parallel for for(1..100) { } Thanks in advance! C openmp link|improve this question edited 2 days agoMysticial41.9k116899 asked Sep 19 '09 at 10:52imays897 50% accept rate.

I don't think there is any difference, one is a shortcut for the other. Although your exact implementation might deal with them differently. "The combined parallel worksharing constructs are a shortcut for specifying a parallel construct containing one worksharing construct and no other statements.

Permitted clauses are the union of the clauses allowed for the parallel and worksharing contructs. " Taken from openmp.org/mp-documents/OpenMP3.0-Summar... The specs for OpenMP are here: openmp.org/wp/openmp-specifications.

These are equivalent. #pragma omp parallel spawns a group of threads, while #pragma omp for divides loop iterations between the spawned threads. You can do both things at once with the fused #pragma omp parallel for directive.

In my code I am using this very structure. However when I use schedule(static, chunk) clause in for directive, I get a problem. The code runs fine but when I am invoking this code from an MPI program then it runs into an infinite loop.

The loop counter is zero in all iterations of this loop. I have the loop counter defined as private in the #pragma omp parallel directive. No idea why it only fails when MPI is invoking the code.

I am somewhat sure that each MPI process is running on a different processor of the cluster if that matters. No idea if schedule is causing the problem. – iamrohitbanga Oct 3 '11 at 2:29 The same thing works fine when I use the #pragma omp parallel for directive.

There ought to be some difference. – iamrohitbanga Oct 3 '11 at 2:30 Update: As it turns out, I am observing this problem only when I use the schedule clause so I guess it is not depending on whether I use the combined parallel for or two different directives. – iamrohitbanga Oct 3 '11 at 19:52.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions