I’m currently in the process of trying to convert some scientific code from serial to parallel in openMP. The code is used to calculate infinite sums, and the problem is the number of loops that need to be done before the sum is accurate to the proper number of significant figures is variable. So the loop could do 60 or 60,000 iterations.
Now in serial this is trivial with an if check and exit statement. However in openMP I’m having some trouble.
It appears I can’t make the end bound in the do loop shared and set it equal to the starting bound when the condition is met so that all the threads will kick out after they finish their current loop. And the EXIT statement, as well as DO WHILE don’t seem to be supported in openMP either.
Is there a way to do this? Because looking at the openMP guide I’m not seeing any nice workarounds or features which support this offhand.