Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revisionLast revisionBoth sides next revision | ||
doku:time [2015/03/26 16:11] – ir | doku:time [2015/04/17 11:45] – [Hybrid OMP and MPI] ir | ||
---|---|---|---|
Line 4: | Line 4: | ||
or do not provide adequate access to high resolution timers (See also Section 8.6 Timers and Synchronization in | or do not provide adequate access to high resolution timers (See also Section 8.6 Timers and Synchronization in | ||
[[http:// | [[http:// | ||
+ | |||
+ | ==== MPI internal functions ==== | ||
=== MPI_WTIME() === | === MPI_WTIME() === | ||
Line 13: | Line 15: | ||
MPI_WTIME returns a floating-point number of seconds, representing elapsed wallclock | MPI_WTIME returns a floating-point number of seconds, representing elapsed wallclock | ||
- | time since some time in the past and may be used as follows: | + | time since some time in the past. |
- | < | + | Generally, **times can ONLY be compared within the same MPI-process.** The times returned are **local to the node that called them**. Different nodes need not to be synchronized. |
- | double starttime, endtime; | + | (MPI_WTIME_IS_GLOBAL is a Boolean variable that is 1 if synchronized |
- | starttime = MPI_Wtime(); | + | MPI_WTIME_IS_GLOBAL does not have a valid value since the clocks are not guaranteed to be synchronized.) |
- | .... stuff to be timed ... | + | |
- | endtime = MPI_Wtime(); | + | MPI_WTIME has to be called inside the MPI region |
- | printf(" | + | < |
- | }</ | + | MPI_Init(&argc, &argv); |
- | The times returned are local to the node that called them. There is no requirement | + | ... |
- | that dierent nodes return \the same time." (But see also the discussion of | + | MPI_Finalize( ); |
- | MPI_WTIME_IS_GLOBAL in Section 8.1.2). | + | </ |
- | MPI_WTICK() | + | otherwise its behavior |
- | double MPI_Wtick(void) | + | |
+ | === MPI_WTICK() | ||
+ | < | ||
DOUBLE PRECISION MPI_Wtick() BIND(C) | DOUBLE PRECISION MPI_Wtick() BIND(C) | ||
- | DOUBLE PRECISION MPI_WTICK() | + | DOUBLE PRECISION MPI_WTICK()</ |
- | MPI_WTICK returns the resolution of MPI_WTIME in seconds. That is, it returns, | + | MPI_WTICK returns the resolution of MPI_WTIME in seconds, |
- | as a double precision value, the number of seconds | + | |
- | example, | + | === Examples === |
- | every millisecond, | + | In this {{: |
+ | There are two possibilities. Either a MPI_Barrier can be set before each time call. Then the time measured | ||
+ | ==== omp internal calls ==== | ||
+ | === omp_get_wtime === | ||
+ | |||
+ | c example: | ||
+ | < | ||
+ | double start = omp_get_wtime( ); | ||
+ | Sleep(1000); | ||
+ | double end = omp_get_wtime( ); | ||
+ | double wtick = omp_get_wtick( ); | ||
+ | </ | ||
+ | |||
+ | ==== gettimeofday() ==== | ||
+ | gives the time of your wrist watch. | ||
+ | |||
+ | ==== clock ==== | ||
+ | gives the amount of time that the CPU is busy for a particular task from one call to the next. | ||
+ | |||
+ | ===== Hybrid OMP and MPI ====== | ||
+ | {{ : | ||
+ | {{ : | ||
+ | {{: | ||
+ | ====== Serial codes ====== | ||
+ | ==== fortran ==== | ||
+ | < | ||
+ | SYSTEM_CLOCK | ||
+ | DATE_AND_TIME | ||
+ | CPU_TIME | ||
+ | </ |