Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, I really need help in this problem. I should use C to do it. Write a parallel program that takes, as command line arguments,

Hello, I really need help in this problem. I should use C to do it.

Write a parallel program that takes, as command line arguments, 3 integers A, B and C. Your program will search integers between A and B for a value J such that F(J) = C, where F(x) is any predefined function. Note: do not forget to handle the case when no preimage is found Assume in this case F(x) = 3x 3+5x+20. The range should be divided among the available processes. Each process searches for a preimage within its range and sends its results back to the master. The master prints the results into an output text file output.txt.

Sample input:

A=0, B=1000, C=3070.

Sample output:

Process i found J = 10 verifying F(J) = 3070

Compile and run this MPI program and verify its output by following these steps:

- Use an IDE of your choice to create and save your program with YourName_Prob1.c.

- Compile your program within the IDE or from terminal window by using the command: mpicc o Problem1 YourName_Prob1.c

- Then, run your MPI program by typing the command in a terminal widow: mpirun -n

- Verify that your program gives the correct output for 1, 2, and 4 cores Measure the execution time in your program using the function MPI_W time(). This can be done as follows:

Double start_time = MPI_Wtime();

//Insert your parallel code here

if(rank==0) {

double end_time=MPI_Wtime();

printf("Wallclock time elapsed: %.8lf seconds ",end_timestart_time);

}

Report in a tabular form the execution time of your program when using 1, 2, and 4 processors.

Draw your conclusions on the speedups obtained

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago