* Move MPI_Wtime and MPI_Wtick back out of mpi.h and into the C bindings library,
restoring the PMPI version. A variety of reasons for this: - mpi.h was blinding using inline in a C header without the configrue mojo properly set it, as mpi.h doesn't include ompi_config.h. This eventually would have caused a borked build. - mpi.h and mpif.h were never updated to not include PMPI_W{tick,time} as a proper prototype - The C++ and F90 bindings didn't do the right things when there was no PMPI version of the C call, but profiling was enabled - Since we only use gettimeofday, the function call overhead really doesn't matter This should probably go to the 1.0 branch This commit was SVN r8014.
Этот коммит содержится в:
родитель
60b19dcf63
Коммит
28891d6de3
@ -1229,30 +1229,8 @@ OMPI_DECLSPEC int MPI_Win_test(MPI_Win win, int *flag);
|
||||
OMPI_DECLSPEC int MPI_Win_unlock(int rank, MPI_Win win);
|
||||
OMPI_DECLSPEC int MPI_Win_wait(MPI_Win win);
|
||||
#endif
|
||||
|
||||
/* These 2 functions will shortly became macros, giving access to the high performance
|
||||
* timers available on the specific architecture. Until then we let them here.
|
||||
* Beware: We dont have profiling interface for these 2 functions.
|
||||
*/
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
static inline double MPI_Wtick(void)
|
||||
{
|
||||
return (double)0.000001;
|
||||
}
|
||||
|
||||
static inline double MPI_Wtime(void)
|
||||
{
|
||||
struct timeval tv;
|
||||
double wtime;
|
||||
gettimeofday(&tv, NULL);
|
||||
wtime = tv.tv_sec;
|
||||
wtime += (double)tv.tv_usec / 1000000.0;
|
||||
return wtime;
|
||||
}
|
||||
OMPI_DECLSPEC double MPI_Wtick(void);
|
||||
OMPI_DECLSPEC double MPI_Wtime(void);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -336,7 +336,9 @@ libmpi_c_mpi_la_SOURCES = \
|
||||
wait.c \
|
||||
waitall.c \
|
||||
waitany.c \
|
||||
waitsome.c
|
||||
waitsome.c \
|
||||
wtime.c \
|
||||
wtick.c
|
||||
|
||||
if WANT_MPI2_ONE_SIDED
|
||||
libmpi_c_mpi_la_SOURCES += \
|
||||
|
@ -318,7 +318,9 @@ nodist_libmpi_c_pmpi_la_SOURCES = \
|
||||
pwait.c \
|
||||
pwaitall.c \
|
||||
pwaitany.c \
|
||||
pwaitsome.c
|
||||
pwaitsome.c \
|
||||
pwtime.c \
|
||||
pwtick.c
|
||||
|
||||
if WANT_MPI2_ONE_SIDED
|
||||
nodist_libmpi_c_pmpi_la_SOURCES += \
|
||||
|
42
ompi/mpi/c/wtick.c
Обычный файл
42
ompi/mpi/c/wtick.c
Обычный файл
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
#include "ompi_config.h"
|
||||
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
#include "mpi/c/bindings.h"
|
||||
#include "ompi/runtime/mpiruntime.h"
|
||||
|
||||
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
|
||||
#pragma weak MPI_Wtick = PMPI_Wtick
|
||||
#endif
|
||||
|
||||
#if OMPI_PROFILING_DEFINES
|
||||
#include "mpi/c/profile/defines.h"
|
||||
#endif
|
||||
|
||||
static const char FUNC_NAME[] = "MPI_Wtick";
|
||||
|
||||
|
||||
double MPI_Wtick(void)
|
||||
{
|
||||
return (double)0.000001;
|
||||
}
|
47
ompi/mpi/c/wtime.c
Обычный файл
47
ompi/mpi/c/wtime.c
Обычный файл
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
#include "ompi_config.h"
|
||||
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
#include "mpi/c/bindings.h"
|
||||
#include "ompi/runtime/mpiruntime.h"
|
||||
|
||||
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
|
||||
#pragma weak MPI_Wtime = PMPI_Wtime
|
||||
#endif
|
||||
|
||||
#if OMPI_PROFILING_DEFINES
|
||||
#include "mpi/c/profile/defines.h"
|
||||
#endif
|
||||
|
||||
static const char FUNC_NAME[] = "MPI_Wtime";
|
||||
|
||||
|
||||
double MPI_Wtime(void)
|
||||
{
|
||||
struct timeval tv;
|
||||
double wtime;
|
||||
gettimeofday(&tv, NULL);
|
||||
wtime = tv.tv_sec;
|
||||
wtime += (double)tv.tv_usec / 1000000.0;
|
||||
return wtime;
|
||||
}
|
@ -66,9 +66,7 @@ headers = \
|
||||
libmpi_f77_la_SOURCES = \
|
||||
constants_f.c \
|
||||
attr_fn_f.c \
|
||||
strings.c \
|
||||
wtick_f.c \
|
||||
wtime_f.c
|
||||
strings.c
|
||||
|
||||
#
|
||||
# libmpi_c_mpi.la is only built in some cases (see above)
|
||||
@ -332,7 +330,9 @@ libmpi_f77_mpi_la_SOURCES = \
|
||||
waitall_f.c \
|
||||
waitany_f.c \
|
||||
wait_f.c \
|
||||
waitsome_f.c
|
||||
waitsome_f.c \
|
||||
wtick_f.c \
|
||||
wtime_f.c
|
||||
|
||||
if WANT_MPI2_ONE_SIDED
|
||||
libmpi_f77_mpi_la_SOURCES += \
|
||||
|
@ -300,7 +300,9 @@ nodist_libmpi_f77_pmpi_la_SOURCES = \
|
||||
pwaitall_f.c \
|
||||
pwaitany_f.c \
|
||||
pwait_f.c \
|
||||
pwaitsome_f.c
|
||||
pwaitsome_f.c \
|
||||
pwtick_f.c \
|
||||
pwtime_f.c
|
||||
|
||||
if WANT_MPI2_ONE_SIDED
|
||||
nodist_libmpi_f77_pmpi_la_SOURCES += \
|
||||
|
@ -20,33 +20,41 @@
|
||||
|
||||
#include "mpi/f77/bindings.h"
|
||||
|
||||
/* As the standard allow us to define this function as a macro, it cannot
|
||||
* have a profiling interface.
|
||||
*/
|
||||
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER
|
||||
#pragma weak PMPI_WTICK = mpi_wtick_f
|
||||
#pragma weak pmpi_wtick = mpi_wtick_f
|
||||
#pragma weak pmpi_wtick_ = mpi_wtick_f
|
||||
#pragma weak pmpi_wtick__ = mpi_wtick_f
|
||||
#elif OMPI_PROFILE_LAYER
|
||||
OMPI_GENERATE_F77_BINDINGS (PMPI_WTICK,
|
||||
pmpi_wtick,
|
||||
pmpi_wtick_,
|
||||
pmpi_wtick__,
|
||||
pmpi_wtick_f,
|
||||
(),
|
||||
() )
|
||||
#endif
|
||||
|
||||
#if OMPI_HAVE_WEAK_SYMBOLS
|
||||
#pragma weak MPI_WTICK = mpi_wtick_f
|
||||
#pragma weak mpi_wtick = mpi_wtick_f
|
||||
#pragma weak mpi_wtick_ = mpi_wtick_f
|
||||
#pragma weak mpi_wtick__ = mpi_wtick_f
|
||||
#endif
|
||||
|
||||
#else
|
||||
#if ! OMPI_HAVE_WEAK_SYMBOLS && ! OMPI_PROFILE_LAYER
|
||||
OMPI_GENERATE_F77_BINDINGS (MPI_WTICK,
|
||||
mpi_wtick,
|
||||
mpi_wtick_,
|
||||
mpi_wtick__,
|
||||
mpi_wtick_f,
|
||||
(),
|
||||
() )
|
||||
#endif
|
||||
|
||||
double mpi_wtick(void) {
|
||||
return MPI_Wtick();
|
||||
}
|
||||
|
||||
double mpi_wtick_(void) {
|
||||
return MPI_Wtick();
|
||||
}
|
||||
|
||||
double mpi_wtick__(void) {
|
||||
return MPI_Wtick();
|
||||
}
|
||||
|
||||
double MPI_WTICK(void) {
|
||||
return MPI_Wtick();
|
||||
}
|
||||
|
||||
#if OMPI_PROFILE_LAYER && ! OMPI_HAVE_WEAK_SYMBOLS
|
||||
#include "mpi/f77/profile/defines.h"
|
||||
#endif
|
||||
|
||||
double mpi_wtick_f(void)
|
||||
|
@ -20,33 +20,41 @@
|
||||
|
||||
#include "mpi/f77/bindings.h"
|
||||
|
||||
/* As the standard allow us to implement this function as a macro
|
||||
* we cannot have profiling interface.
|
||||
*/
|
||||
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER
|
||||
#pragma weak PMPI_WTIME = mpi_wtime_f
|
||||
#pragma weak pmpi_wtime = mpi_wtime_f
|
||||
#pragma weak pmpi_wtime_ = mpi_wtime_f
|
||||
#pragma weak pmpi_wtime__ = mpi_wtime_f
|
||||
#elif OMPI_PROFILE_LAYER
|
||||
OMPI_GENERATE_F77_BINDINGS (PMPI_WTIME,
|
||||
pmpi_wtime,
|
||||
pmpi_wtime_,
|
||||
pmpi_wtime__,
|
||||
pmpi_wtime_f,
|
||||
(),
|
||||
() )
|
||||
#endif
|
||||
|
||||
#if OMPI_HAVE_WEAK_SYMBOLS
|
||||
#pragma weak MPI_WTIME = mpi_wtime_f
|
||||
#pragma weak mpi_wtime = mpi_wtime_f
|
||||
#pragma weak mpi_wtime_ = mpi_wtime_f
|
||||
#pragma weak mpi_wtime__ = mpi_wtime_f
|
||||
#endif
|
||||
|
||||
#else
|
||||
#if ! OMPI_HAVE_WEAK_SYMBOLS && ! OMPI_PROFILE_LAYER
|
||||
OMPI_GENERATE_F77_BINDINGS (MPI_WTIME,
|
||||
mpi_wtime,
|
||||
mpi_wtime_,
|
||||
mpi_wtime__,
|
||||
mpi_wtime_f,
|
||||
(),
|
||||
() )
|
||||
#endif
|
||||
|
||||
double mpi_wtime(void) {
|
||||
return MPI_Wtime();
|
||||
}
|
||||
|
||||
double mpi_wtime_(void) {
|
||||
return MPI_Wtime();
|
||||
}
|
||||
|
||||
double mpi_wtime__(void) {
|
||||
return MPI_Wtime();
|
||||
}
|
||||
|
||||
double MPI_WTIME(void) {
|
||||
return MPI_Wtime();
|
||||
}
|
||||
|
||||
#if OMPI_PROFILE_LAYER && ! OMPI_HAVE_WEAK_SYMBOLS
|
||||
#include "mpi/f77/profile/defines.h"
|
||||
#endif
|
||||
|
||||
double mpi_wtime_f(void)
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user