diff --git a/include/mpi.h.in b/include/mpi.h.in index 7c1c45a99e..847aeace4a 100644 --- a/include/mpi.h.in +++ b/include/mpi.h.in @@ -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 -#endif -#include - -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); /* diff --git a/ompi/mpi/c/Makefile.am b/ompi/mpi/c/Makefile.am index 1ffef333ea..ec576f555a 100644 --- a/ompi/mpi/c/Makefile.am +++ b/ompi/mpi/c/Makefile.am @@ -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 += \ diff --git a/ompi/mpi/c/profile/Makefile.am b/ompi/mpi/c/profile/Makefile.am index 79c3b758b5..9f74e5d620 100644 --- a/ompi/mpi/c/profile/Makefile.am +++ b/ompi/mpi/c/profile/Makefile.am @@ -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 += \ diff --git a/ompi/mpi/c/wtick.c b/ompi/mpi/c/wtick.c new file mode 100644 index 0000000000..754a3b6e8b --- /dev/null +++ b/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 +#endif +#include + +#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; +} diff --git a/ompi/mpi/c/wtime.c b/ompi/mpi/c/wtime.c new file mode 100644 index 0000000000..4fdf19da70 --- /dev/null +++ b/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 +#endif +#include + +#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; +} diff --git a/ompi/mpi/f77/Makefile.am b/ompi/mpi/f77/Makefile.am index 90b0932f13..b3332fa96a 100644 --- a/ompi/mpi/f77/Makefile.am +++ b/ompi/mpi/f77/Makefile.am @@ -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 += \ diff --git a/ompi/mpi/f77/profile/Makefile.am b/ompi/mpi/f77/profile/Makefile.am index 5cb9079c37..b03b270c21 100644 --- a/ompi/mpi/f77/profile/Makefile.am +++ b/ompi/mpi/f77/profile/Makefile.am @@ -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 += \ diff --git a/ompi/mpi/f77/wtick_f.c b/ompi/mpi/f77/wtick_f.c index f5c625b34c..3fdb81b232 100644 --- a/ompi/mpi/f77/wtick_f.c +++ b/ompi/mpi/f77/wtick_f.c @@ -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) diff --git a/ompi/mpi/f77/wtime_f.c b/ompi/mpi/f77/wtime_f.c index 07925947f9..f0e56c2110 100644 --- a/ompi/mpi/f77/wtime_f.c +++ b/ompi/mpi/f77/wtime_f.c @@ -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)