Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
Reductions - exercise 1 : The central limit theorem
The central limit theorem is a very famous theorem in statistics and probability. Very roughly, the CLT states that if you add multiple independant random variable together and repeat this process a certain number of times, the ending distribution will be close to a normal distribution (a bell shaped curve). We propose to illustrate this using a parallel program that will generate random numbers and add them !
A normal distribution follows the famous bell-shaped Gaussian curve.
For this, we will consider process that will manage
To improve the quality of the result, the first process is repeated over
Reduction
The reduction is done using the MPI_Reduce
call. The prototype of this function is :
int MPI_Reduce(void* send_data, void* recv_data, int count, MPI_Datatype type, MPI_Op op, int root, MPI_Comm communicator);
Remember that the root is the process on which the reduction result will be stored. The operation is either MPI_PROD
, MPI_SUM
, MPI_MIN
or MPI_MAX
(should be obvious by now).
Your turn to play :