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

Explain function of network layer in tcp/ip protocol stack, Explain about t...

Explain about the function of network layer briefly in TCP/IP protocol stack. Internetwork Layer: The best-called TCP/IP protocol at internetwork layer is Internet Protoc

What is rolap, Functioning of ROLAP happens concurrently with relational da...

Functioning of ROLAP happens concurrently with relational databases. Data and tables are stored as relational tables. To hold new information or data new tables are formed. Functio

What is component diagrams in uml, A component diagram is mainly useful wit...

A component diagram is mainly useful with teams of larger size. UML components are great to perform architectural landscape for an exact system. The component diagram permits to mo

Testmanagers wizard, TestManager has a wizard that you can use to copy or i...

TestManager has a wizard that you can use to copy or import test scripts and other test assets (Datapools) from one to another.

Illustrate what is a centrifugal force, Q. Illustrate what is a Centrifugal...

Q. Illustrate what is a Centrifugal Force? Answer:- Centrifugal force is the force that is equivalent in magnitude but opposite in direction to the centripetal force which

Assembler directives, What are assembler directives? Ans: These are th...

What are assembler directives? Ans: These are the instructions that direct the program to be executed. They have no binary corresponding so they are called pseudo-opcodes. The

What is parsing in grammatical structure, What is Parsing? Parsing: ...

What is Parsing? Parsing: It is the process of analyzing a text, made of an order of tokens, to find out its grammatical structure regarding a given formal grammar. Parsing

Future scope of the internet, Q. Future scope of the Internet? The futu...

Q. Future scope of the Internet? The future scope of the Internet, along with the World Wide Web (born in 1990), and the commercialization of the Internet are bound to grow exp

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