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

What is difference among path and classpath, What is difference among Path ...

What is difference among Path and Classpath? Path and Classpath are operating system level environment variales. Path is used explain where the system can find the executabl

Determine 10base-fl- fiber link ethernet, 10Base-FL: Fiber Link Ethernet ...

10Base-FL: Fiber Link Ethernet Utilizes star topology to connect stations to a hub External transceiver entitle as a fiber-optic MAU connects processing device to fib

What can be done to fix signal attenuation problems, What can be done to fi...

What can be done to fix signal attenuation problems? A common way of dealing with like problem is to use repeaters and hub, because it will help regenerate the signal and thus

Describe the importance of backups, Question: (a) Describe the importa...

Question: (a) Describe the importance of backups and the use of antivirus software. (b) With the help of an example/ illustration, explain the term encryption and explain

Illustrate transport layer responsibilities, Q. Illustrate Transport Layer ...

Q. Illustrate Transport Layer Responsibilities ? - Process-to-process delivery of whole message - Port addressing - Segmentation and reassembly - Connection control co

Describe mail access protocols, Q. Describe Mail Access Protocols? Mai...

Q. Describe Mail Access Protocols? Mail Access Protocols - Used by receiver to retrieve mail when desired - Post Office Protocol, version 3 (POP3) is a simple limited

IP address, what is variable ip address

what is variable ip address

Advantages and disadvantages of client-server method, 1. Write a critical a...

1. Write a critical analysis of the client/server vs. service architecture method for developing service architectures.  You must explain what the client/server method is in terms

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