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 structures for parallel algorithms, To execute any algorithm, selectio...

To execute any algorithm, selection of a proper data structure is very crucial. A particular operation may be executed with a data structure in a smaller time but it may have a ver

What is the disadvantage of a star topology, What is the disadvantage of a ...

What is the disadvantage of a star topology? One major drawbacks of star topology is that once the central hub or switch get damaged, the whole network becomes unusable.

#title.assignment., hii i want to make a assignment from you. please help m...

hii i want to make a assignment from you. please help me.

Recognize the definition of demarcation, Demarcation is the point in which ...

Demarcation is the point in which responsibility changes hands.

Synchronization in factor causing , Synchronization Multiple processors...

Synchronization Multiple processors need synchronization with each other while implementing a parallel algorithm. That is, the task running on processor X might have to wait fo

Transmission robustness and security, Transmission robustness and security ...

Transmission robustness and security Unless properly designed, a wireless LAN might be interference prone and simply eavesdropped. The design of a wireless LAN must allow relia

Root dns servers - application layer , Root DNS Servers A root  server...

Root DNS Servers A root  server is a serve which  consists of the entire  hierarchy  of servers. A root  server  usually  does not  store any  information  about  domains  but

Show coaxial cable connectors, Q. Show Coaxial Cable Connectors? - A mo...

Q. Show Coaxial Cable Connectors? - A most common is barrel connector (BNC) - T-connectors are utilized to branch off to secondary cables - Terminators are necessary for

Packet switching, Suppose there are exactly five packet switches (Figure 4)...

Suppose there are exactly five packet switches (Figure 4) between a sending host and a receiving host connected by a virtual circuit line (shown as dotted line in figure 4). The tr

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