This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC 4.9.1 OpenMP 4.0 task nesting


I forgot to add a barrier inside task1, as it as to wait for all its
siblings to finish.

> #pragma omp parallel
> {
> #pragma omp single
> {
>
>      for (i = 0; i < 10000; i++)
>      {
>               int x = 0;
>               #pragma omp task depend(in:x) //task1
>               {
>                     for (int i = 0; i<4; i++){
>                             #pragma omp task shared(x)
>                             {
>                                   dosomething(x); //tasknested
>                             }
>                     }
                   #pragma omp taskwait
>               }
>               #pragma omp task depend(inout:x) //task2
>               {
>                        dosomething(x);
>               }
>              #pragma omp taskwait
>       }
> }
> }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]