Problem 1 (40p)
In this problem the goal is to calculate the mean and standard deviation of a large list of numbers by using Reduction as one of Collective Operations, see Lecture 11.
Consider random variables uniform on , call these .
Write an MPI program with processes that outputs the average and standard deviation of .
Copyright By PowCoder代写 加微信 powcoder
To simplify the problem, let one process, say Process 0 , independently draws samples uniformly on .
How do you explain the results?
Instructions: Your program should use MPI4PY and collective operations. Save your program as 2020_spring_sol09_pr01.py and run it from the terminal as:
Problem 2 (60p)
In this problem the goal is to demonstrate how one can use a Domain Decomposition and Collective Operations.
Consider the exponential distribution with the unit mean. Find numerical approximations of moments of the exponential random variable.
That is, for a random variable with the distribution for , compute the rst moments, where the -th moment is de ned as:
Your program should use MPI parallel collective instructions, where the integration is performed in parallel over processes, over a nite range , where , with partitions and increments per partition, see Lecture 10 and 11.
Provide evaluations of , where
Instructions:
Save your program as 2022_sol09_pr02.py; and run it from the terminal as:
mpirun -n 16 python 2020_spring_sol09_pr01.py
mpirun -n 16 python 2022_spring_sol09_pr02.py
0001 = 𝑀 .𝑥𝑑)𝑥(𝑓𝑘𝑥
]1 ,0[ 1−𝑁𝑥,…,1𝑥,0𝑥
1−𝑁𝑥,…,1𝑥,0𝑥
000652 = 𝑁
∞ 𝑥−𝑒 = )𝑥(𝑓
51𝐽,…,2𝐽,1𝐽
)1(pxE ∼ 𝑋
Bonus Question (10 points):
What is the value of , as a function of ? How can it be derived?
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com