Timing in mpi program, Computer Networking

Assignment Help:

MPI_Wtime ( ) returns elapsed wall-clock time in seconds as some arbitrary point in past. Elapsed time for program segment is specified by the difference between MPI_Wtime values at starting and end of process. Process clocks are not essentially synchronised, so clock values are not essentially comparable across the processes, and care must be taken in determining overall running time for parallel program. Even if clocks are explicitly synchronised, variation across clocks still can't be predictable to be significantly less than round-trip time for zero-length message among the processes.

Now, we shall explain use of these functions with an example.

Example 1:

#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

{

PRAM Algorithms

 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:- Timing in mpi program

Data types in distributed enrollment protocol, Data Types Each data typ...

Data Types Each data type of Table 1 must be sent according to the specifications below. [INT] Each value of this type is sent as the string representation of the corre

Difference between routable and non- routable protocols, What is the differ...

What is the difference between routable and non- routable protocols? Ans) Routable protocols can work with a router and can be used to build huge networks. Non-Routable protocol

Tp-lite and tp-heavy monitors, What are TP-Lite and TP-Heavy Monitors? A...

What are TP-Lite and TP-Heavy Monitors? Ans) TP-Lite is simply the integration of TP Monitor functions in the database engines.TP-Heavy are TP Monitors which handles the Client/

Name the connecting devices of bridges, Connecting Devices of bridges -...

Connecting Devices of bridges - Five kinds: - Repeaters - Hubs - Bridges - Two- and three-layer switches - Repeaters and hubs - layer one of Internet model -

Programming with pvm, The Common method for writing a program with PVM is a...

The Common method for writing a program with PVM is as follows: A user writes one or more sequential programs in C, C++, or Fortran 77 having embedded PVM function (or subroutin

Describe encapsulating, Can you describe encapsulating, carrier and passeng...

Can you describe encapsulating, carrier and passenger protocol?

Which layer is responsible for coordinating communication , Which layer is ...

Which layer is responsible for coordinating communication between systems Ans) The Session layer performs the following: Responsible for establishing and maintaining connections

What are the advantages of star topology, What are the advantages of Star T...

What are the advantages of Star Topology? The advantages of star topology are: a. Relatively easy to configure. b. Simple to troubleshoot c. Media faults are automatic

Explain how reducing ineffective taxation, Question: (a) With mobile t...

Question: (a) With mobile telecommunications providing an important engine for growth, continuing to stimulate growth and to ensure mobiles remain affordable for all, will re

Explain about multiplicative decrease, Q. Explain about Multiplicative Decr...

Q. Explain about Multiplicative Decrease ? Multiplicative Decrease (MD) if a time-out take places the threshold is set to one maximum segment size (TCP Tahoe, TCP Reno).

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