There are two things to parallelize here-

the **mergesort()**,which i did and

the **divide()** where I am stuck.

I have tried all possible approaches but in vain.

The approach followed(divide n conquer) in divide() is same as that of mergesort(),but applying the same parallelization technique(omp sections) works only for mergesort.

I tried the parallelization technique shown here:-http://code.google.com/p/dewall-omp/,but even that doesn't work.

I read about nested parallelism somewhere but i am not sure how to implement it.

Can anybody explain how to parallelize this divide and conquer algorithm?

**CODE:Called mergesort twice(dual core machine) in main function and applied sections construct.Doing same for divide function doesn't work**

- Code: Select all
`#pragma omp parallel`

{

#pragma omp sections nowait

{

#pragma omp section

{

merge_sort(p_sorted, p_temp, 0, n/2);

}

#pragma omp section

{

merge_sort(p_sorted, p_temp, (n/2)+1, n-1);

}

}

}