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

Processor, what is the difference between i5 and i7 processor?

what is the difference between i5 and i7 processor?

Define wide area network, Q. Define Wide Area Network? Wide Area Networ...

Q. Define Wide Area Network? Wide Area Network (WAN): It takes a large geographical area and frequently owned by a state. Data transfer rate is low (few KBPS to 10 MBPS) and er

Add a byte number from one memory location, Add a byte number from one memo...

Add a byte number from one memory location to a byte from subsequent memory location and put sum in the third memory location. Also save carry flag in the least significant bit of

Program for interchanging the values of two memory locations, Q. Program fo...

Q. Program for interchanging the values of two Memory locations? Program for interchanging the values of two Memory locations  ; input: Two memory variables of same size:

Hardware design of a typical system, Motorola 68HC11 series is a family of ...

Motorola 68HC11 series is a family of micro controllers , each device contains slightly different  functional blocks , however they are all based around the same microprocessor nam

Explain segment registers in bus interface unit, Q. Explain Segment Registe...

Q. Explain Segment Registers in bus interface unit? These are very significant registers of CPU. Why? We will answer this later. In 8086 microprocessor memory is a byte organiz

Explain anonymous FTP, Explain Anonymous FTP. Use of a login password...

Explain Anonymous FTP. Use of a login password and name helps maintain file secure from unauthorized access. Though, sometimes these authorizations can also be inconvenient.

Jsbjj, what are the output deice

what are the output deice

Explain the significance of encryption, Problem: (i) What are the main...

Problem: (i) What are the main threats that an organisation holding sensitive data, such as Public Data, on computer storage must guard against? (ii) To protect such data,

Explain about quine mckluskey method, Q. Explain about Quine McKluskey Meth...

Q. Explain about Quine McKluskey Method? A tabular method was proposed to deal with increasing number of variables called Quine McKluskey Method. This method is appropriate for

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