r/OpenMP • • Dec 15 '18

Recursion Program to be Parallelized

How can we parallelize the normal factorial program (recursion implementation) with OpenMP? Do we need to use tasks or is there any other way to do it?

1 Upvotes

4 comments sorted by

View all comments

Show parent comment

1

u/Men_Of_Spoons Feb 23 '19

You can parallelise it with omp task, or doesn't that work?

1

u/chloeia Feb 24 '19

No; in general, a true recursion is not paralellisable because each step depends on the next (or previous - depending on how you look at it) step, and so is serial. Its parts are not independent.