Do you really know the importance of parallelization? Does a parallelized code imply a reduction in your execution time? Are all parallelizations equally good? This article talks about these questions and using the calculation of the number pi tries to answer these questions.
Calculation of PI
The code shown below is the calculation of pi by the method of numeric integration. The algorithm has a loop (lines 4-7) which executes a predetermined number of iterations (num_steps) where a reduction over the variable ‘sum’ is done. The variable ‘x’ works like a partial result which has an independent value between iterations. At the end of the loop, the operation between ‘step’ and ‘sum’ produces ‘pi’. The number pi will be more precise if the number of iterations is greater.
Read full article from Parallel computation of PI. Using OpenMP standard.
No comments:
Post a Comment