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

What is indexing, What is indexing? Specific fields shown on each scann...

What is indexing? Specific fields shown on each scanned document are provided to our organization to make the systematic arrangement of your records. This process is designed t

Why sram are said to be volatile, Why SRAM are said to be volatile? Bec...

Why SRAM are said to be volatile? Because their contents are lost when power is interrupted. So SRAM are said to be volatile.

Memory, #all type of memory

#all type of memory

Multi tasking environment, Q. Explain about Multi tasking environment? ...

Q. Explain about Multi tasking environment? Multi tasking uses parallelism by: 1) Pipelining functional units are pipe line mutually 2) Simultaneously employing multiple

How many precision resistors requires a weighted resistor, A weighted resis...

A weighted resistor digital to analog converter using N bits requires a total of ? Ans. Digital to analog converter, a weighted resistor using N bits needs a total of N precisi

DBMS SQL Queries, How to fetch random ID from table by SQL query Select ...

How to fetch random ID from table by SQL query Select * from Table_Name order by NewID()

Disadvantages of address translation, Disadvantages of Address translation:...

Disadvantages of Address translation: Disadvantages are following: A program that is too large to be held in a part needs some special design, that called overlay

What is central processing unit, What is Central Processing Unit Centra...

What is Central Processing Unit Central Processing Unit (CPU) performs all the arithmetic and logical calculations in a computer. The CPU is said to be the brain of the compute

Determine the address when network address prefixed by 1000, A network addr...

A network address prefixed by 1000 is? A network address prefixed through 1000 is Class B address.

How much duration is required for an off-hook signal, An off-hook signal wi...

An off-hook signal will repeat for a/an                   duration. For a/an finite duration, an off-hook signal will repeat.

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