Need Help with this Question or something similar to this? We got you! Just fill out the order form (follow the link below), and your paper will be assigned to an expert to help you ASAP.
1
Question 2 (Lecture 2): The purpose of this question is to practice MPI_Bcast. write a program
using MPI to accomplish the following:
1. Process0 generate a random number for variable n in the range 10 to 99 inclusive and
broadcast to all other processes.
Note that, since process0 is broadcasting, we should not include: MPI_Bcast in a conditional
statement such as ” if (my_rank == 0){…}”.
2. All the processes use the built-in function: malloc to allocate n consecutive locations for the
array variable: receive_vector.
3. Process0 generates n random integers in the range 0 to 99 inclusive and stores them into its
own array: receive_vector.
4. Process0 broadcast the content of its array: receive_vector to the receive_vector of all other
processes.
5. All the processes obtain and display the sum of the numbers of their own array:
receive_vector.
The following is a sample dialog of my program:
mehdi@ubuntu:~/cs610$ mpicc -g -Wall a.c
mehdi@ubuntu:~/cs610$ mpiexec -n 10 ./a.out
In process 0 the sum is: 4593
In process 4 the sum is: 4593
In process 5 the sum is: 4593
In process 8 the sum is: 4593
In process 9 the sum is: 4593
In process 2 the sum is: 4593
In process 1 the sum is: 4593
In process 3 the sum is: 4593
In process 6 the sum is: 4593
In process 7 the sum is: 4593
Answer:
Question 3 (Lecture 3): Complete the following parallel program using the sequent simulator
(sequent.h) to display the approximate area under a curve. Each process (including process0)
calculates the area of one trapezoid.
Note: The variable: n gets the number of processes from the keyboard.
Note: The number of processes cannot go beyond 9. I made this restriction in my software.
Note: A version of this question is in lecture 2.
Note: The area of each trapezoid is added to a shared memory location.
2
Note: You must only guard the smallest section of the code with m_lock() and m_unlock(),
where processes try to changed the content of a shared memory location.
Note: You must not use MPI.
Note: If you get error with respect to shared memory enter the following on the prompt:
ipcrm -a
For more information on this command enter: man ipcrm.
//File name: a.c
#include “sequent.h”
#include
float *approx;
float a = 3, b = 6;
int n;
float f(float x);
void eachArea();
//To add each area to.
//Area under the curve from: x = a to: x = b.
//For the function x2.
//Each process calls this function to obtain the area of one trapezoid.
int main()
{ //Complete this function
initialize();
approx = //Complete this line
printf(“Enter the number of processes: “);
//Write instruction for this line
m_set_procs(n);
m_fork(eachArea);
m_kill_procs();
printf(“The precise area: %.2fn”,b*b*b/3 – a*a*a/3);
printf(“The area is: %.2fn”, approx[0]);
clean();
return 0;
}
float f(float x)
{//This function is complete. Do not change it.
return x * x;
}
void eachArea()
{//Complete this function
}
Answer:
Purchase answer to see full
attachment
How to create Testimonial Carousel using Bootstrap5
Clients' Reviews about Our Services
Client ID 45637
U.S.A
Brilliant services. I ordered a 4 page essay and it was delivered in less than 24hours with every detail intact!
Client ID 45783
U.K
Aceassignment is the way to go. The writers are humble and patient with clients. I know this after using the website for about an year
Client ID 45214
U.K
My writer did a brilliant job. Not only did she delivered the paper on time and it was superb as my professor granted me an A without any criticism
Client ID 45009
CAD
I was running late with my assignment. I run into aceassignment on google, placed my order and within less than 18 hours my page essay was delivered. Thank you Aceassignment.
Client ID 45870
U.S.A
I've been using Aceassignment for about 2 years. My writer always delivers quality work. Mind you whenever I request for a revision it's always done ASAP and free of charge
Client ID 44218
U.S.A
At first, I was scared and hesitant about using this website. Didn't know if they would deliver, but they assured me they will. And for sure they did. I will definitely continue to use their service!
Client ID 45622
U.S.A
Easy to use website. You simply give your essay's instructions, make payment and before you known it the paper is delivered to you.
Client ID 43964
U.S.A
Unlike other platforms, this website is quite cheap and the quality is high. I have them manage my whole class and everything has been smooth this far.
Client ID 41996
U.K
Thanks for the excellent job. Swift and on the subject, just the way I like it. The Support team was quite nice to me, helped me with the order placing process.
Client ID 47654
AU
They are a marvel. I love their support team, they are so polite, it’s like speaking to a butler or something. Very pleasant people and good service of course.
Client ID 45670
FRA
Thank you for the help, I took my time and ordered a 14 days long essay. It came much earlier, around 7 days after I ordered it. Oh, and it was good, of course. I like the writer who did that, will definitely use again.
Client ID 22368
US
What I received was great. I forgot to mention in the instructions field that I needed reference page and by default, there was 0 in the number of references. I was surprised to see a full-fledged reference page in my paper with relevant citations. Bravo!
Client ID 46325
U.S.A
I was bombarding him with fine tuning and he handled it professionally. Thank you I will hire again the writer
Client ID 456820
U.S.A
Provided exceptional essay writing help in a short period of time. I plan to work with writer on many more projects!
Client ID 36890
UAE
Awesome paper in such a short amount of time. Was in a jam with another service who didn't deliver, but my writer did the job correctly. I will use her again to do my essays for sure!
Client ID 41427
U.K
Pretty good essay writer. I only made a couple of adjustments. She caught some instructions for the essay writing assignment that I didn't even notice, including them which was a pleasant surprise. Definitely recommend.
Client ID 45009
CAD
It was a very long paper, but the writer followed all the instructions, and she even finished the paper 5 days before the due date. Will write an essay with her again, thanks!
Client ID 36984
U.S.A
Writer was timely and proficient. I had to ask for a revision, but I got it back quickly with no other issues. Would use this essay writing service again.
Client ID 42960
CAD
Paper writing was prepared and submitted prior to the completed request date, and there were changes made quickly after I requested. This paper writer was accurate with numbers.
Client ID 31638
U.K
The first time I ordered here and it was a success. I received my order on time and according to my instructions. Thank you!
Client ID 46041
CAD
When I first discovered this website I was hesitant on whether they will deliver a plag free paper. The support team reassured me of their plagiarism policy. In deed they kept their word as the paper I got was authentic and plagiarism free.