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

E brokerage facilitates search & retrieval of information, E Brokerage faci...

E Brokerage facilitates search & retrieval of Information The success factor of a brokerage is its ability to retain existing clients and to enhance their satisfaction by effec

Determine the begin - end keywords, Determine the begin - end keywords ...

Determine the begin - end keywords Group several statements together. Cause the statements to be evaluated sequentially (one at a time) -> Any timing within sequential group

Explain bit slice ALUs, Bit Slice ALUs It was possible to manufacture ...

Bit Slice ALUs It was possible to manufacture smaller like 4 or 8 bits fixed point ALUs on a single IC chip. If these chips are constructed as expendable types then employing

Describe generic framework for electronic commerce, Describe generic framew...

Describe generic framework for electronic commerce Generic Framework for electronic commerce contains the Applications of EC   (like as banking, shopping in online stores and m

Concurrently read concurrently write, Q. Concurrently read concurrently wri...

Q. Concurrently read concurrently write? It is one of the models derived from PRAM. In this model the processors access the memory locations simultaneously for reading and writ

Explain open source software, Explain Open source software? Open Source...

Explain Open source software? Open Source Software is software for which the underlying programming code is available to the users so that they might be read it, make changes t

Architecture of world wide web with the basic entities, Explain architectur...

Explain architecture of World Wide Web with the basic entities. The architecture of the World Wide Web, demonstrated below, is the one of clients, as like Netscape, Lynx or Int

What is relational database, What is relational database? Relational da...

What is relational database? Relational database has data that is perceived as tables. A relational DBMS manages tables of data and associated structures that enhances the func

Create a factory function and constructor, 1) This project will use an acco...

1) This project will use an account class that has the members: string account_code; string first_name; string last_name; double balance; Provide a constructor that

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