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 are the advantages of bus topology, What are the advantages of bus top...

What are the advantages of bus topology? The benefit of physical bus topology is: a. It uses established standards and it is relatively simple to install. b. It needs les

Connection establishment - tcp connection management, Connection Establishm...

Connection Establishment TCP transmits  data in full duplex mode. When two TCP is two machines are  connected they are able  to send segments to each other simultaneously. This

What is a tag, In HTML, a tag shows the browser what to do. When you write ...

In HTML, a tag shows the browser what to do. When you write an HTML page, you enter tags for lot of  reasons -- to change the appearance of text, to show a graphic, or to make a co

Explain mesh interconnection networks, Mesh : This is two dimensional netwo...

Mesh : This is two dimensional networks.  In this all processing elements are organised in a two dimensional grid. The processor in the row i and column j are indicated by PE i .

What do you mean by flow control, Q. What do you mean by Flow Control? ...

Q. What do you mean by Flow Control? - How much data sender is capable to transmit before receiving the ACK - Why flow control? - Limitation with receiver 1. Processin

Advantages of vpns - point to point , Advantages of VPNs Advantages di...

Advantages of VPNs Advantages discussed in the following  section include those related to security. Consolidation transparency cost. And administration. a. Improved secur

Use of a distance vector routing algorithm, Question: (a) The diagram ...

Question: (a) The diagram below shows a configuration of Internet routers (A-F) which achieve dynamic routing through the use of a Distance Vector routing algorithm. The metr

Explain the anonymous ftp, What is anonymous FTP? Anonymous FTP is a wa...

What is anonymous FTP? Anonymous FTP is a way of granting user access to files in public servers. Users that are permitted access to data in these servers do not require identi

Physical addressing in a wan, PHYSICAL ADDRESSING IN A WAN:  The physi...

PHYSICAL ADDRESSING IN A WAN:  The physical addressing in a WAN is same as in LAN in the following way: The data is send in packets equivalent to frames. Every pack

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