Question: Problem 2 ( 1 5 pts ) ` ` ` int main ( void ) { int my _ rank, comm _ sz , n
Problem pts
int mainvoid
int myrank, commsz n localn;
double a b h locala localb;
double localint, totalint;
int source;
MPIInitNULL NULL;
MPICommrankMPICOMMWORLD, &myrank;
MPICommsizeMPICOMMWORLD, &commsz;
h ban; h is the same for all processes
localn ncommsz; So is the number of trapezoids
locala a myranklocalnh;
localb locala localnh;
localint Traplocala localb localn h;
if myrank
MPISend&localint, MPIDOUBLE,
MPICOMMWORLD;
In parallel programs, we need to use both global variables and local variables. Given the above trapezoidal rule program in MPI. For all variables from line to determine which are local and which are global.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
