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 > } > } > }