Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!