1
1

* 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.
Этот коммит содержится в:
Brian Barrett 2005-11-07 17:22:48 +00:00
родитель 60b19dcf63
Коммит 28891d6de3
9 изменённых файлов: 158 добавлений и 69 удалений

Просмотреть файл

@ -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_unlock(int rank, MPI_Win win);
OMPI_DECLSPEC int MPI_Win_wait(MPI_Win win); OMPI_DECLSPEC int MPI_Win_wait(MPI_Win win);
#endif #endif
OMPI_DECLSPEC double MPI_Wtick(void);
/* These 2 functions will shortly became macros, giving access to the high performance OMPI_DECLSPEC double MPI_Wtime(void);
* 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;
}
/* /*

Просмотреть файл

@ -336,7 +336,9 @@ libmpi_c_mpi_la_SOURCES = \
wait.c \ wait.c \
waitall.c \ waitall.c \
waitany.c \ waitany.c \
waitsome.c waitsome.c \
wtime.c \
wtick.c
if WANT_MPI2_ONE_SIDED if WANT_MPI2_ONE_SIDED
libmpi_c_mpi_la_SOURCES += \ libmpi_c_mpi_la_SOURCES += \

Просмотреть файл

@ -318,7 +318,9 @@ nodist_libmpi_c_pmpi_la_SOURCES = \
pwait.c \ pwait.c \
pwaitall.c \ pwaitall.c \
pwaitany.c \ pwaitany.c \
pwaitsome.c pwaitsome.c \
pwtime.c \
pwtick.c
if WANT_MPI2_ONE_SIDED if WANT_MPI2_ONE_SIDED
nodist_libmpi_c_pmpi_la_SOURCES += \ nodist_libmpi_c_pmpi_la_SOURCES += \

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 Обычный файл
Просмотреть файл

@ -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 = \ libmpi_f77_la_SOURCES = \
constants_f.c \ constants_f.c \
attr_fn_f.c \ attr_fn_f.c \
strings.c \ strings.c
wtick_f.c \
wtime_f.c
# #
# libmpi_c_mpi.la is only built in some cases (see above) # libmpi_c_mpi.la is only built in some cases (see above)
@ -332,7 +330,9 @@ libmpi_f77_mpi_la_SOURCES = \
waitall_f.c \ waitall_f.c \
waitany_f.c \ waitany_f.c \
wait_f.c \ wait_f.c \
waitsome_f.c waitsome_f.c \
wtick_f.c \
wtime_f.c
if WANT_MPI2_ONE_SIDED if WANT_MPI2_ONE_SIDED
libmpi_f77_mpi_la_SOURCES += \ libmpi_f77_mpi_la_SOURCES += \

Просмотреть файл

@ -300,7 +300,9 @@ nodist_libmpi_f77_pmpi_la_SOURCES = \
pwaitall_f.c \ pwaitall_f.c \
pwaitany_f.c \ pwaitany_f.c \
pwait_f.c \ pwait_f.c \
pwaitsome_f.c pwaitsome_f.c \
pwtick_f.c \
pwtime_f.c
if WANT_MPI2_ONE_SIDED if WANT_MPI2_ONE_SIDED
nodist_libmpi_f77_pmpi_la_SOURCES += \ nodist_libmpi_f77_pmpi_la_SOURCES += \

Просмотреть файл

@ -20,33 +20,41 @@
#include "mpi/f77/bindings.h" #include "mpi/f77/bindings.h"
/* As the standard allow us to define this function as a macro, it cannot #if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER
* have a profiling interface. #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 #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
#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 #endif
double mpi_wtick_f(void) double mpi_wtick_f(void)

Просмотреть файл

@ -20,33 +20,41 @@
#include "mpi/f77/bindings.h" #include "mpi/f77/bindings.h"
/* As the standard allow us to implement this function as a macro #if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER
* we cannot have profiling interface. #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 #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
#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 #endif
double mpi_wtime_f(void) double mpi_wtime_f(void)