正在加载图片...
Finding Pl using MPl collective operations The method evaluates PI using the integral of 4/(1+X*x) between 0 and 1. The integral is approximated by a sum of n intervals The approximation to the integral in each interval is (1/h)*4(1×xx) The master process asks the user for the number of intervals The master then broadcast this number to all of the other processes Each process then adds up every n'th interval (x 0+rank/n, 0+rank/n+size/n,.) Finally, the sums computed by each process are added together using a reductionFinding PI using MPI collective operations • The method evaluates PI using the integral of 4/(1+x*x) between 0 and 1. The integral is approximated by a sum of n intervals • The approximation to the integral in each interval is (1/n)*4/(1+x*x). • The master process asks the user for the number of intervals • The master then broadcast this number to all of the other processes. • Each process then adds up every n'th interval (x = 0+rank/n, 0+rank/n+size/n,...). • Finally, the sums computed by each process are added together using a reduction
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有