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

Classes and dotted decimal notation, The relationship between dotted decima...

The relationship between dotted decimal notation and classes is shown as follows. In class A the three octets managed to a host suffix. In class B the last most two octets ar

Hierarchical routing strategy, i want a program of hierarchical programming...

i want a program of hierarchical programming in c language with its output. please help me .

What is usage of sequence number in reliable transmission, What is usage of...

What is usage of Sequence Number in Reliable Transmission? The protocol specifies that frames need to be numbered. This is done by using sequence numbers. A field is added to t

Cdma gsm back haul network, S t d "B" 6.4 m Ku-BAND EARTH STATION (2004) ...

S t d "B" 6.4 m Ku-BAND EARTH STATION (2004)   D-Sat (District Satellite Project) circuits for rural connectivity via satellite are in operation. Purpose of this project i

Illustrate network layer in osi layers model, Q. Illustrate Network Layer i...

Q. Illustrate Network Layer in osi layers model? Network Layer :  This is responsible for addressing messages and data so they are sent to the required destination, and for tr

Briefly describe the purpose of windows powershell, Question: a) Brief...

Question: a) Briefly describe the purpose of Windows Powershell? b) Name ways software can be installed on Linux? c) What is an interrupt request? d) As the Networ

Explain multipoint connection, Explain multipoint connection. A multipo...

Explain multipoint connection. A multipoint connection is a link among three or more devices. Historically, multipoint connections were used to attach central CPs to distribute

Protocol software and ethernet wiring, PROTOCOL SOFTWARE AND ETHERNET WIRIN...

PROTOCOL SOFTWARE AND ETHERNET WIRING:  All wiring methods use identical Ethernet specifications. e.g. they need same message format. They need same CSMA/CD algorithems. They m

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