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

Parallel programming environment characteristics, Parallel Programming Envi...

Parallel Programming Environment Characteristics  The parallel programming environment consists of an debugger, a editor,  performance evaluator and programme visualizer for i

Explain about mesh topology, Q. Explain about Mesh Topology? - Dedicate...

Q. Explain about Mesh Topology? - Dedicated point-to-point links to each other device - n (n-1)/2 links an every device will have n-1 I/O ports - Advantages - Dedic

How does a switch use store and forward, The LAN switch copies the whole fr...

The LAN switch copies the whole frame into its onboard buffers and then looks up the destination address in its forwarding, or switching, table and verifies the outgoing interface

Explain cube interconnection networks, Cube: It's a 3 dimensional intercon...

Cube: It's a 3 dimensional interconnection network.  In Cube PE s   are organised in a cube structure.  Figure 11: Cube interconnection network

Which statement is true regarding half duplex, Half duplex is analogous to ...

Half duplex is analogous to a one a lane bridge, it can handle traffic in both directions but no at the similar time.

Explain multipurpose internet mail extensions, Q. Explain Multipurpose Inte...

Q. Explain Multipurpose Internet Mail Extensions? - The Multipurpose Internet Mail Extensions is an extension of SMTP that allows the transfer of multimedia and other non-ASCII

Hardware difficulty, Hardware difficulty It refers to the price of hard...

Hardware difficulty It refers to the price of hardware logic like connectors, wires, switches, arbiter etc. that are required for execution of interconnection network.

Different type of networking and internetworking device, What is the differ...

What is the different type of networking / internetworking devices? Repeater: Also called a regenerator, it is an electronic device that operates only at physical layer. I

Difference between unicast and anycast, Difference between Unicast and Anyc...

Difference between Unicast and Anycast Unicast: An identifier for a single interface. A packet sent to a unicast address is delivered to the interface identified by that addres

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