[SOLVED] HPC- Parallel Processing Assignment 1-Counting Primes

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 A1-poap04.zip (423.8 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
đź”’ Securely Powered by:
Secure Checkout
5/5 - (1 vote)

Counting Primes

Problem Statement:

Students should write a parallel c program for “Counting Primes” using the following two methods: MPI_Send and MPI_Receive ONLY

Given

  • –  Lower bound number x
  • –  Upper bound number yOutput
  • –  Count of prime numbers occurring between x and y
  • –  Count of prime numbers occurring in each process.Example:

    “Total number of prime numbers is: 20” “Total number of prime numbers in P1 is: 10” “Total number of prime numbers in P2 is: 6” “Total number of prime numbers in P3 is: 4”

1

Faculty of Computers and Information Cairo University
Spring-2021

Parallelization Scenario Master Process:

  • –  Calculate the sub range size r=(y-x)/p
  • –  Note that p is the number of processes.
  • –  Broadcast x and r to each slave process using MPI_Send.
  • –  Receive sub count from each slave process using MPI_Receive.
  • –  Print total count of primes between x and y.Slave Process:
  • –  Receive x and r through the MPI_Receive.
  • –  Calculate the lower bound a and upper bound b according to its rank.
  • –  Count primes in its sub range (between a and b).
  • –  Print the partial count
  • –  Send this partial count to the master process using the MPI_Send.
  • A1-poap04.zip