* Clean up a little #if logic in MPI_WTICK / MPI_WTIME
* Update MPI_WTICK / MPI_WTIME man pages: * Fix C++ declarations * Note that we may use better than gettimeofday() on some platforms * Add "MPI_WTIME support" ("options:mpi-wtime") flag in ompi_info output indicating whether we use "native" or "gettimeofday" for MPI_WTIME This commit was SVN r16774.
Этот коммит содержится в:
родитель
edb9d8e354
Коммит
cf98657adb
@ -9,6 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -42,17 +43,16 @@ double MPI_Wtick(void)
|
||||
OPAL_CR_TEST_CHECKPOINT_READY();
|
||||
|
||||
#if OPAL_TIMER_USEC_NATIVE
|
||||
/* We may or may not have native usec precision on Windows, so put
|
||||
this #if before the #ifdef checking for Windows. */
|
||||
return 0.000001;
|
||||
#else
|
||||
|
||||
#if defined(__WINDOWS__)
|
||||
#elif defined(__WINDOWS__)
|
||||
if( (opal_timer_t)0 == opal_timer_base_get_freq() ) {
|
||||
opal_output( 0, "No timer frequency\n" );
|
||||
}
|
||||
return (double)opal_timer_base_get_freq();
|
||||
#else
|
||||
/* Otherwise, we already return usec precision. */
|
||||
return 0.000001;
|
||||
#endif /* defined(__WINDOWS__) */
|
||||
|
||||
#endif /* OPAL_TIMER_USEC_NATIVE */
|
||||
#endif
|
||||
}
|
||||
|
@ -44,20 +44,19 @@ double MPI_Wtime(void)
|
||||
double wtime;
|
||||
|
||||
#if OPAL_TIMER_USEC_NATIVE
|
||||
wtime = (double)opal_timer_base_get_usec() / 1000000.0;
|
||||
#else
|
||||
|
||||
#if defined(__WINDOWS__)
|
||||
wtime = ((double)opal_timer_base_get_cycles()) / ((double)opal_timer_base_get_freq());
|
||||
return wtime;
|
||||
/* We may or may not have native usec precision on Windows, so put
|
||||
this #if before the #ifdef checking for Windows. */
|
||||
wtime = ((double) opal_timer_base_get_usec()) / 1000000.0;
|
||||
#elif defined(__WINDOWS__)
|
||||
wtime = ((double) opal_timer_base_get_cycles()) /
|
||||
((double) opal_timer_base_get_freq());
|
||||
#else
|
||||
/* Fall back to gettimeofday() if we have nothing else */
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
wtime = tv.tv_sec;
|
||||
wtime += (double)tv.tv_usec / 1000000.0;
|
||||
#endif /* defined(__WINDOWS__) */
|
||||
|
||||
#endif /* OPAL_TIMER_USEC_NATIVE */
|
||||
#endif
|
||||
|
||||
OPAL_CR_TEST_CHECKPOINT_READY();
|
||||
|
||||
|
@ -19,7 +19,7 @@ DOUBLE PRECISION MPI_WTICK()
|
||||
.SH C++ Syntax
|
||||
.nf
|
||||
#include <mpi.h>
|
||||
double Wtick()
|
||||
double MPI::Wtick()
|
||||
|
||||
.SH RETURN VALUE
|
||||
.ft R
|
||||
@ -27,16 +27,22 @@ Time in seconds of resolution of MPI_Wtime.
|
||||
|
||||
.SH DESCRIPTION
|
||||
.ft R
|
||||
MPI_Wtick returns the resolution of MPI_Wtime in seconds. That is, it returns, as a double-precision value, the number of seconds between successive clock ticks. For example, if the clock is implemented by the hardware as a counter that is incremented every millisecond, the value returned by MPI_Wtick should be 10^-3.
|
||||
MPI_Wtick returns the resolution of MPI_Wtime in seconds. That is, it
|
||||
returns, as a double-precision value, the number of seconds between
|
||||
successive clock ticks. For example, if the clock is implemented by
|
||||
the hardware as a counter that is incremented every millisecond, the
|
||||
value returned by MPI_Wtick should be 10^-3.
|
||||
.PP
|
||||
Note that on POSIX platforms, Open MPI should always return 10^-3 for
|
||||
MPI_Wtick. The returned value may be different on Windows platforms.
|
||||
.PP
|
||||
.SH NOTE
|
||||
This function does not return an error value. Consequently, the result of calling it before MPI_Init or after MPI_Finalize is undefined.
|
||||
|
||||
.SH NOTE
|
||||
This function does not return an error value. Consequently, the result
|
||||
of calling it before MPI_Init or after MPI_Finalize is undefined.
|
||||
|
||||
.SH SEE ALSO
|
||||
.ft R
|
||||
.sp
|
||||
MPI_Wtime
|
||||
|
||||
|
||||
' @(#)MPI_Wtick.3 1.21 06/03/09
|
||||
|
@ -19,7 +19,7 @@ DOUBLE PRECISION MPI_WTIME()
|
||||
.SH C++ Syntax
|
||||
.nf
|
||||
#include <mpi.h>
|
||||
double Wtime()
|
||||
double MPI::Wtime()
|
||||
|
||||
.SH RETURN VALUE
|
||||
.ft R
|
||||
@ -48,7 +48,17 @@ The times returned are local to the node that called them. There is no requireme
|
||||
The boolean variable MPI_WTIME_IS_GLOBAL, a predefined attribute key that indicates whether clocks are synchronized, does not have a valid value in Open MPI, as the clocks are not guaranteed to be synchronized.
|
||||
|
||||
.PP
|
||||
This is intended to be a high-resolution, elapsed (or wall) clock. See MPI_Wtick to determine the resolution of MPI_Wtime.
|
||||
This function is intended to be a high-resolution, elapsed (or wall) clock. See MPI_Wtick to determine the resolution of MPI_Wtime.
|
||||
.PP
|
||||
On POSIX platforms, this function may utilize a timer that is cheaper
|
||||
to invoke than the gettimeofday() system call, but will fall back to
|
||||
gettimeofday() if a cheap high-resolution timer is not available. The
|
||||
ompi_info command can be consulted to see if Open MPI supports a
|
||||
native high-resolution timer on your platform; see the value for "MPI_WTIME
|
||||
support" (or "options:mpi-wtime" when viewing the parsable
|
||||
output). If this value is "native", a method that is likely to be
|
||||
cheaper than gettimeofday() will be used to obtain the time when
|
||||
MPI_Wtime is invoked.
|
||||
.PP
|
||||
This function does not return an error value. Consequently, the result of calling it before MPI_Init or after MPI_Finalize is undefined.
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#include MCA_timer_IMPLEMENTATION_HEADER
|
||||
#include "opal/mca/installdirs/installdirs.h"
|
||||
#include "opal/class/opal_value_array.h"
|
||||
#include "opal/util/printf.h"
|
||||
@ -353,6 +354,7 @@ void ompi_info::do_config(bool want_all)
|
||||
"yes" : "no");
|
||||
const string sparse_groups(OMPI_GROUP_SPARSE ? "yes" : "no");
|
||||
const string have_mpi_io(OMPI_PROVIDE_MPI_FILE_INTERFACE ? "yes" : "no");
|
||||
const string wtime_support(OPAL_TIMER_USEC_NATIVE ? "native" : "gettimeofday");
|
||||
|
||||
if (OMPI_HAVE_SOLARIS_THREADS || OMPI_HAVE_POSIX_THREADS) {
|
||||
threads = OMPI_HAVE_SOLARIS_THREADS ? "solaris" :
|
||||
@ -589,4 +591,5 @@ void ompi_info::do_config(bool want_all)
|
||||
out("mpirun default --prefix", "mpirun:prefix_by_default",
|
||||
mpirun_prefix_by_default);
|
||||
out("MPI I/O support", "options:mpi-io", have_mpi_io);
|
||||
out("MPI_WTIME support", "options:mpi-wtime", wtime_support);
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user