[SOLVED] HPC- Parallel Processing Assignment 2-Calculating Standard Deviation

30.00 $

Category: Tags: , , , , , ,
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon A2-psdlt2.zip (102.1 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
Rate this product

 

Calculating Standard Deviation

Write a parallel c program to calculate standard deviation using MPI_Bcast, MPI_Reduce & MPI_Allreduce ONLY. Don’t use MPI_Send and MPI_Receive

Given:
An integer n (number of elements per each process).
Output:
Standard deviation of randomly generated (n * numberOfProcesses) elements.

How to Calculate Standard Deviation:

1. Calculate the Mean.
2. For each number, subtract the mean and square the result. 3. Calculate the mean of the squared differences.
4. Take the square root of step three results.

1

Faculty of Computers and Information Cairo University
Spring-2021

Parallelization Scenario: Master Process:

✔ Read n from the user.

✔ Broadcast n to each slave process using MPI_Bcast.

✔ Calculate the square root of the mean of squared differences. Slave Process:

  • ✔  Get n through the MPI_Bcast call.
  • ✔  Generate n random elements. So each process will generate n numbers.
  • ✔  Calculate local sum of the generated n elements.
  • ✔  Share this local sum with the rest of the processes using MPI_Allreduce.
  • ✔  Calculate the global mean. (Total sum of elements / n * numOfProcesses).
  • ✔  Calculate local sum of squared differences from the mean. Sum (n – mean)2
  • ✔  Share this local sum of squared differences with the master process using MPI_Reduce call.

1 file · 102.1 KB

  • A2-psdlt2.zip 102.1 KB