Explain use of mpi functions with an example, Computer Engineering

Assignment Help:

Q. Explain use of MPI functions with an example?

include

int main(int argc, char **argv) {

int i, tmp, sum, s, r, N, x[100];

MPI_Init(&argc, &argv);

MPI_Comm_size(MPI_COMM_WORLD, &s);

MPI_Comm_rank(MPI_COMM_WORLD, &r);

If(r==0)

 {

  printf( "Enter N:");

  scanf ("%d", &N);

  for (i=1; i

     MPI_Send(&N, 1, MPI_INT,i, i, MPI_COMM_WORLD);

  for (i=r, i

     sum+= x[i];  

 for (i=r, i

 {

   MPI_Recv(&tmp, 1, MPI_INT,i, i,  MPI_COMM_WORLD, &status);

   Sum+=tmp;

}

printf( "%d", sum);

}

else {

          MPI_Recv(&N, 1, MPI_INT,0, i, MPI_COMM_WORLD, &status);

          for (i=r, i

                sum+= x[i];  

          MPI_Send(&sum, 1, MPI_INT, 0, i, MPI_COMM_WORLD);

}

MPI_Finalize( );

}

 


Related Discussions:- Explain use of mpi functions with an example

Overfitted the data, Overfitted the data: Moreover notice that as time...

Overfitted the data: Moreover notice that as time permitting it is worth giving the training algorithm the benefit of the doubt as more as possible. However that is, the error

Mobile computing, Explain the key characteristics of mobile computing appli...

Explain the key characteristics of mobile computing applications

Code density and smaller faster programs, Q. Code Density and Smaller Faste...

Q. Code Density and Smaller Faster Programs? Memory was very expensive in older computer. So there was a need of less memory utilization, which is it was cost effective to have

What are the aspects of CAD, What are the aspects of CAD Increased use ...

What are the aspects of CAD Increased use of computers has led to many of the above affects. Other aspects to consider include: -  deskilling of the work force (for illustra

Drag and drop state numbers and functions in vb, State 0 Source control is ...

State 0 Source control is being dragged with the variety of a target. 1 Out of the variety of a target. 2 One position in the target to one another.

The six various application of stack, The six several application of stack ...

The six several application of stack in computer application is: 1.  Conversion of infix to postfix notation and vice versa. 2.  Evaluation of arithmetic expression. 3.

What is assembler, What is Assembler A macro-assembler or assembler nor...

What is Assembler A macro-assembler or assembler normally forms a part of operating system. That translates an assembly language program into machine language program.

Write short note on associated vs. common channel signaling, Write short no...

Write short note on Associated vs. Common channel signaling. Associated vs Common channel signalling: The out band signalling suffers from the very restricted bandwidth.

Why schottky transistors preferred over other transistors , In digital ICs,...

In digital ICs, Schottky transistors are preferred over normal transistors because of their ? Ans. Lower  propagation  delay  in digital ICs, as  shottky  transistors  reduce

Prove, state and prove distributive law?

state and prove distributive law?

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd