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

Determine the relation between storage size and genomes, Genome4U is a scie...

Genome4U is a scientific research project at a large university in the United States. Genome4U has recently started a large-scale project to sequence the genomes of 250,000 volun

What is shielded twisted pair, Q. What is Shielded Twisted Pair? - A me...

Q. What is Shielded Twisted Pair? - A metal foil or braided-mesh covering encases every pair of insulated conductors to prevent electromagnetic noise called crosstalk - Cros

What is a pseudo TTY, What is a pseudo tty? A pseudo tty or false termi...

What is a pseudo tty? A pseudo tty or false terminal enables external machines to connect by Telnet or rlogin. Without a pseudo tty, no connection can take place.

Transport layer , Transport Layer In computer networking it the transp...

Transport Layer In computer networking it the transport  layer is where  sessions are  exchanged between  hosts. This layer resides  between  the application layer and  networ

Describe about the term- network, Describe about the term- network If n...

Describe about the term- network If network tends to lose the packets, it is better to acknowledge each one of them separately, so the lost packets could be retransmitted. On t

What is the network time protocol, What is the Network Time Protocol? ...

What is the Network Time Protocol? A protocol that makes sures accurate local timekeeping with reference to radio and atomic clocks located on the Internet. This protocol is c

Explain session layer in osi model, Q. Explain Session Layer in osi model? ...

Q. Explain Session Layer in osi model? - The session layer defines how to control, start and end conversations (called sessions) between applications. - This includes the c

Linked list for parallel algorithms, Linked List A linked list is a dat...

Linked List A linked list is a data structure composed of zero or extra nodes linked by pointers. Each node consists of two parts, as shown in Figure: info field having specifi

What happens in cdma systems, Question: (a) Suppose that you are a comm...

Question: (a) Suppose that you are a communication engineer and you have to construct a mobile telephone network with bandwidth W = 4.2 MHz in each link. The data rate is

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