diff --git a/config/ompi_config_files.m4 b/config/ompi_config_files.m4 index 3189831768..e3f74fa448 100644 --- a/config/ompi_config_files.m4 +++ b/config/ompi_config_files.m4 @@ -35,6 +35,8 @@ AC_DEFUN([OMPI_CONFIG_FILES],[ ompi/mpi/fortran/use-mpi-f08/Makefile ompi/mpi/fortran/use-mpi-f08-desc/Makefile ompi/mpi/fortran/mpiext/Makefile + ompi/mpi/tool/Makefile + ompi/mpi/tool/profile/Makefile ompi/tools/ompi_info/Makefile ompi/tools/wrappers/Makefile diff --git a/ompi/Makefile.am b/ompi/Makefile.am index 85a2cb4136..9952b5ab5e 100644 --- a/ompi/Makefile.am +++ b/ompi/Makefile.am @@ -12,6 +12,8 @@ # Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. # Copyright (c) 2010-2011 Sandia National Laboratories. All rights reserved. +# Copyright (c) 2013 Los Alamos National Security, LLC. All rights +# reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -22,12 +24,12 @@ # We always have C bindings, but do we have profiling? if BUILD_MPI_BINDINGS_LAYER -c_mpi_lib = mpi/c/libmpi_c_mpi.la +c_mpi_lib = mpi/c/libmpi_c_mpi.la mpi/tool/libmpi_mpit.la else c_mpi_lib = endif if BUILD_PMPI_BINDINGS_LAYER -c_pmpi_lib = mpi/c/profile/libmpi_c_pmpi.la +c_pmpi_lib = mpi/c/profile/libmpi_c_pmpi.la mpi/tool/profile/libmpi_pmpit.la else c_pmpi_lib = endif @@ -77,6 +79,7 @@ SUBDIRS = \ debuggers \ etc \ mpi/c \ + mpi/tool \ $(OMPI_MPIEXT_C_DIRS) \ mpi/fortran/base/ \ $(MCA_ompi_FRAMEWORKS_SUBDIRS) \ @@ -108,6 +111,7 @@ DIST_SUBDIRS = \ debuggers \ etc \ mpi/c \ + mpi/tool \ mpi/cxx \ mpi/fortran/base \ mpi/fortran/mpif-h \ @@ -117,6 +121,7 @@ DIST_SUBDIRS = \ mpi/fortran/use-mpi-f08-desc \ mpi/fortran/mpiext \ mpi/java \ + mpi/tool \ $(OMPI_MPIEXT_ALL_SUBDIRS) \ $(MCA_ompi_FRAMEWORKS_SUBDIRS) \ $(MCA_ompi_FRAMEWORK_COMPONENT_ALL_SUBDIRS) \ @@ -180,7 +185,6 @@ include tools/Makefile.am include mpi/Makefile.am include mpi/man/man3/Makefile.extra include mpiext/Makefile.am -include mpit/Makefile.am include patterns/net/Makefile.am include patterns/comm/Makefile.am diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index 309078cdb8..672d976cd3 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -740,6 +740,7 @@ enum { */ #define MPI_T_PVAR_ALL_HANDLES ((MPI_T_pvar_handle) -1) #define MPI_T_PVAR_HANDLE_NULL ((MPI_T_pvar_handle) 0) +#define MPI_T_CVAR_HANDLE_NULL ((MPI_T_cvar_handle) 0) /* MPI-2 specifies that the name "MPI_TYPE_NULL_DELETE_FN" (and all related friends) must be accessible in C, C++, and Fortran. This is @@ -2353,6 +2354,49 @@ OMPI_DECLSPEC int PMPI_Win_unlock(int rank, MPI_Win win); OMPI_DECLSPEC int PMPI_Win_wait(MPI_Win win); OMPI_DECLSPEC double PMPI_Wtick(void); OMPI_DECLSPEC double PMPI_Wtime(void); +OMPI_DECLSPEC int PMPI_T_init_thread (int required, int *provided); +OMPI_DECLSPEC int PMPI_T_finalize (void); +OMPI_DECLSPEC int PMPI_T_cvar_get_num (int *num_cvar); +OMPI_DECLSPEC int PMPI_T_cvar_get_info (int cvar_index, char *name, int *name_len, + int *verbosity, MPI_Datatype *datatype, + MPI_T_enum *enumtype, char *desc, + int *desc_len, int *bind, int *scope); +OMPI_DECLSPEC int PMPI_T_cvar_handle_alloc (int cvar_index, void *obj_handle, + MPI_T_cvar_handle *handle, int *count); +OMPI_DECLSPEC int PMPI_T_cvar_handle_free (MPI_T_cvar_handle *handle); +OMPI_DECLSPEC int PMPI_T_cvar_read (MPI_T_cvar_handle handle, void *buf); +OMPI_DECLSPEC int PMPI_T_cvar_write (MPI_T_cvar_handle handle, const void *buf); +OMPI_DECLSPEC int PMPI_T_category_get_num(int *num_cat); +OMPI_DECLSPEC int PMPI_T_category_get_info(int cat_index, char *name, int *name_len, + char *desc, int *desc_len, int *num_cvars, + int *num_pvars, int *num_categories); +OMPI_DECLSPEC int PMPI_T_category_get_cvars(int cat_index, int len, int indices[]); +OMPI_DECLSPEC int PMPI_T_category_get_pvars(int cat_index, int len, int indices[]); +OMPI_DECLSPEC int PMPI_T_category_get_categories(int cat_index, int len, int indices[]); +OMPI_DECLSPEC int PMPI_T_category_changed(int *stamp); + +OMPI_DECLSPEC int PMPI_T_pvar_get_num(int *num_pvar); +OMPI_DECLSPEC int PMPI_T_pvar_get_info(int pvar_index, char *name, int *name_len, + int *verbosity, int *var_class, MPI_Datatype *datatype, + MPI_T_enum *enumtype, char *desc, int *desc_len, int *bind, + int *readonly, int *continuous, int *atomic); +OMPI_DECLSPEC int PMPI_T_pvar_session_create(MPI_T_pvar_session *session); +OMPI_DECLSPEC int PMPI_T_pvar_session_free(MPI_T_pvar_session *session); +OMPI_DECLSPEC int PMPI_T_pvar_handle_alloc(MPI_T_pvar_session session, int pvar_index, + void *obj_handle, MPI_T_pvar_handle *handle, int *count); +OMPI_DECLSPEC int PMPI_T_pvar_handle_free(MPI_T_pvar_session session, MPI_T_pvar_handle *handle); +OMPI_DECLSPEC int PMPI_T_pvar_start(MPI_T_pvar_session session, MPI_T_pvar_handle handle); +OMPI_DECLSPEC int PMPI_T_pvar_stop(MPI_T_pvar_session session, MPI_T_pvar_handle handle); +OMPI_DECLSPEC int PMPI_T_pvar_read(MPI_T_pvar_session session, MPI_T_pvar_handle handle, + void *buf); +OMPI_DECLSPEC int PMPI_T_pvar_write(MPI_T_pvar_session session, MPI_T_pvar_handle handle, + const void *buf); +OMPI_DECLSPEC int PMPI_T_pvar_reset(MPI_T_pvar_session session, MPI_T_pvar_handle handle); +OMPI_DECLSPEC int PMPI_T_pvar_readreset(MPI_T_pvar_session session, MPI_T_pvar_handle handle, + void *buf); +OMPI_DECLSPEC int PMPI_T_enum_get_info(MPI_T_enum enumtype, int *num, char *name, int *name_len); +OMPI_DECLSPEC int PMPI_T_enum_get_item(MPI_T_enum enumtype, int index, int *value, char *name, + int *name_len); /* * Tool MPI API diff --git a/ompi/mca/pml/ob1/pml_ob1_component.c b/ompi/mca/pml/ob1/pml_ob1_component.c index b3bb242aca..a8e6905bbe 100644 --- a/ompi/mca/pml/ob1/pml_ob1_component.c +++ b/ompi/mca/pml/ob1/pml_ob1_component.c @@ -36,8 +36,7 @@ #include "ompi/mca/bml/base/base.h" #include "pml_ob1_component.h" #include "ompi/mca/allocator/base/base.h" - -#include "ompi/mpit/mpit-internal.h" +#include "opal/mca/base/mca_base_pvar.h" OBJ_CLASS_INSTANCE( mca_pml_ob1_pckt_pending_t, ompi_free_list_item_t, diff --git a/ompi/mpi/tool/Makefile.am b/ompi/mpi/tool/Makefile.am new file mode 100644 index 0000000000..30e07ba51f --- /dev/null +++ b/ompi/mpi/tool/Makefile.am @@ -0,0 +1,41 @@ +# +# Copyright (c) 2004-2006 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, +# University of Stuttgart. All rights reserved. +# Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights +# reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +SUBDIRS = profile + +AM_CPPFLAGS = -DOMPI_PROFILING_DEFINES=0 + +noinst_LTLIBRARIES = libmpi_mpit.la + +headers = mpit-internal.h + +libmpi_mpit_la_SOURCES = init_thread.c finalize.c cvar_get_num.c \ + cvar_get_info.c cvar_read.c cvar_write.c \ + cvar_handle_alloc.c cvar_handle_free.c \ + catagory_get_num.c catagory_get_info.c \ + catagory_get_cvars.c catagory_get_pvars.c \ + catagory_get_catagories.c catagory_changed.c \ + pvar_get_info.c pvar_get_num.c pvar_handle_alloc.c \ + pvar_handle_free.c pvar_read.c pvar_readreset.c \ + pvar_reset.c pvar_session_create.c pvar_session_free.c \ + pvar_start.c pvar_stop.c pvar_write.c \ + enum_get_info.c enum_get_item.c mpit_common.c + +# Conditionally install the header files + +if WANT_INSTALL_HEADERS +ompidir = $(includedir)/openmpi/$(subdir) +ompi_HEADERS = $(headers) +endif diff --git a/ompi/mpit/catagory_changed.c b/ompi/mpi/tool/catagory_changed.c similarity index 69% rename from ompi/mpit/catagory_changed.c rename to ompi/mpi/tool/catagory_changed.c index 3e9bb213de..7f9ea74acc 100644 --- a/ompi/mpit/catagory_changed.c +++ b/ompi/mpi/tool/catagory_changed.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_category_changed = PMPI_T_category_changed +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_category_changed"; diff --git a/ompi/mpit/catagory_get_catagories.c b/ompi/mpi/tool/catagory_get_catagories.c similarity index 81% rename from ompi/mpit/catagory_get_catagories.c rename to ompi/mpi/tool/catagory_get_catagories.c index a88f9b16f5..464d23f397 100644 --- a/ompi/mpit/catagory_get_catagories.c +++ b/ompi/mpi/tool/catagory_get_catagories.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_category_get_categories = PMPI_T_category_get_categories +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_category_get_categories"; diff --git a/ompi/mpit/catagory_get_cvars.c b/ompi/mpi/tool/catagory_get_cvars.c similarity index 81% rename from ompi/mpit/catagory_get_cvars.c rename to ompi/mpi/tool/catagory_get_cvars.c index 76b7f064b8..396c9a86ed 100644 --- a/ompi/mpit/catagory_get_cvars.c +++ b/ompi/mpi/tool/catagory_get_cvars.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_category_get_cvars = PMPI_T_category_get_cvars +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_category_get_cvars"; diff --git a/ompi/mpit/catagory_get_info.c b/ompi/mpi/tool/catagory_get_info.c similarity index 86% rename from ompi/mpit/catagory_get_info.c rename to ompi/mpi/tool/catagory_get_info.c index c9d819a431..cb88882489 100644 --- a/ompi/mpit/catagory_get_info.c +++ b/ompi/mpi/tool/catagory_get_info.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_category_get_info = PMPI_T_category_get_info +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_category_get_info"; diff --git a/ompi/mpit/catagory_get_num.c b/ompi/mpi/tool/catagory_get_num.c similarity index 72% rename from ompi/mpit/catagory_get_num.c rename to ompi/mpi/tool/catagory_get_num.c index cbc86dec72..8ae521135b 100644 --- a/ompi/mpit/catagory_get_num.c +++ b/ompi/mpi/tool/catagory_get_num.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_category_get_num = PMPI_T_category_get_num +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_catagory_get_num"; diff --git a/ompi/mpit/catagory_get_pvars.c b/ompi/mpi/tool/catagory_get_pvars.c similarity index 81% rename from ompi/mpit/catagory_get_pvars.c rename to ompi/mpi/tool/catagory_get_pvars.c index b4fc62eaf9..ed7cdbf4b6 100644 --- a/ompi/mpit/catagory_get_pvars.c +++ b/ompi/mpi/tool/catagory_get_pvars.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_category_get_pvars = PMPI_T_category_get_pvars +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_category_get_pvars"; diff --git a/ompi/mpit/cvar_get_info.c b/ompi/mpi/tool/cvar_get_info.c similarity index 87% rename from ompi/mpit/cvar_get_info.c rename to ompi/mpi/tool/cvar_get_info.c index 306941b290..d9f73fc6ac 100644 --- a/ompi/mpit/cvar_get_info.c +++ b/ompi/mpi/tool/cvar_get_info.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_cvar_get_info = PMPI_T_cvar_get_info +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_cvar_get_info"; diff --git a/ompi/mpit/cvar_get_num.c b/ompi/mpi/tool/cvar_get_num.c similarity index 72% rename from ompi/mpit/cvar_get_num.c rename to ompi/mpi/tool/cvar_get_num.c index 840e1a1694..b033f526e6 100644 --- a/ompi/mpit/cvar_get_num.c +++ b/ompi/mpi/tool/cvar_get_num.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_cvar_get_num = PMPI_T_cvar_get_num +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_cvar_get_num"; diff --git a/ompi/mpit/cvar_handle_alloc.c b/ompi/mpi/tool/cvar_handle_alloc.c similarity index 87% rename from ompi/mpit/cvar_handle_alloc.c rename to ompi/mpi/tool/cvar_handle_alloc.c index 201696ea55..26a086bcd6 100644 --- a/ompi/mpit/cvar_handle_alloc.c +++ b/ompi/mpi/tool/cvar_handle_alloc.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_cvar_handle_alloc = PMPI_T_cvar_handle_alloc +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_cvar_handle_alloc"; diff --git a/ompi/mpit/cvar_handle_free.c b/ompi/mpi/tool/cvar_handle_free.c similarity index 60% rename from ompi/mpit/cvar_handle_free.c rename to ompi/mpi/tool/cvar_handle_free.c index 471e018cf3..589ac566a5 100644 --- a/ompi/mpit/cvar_handle_free.c +++ b/ompi/mpi/tool/cvar_handle_free.c @@ -9,7 +9,17 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_cvar_handle_free = PMPI_T_cvar_handle_free +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif + +static const char FUNC_NAME[] = "MPI_T_cvar_handle_free"; int MPI_T_cvar_handle_free (MPI_T_cvar_handle *handle) { diff --git a/ompi/mpit/cvar_read.c b/ompi/mpi/tool/cvar_read.c similarity index 89% rename from ompi/mpit/cvar_read.c rename to ompi/mpi/tool/cvar_read.c index 77b0d2a1de..81e3222f28 100644 --- a/ompi/mpit/cvar_read.c +++ b/ompi/mpi/tool/cvar_read.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_cvar_read = PMPI_T_cvar_read +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_cvar_read"; diff --git a/ompi/mpit/cvar_write.c b/ompi/mpi/tool/cvar_write.c similarity index 84% rename from ompi/mpit/cvar_write.c rename to ompi/mpi/tool/cvar_write.c index d2807e4985..b18288621e 100644 --- a/ompi/mpit/cvar_write.c +++ b/ompi/mpi/tool/cvar_write.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_cvar_write = PMPI_T_cvar_write +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_cvar_write"; diff --git a/ompi/mpit/enum_get_info.c b/ompi/mpi/tool/enum_get_info.c similarity index 78% rename from ompi/mpit/enum_get_info.c rename to ompi/mpi/tool/enum_get_info.c index 0d91738dc7..316f232fe5 100644 --- a/ompi/mpit/enum_get_info.c +++ b/ompi/mpi/tool/enum_get_info.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_enum_get_info = PMPI_T_enum_get_info +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_enum_get_info"; diff --git a/ompi/mpit/enum_get_item.c b/ompi/mpi/tool/enum_get_item.c similarity index 82% rename from ompi/mpit/enum_get_item.c rename to ompi/mpi/tool/enum_get_item.c index 6165dd00cd..81b625536c 100644 --- a/ompi/mpit/enum_get_item.c +++ b/ompi/mpi/tool/enum_get_item.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_enum_get_item = PMPI_T_enum_get_item +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_enum_get_item"; diff --git a/ompi/mpit/finalize.c b/ompi/mpi/tool/finalize.c similarity index 74% rename from ompi/mpit/finalize.c rename to ompi/mpi/tool/finalize.c index d7a119e1d8..ea571012b5 100644 --- a/ompi/mpit/finalize.c +++ b/ompi/mpi/tool/finalize.c @@ -10,11 +10,19 @@ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" #include "opal/include/opal/sys/atomic.h" #include "opal/runtime/opal.h" +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_finalize = PMPI_T_finalize +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif + static const char FUNC_NAME[] = "MPI_T_finalize"; int MPI_T_finalize (void) diff --git a/ompi/mpi/tool/init_thread.c b/ompi/mpi/tool/init_thread.c new file mode 100644 index 0000000000..48a26c3150 --- /dev/null +++ b/ompi/mpi/tool/init_thread.c @@ -0,0 +1,76 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi/mpi/tool/mpit-internal.h" + +#include "ompi/runtime/ompi_info_support.h" +#include "opal/include/opal/sys/atomic.h" +#include "opal/runtime/opal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_init_thread = PMPI_T_init_thread +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif + +extern opal_mutex_t mpit_big_lock; + +extern volatile uint32_t mpit_init_count; +extern volatile int32_t initted; + +static const char FUNC_NAME[] = "MPI_T_init_thread"; + +int MPI_T_init_thread (int required, int *provided) +{ + static volatile int32_t first_init = 1; + int rc = MPI_SUCCESS; + + if (opal_atomic_cmpset (&first_init, 1, 0) == 1) { + OBJ_CONSTRUCT(&mpit_big_lock, opal_mutex_t); + initted = 1; + } + + while (!initted) { + usleep (10); + } + + mpit_lock (); + + do { + if (0 != mpit_init_count++) { + break; + } + + /* call opal_init_util to intialize the MCA system */ + rc = opal_init_util (NULL, NULL); + if (OPAL_SUCCESS != rc) { + rc = MPI_ERR_OTHER; + break; + } + + /* register all parameters */ + rc = ompi_info_register_framework_params (NULL); + if (OMPI_SUCCESS != rc) { + rc = MPI_ERR_OTHER; + break; + } + + /* determine the thread level. TODO -- this might + be wrong */ + ompi_mpi_thread_level (required, provided); + } while (0); + + mpit_unlock (); + + return rc; +} diff --git a/ompi/mpit/mpit-internal.h b/ompi/mpi/tool/mpit-internal.h similarity index 100% rename from ompi/mpit/mpit-internal.h rename to ompi/mpi/tool/mpit-internal.h diff --git a/ompi/mpit/init_thread.c b/ompi/mpi/tool/mpit_common.c similarity index 61% rename from ompi/mpit/init_thread.c rename to ompi/mpi/tool/mpit_common.c index 6ce01130c9..296d20adcb 100644 --- a/ompi/mpit/init_thread.c +++ b/ompi/mpi/tool/mpit_common.c @@ -9,21 +9,12 @@ * $HEADER$ */ - -#include "ompi/mpit/mpit-internal.h" - -#include - -#include "ompi/runtime/ompi_info_support.h" -#include "opal/include/opal/sys/atomic.h" -#include "opal/runtime/opal.h" - -static const char FUNC_NAME[] = "MPI_T_init_thread"; +#include "ompi/mpi/tool/mpit-internal.h" opal_mutex_t mpit_big_lock; volatile uint32_t mpit_init_count = 0; -static volatile int32_t initted = 0; +volatile int32_t initted = 0; void mpit_lock (void) { @@ -91,48 +82,3 @@ int ompit_var_type_to_datatype (mca_base_var_type_t type, MPI_Datatype *datatype return OMPI_SUCCESS; } - -int MPI_T_init_thread (int required, int *provided) -{ - static volatile int32_t first_init = 1; - int rc = MPI_SUCCESS; - - if (opal_atomic_cmpset (&first_init, 1, 0) == 1) { - OBJ_CONSTRUCT(&mpit_big_lock, opal_mutex_t); - initted = 1; - } - - while (!initted) { - usleep (10); - } - - mpit_lock (); - - do { - if (0 != mpit_init_count++) { - break; - } - - /* call opal_init_util to intialize the MCA system */ - rc = opal_init_util (NULL, NULL); - if (OPAL_SUCCESS != rc) { - rc = MPI_ERR_OTHER; - break; - } - - /* register all parameters */ - rc = ompi_info_register_framework_params (NULL); - if (OMPI_SUCCESS != rc) { - rc = MPI_ERR_OTHER; - break; - } - - /* determine the thread level. TODO -- this might - be wrong */ - ompi_mpi_thread_level (required, provided); - } while (0); - - mpit_unlock (); - - return rc; -} diff --git a/ompi/mpi/tool/profile/Makefile.am b/ompi/mpi/tool/profile/Makefile.am new file mode 100644 index 0000000000..4444f32a07 --- /dev/null +++ b/ompi/mpi/tool/profile/Makefile.am @@ -0,0 +1,102 @@ +# -*- makefile -*- +# +# 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 (c) 2009-2012 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2011 Sandia National Laboratories. All rights reserved. +# Copyright (c) 2012 Oak Rigde National Laboratory. All rights reserved. +# Copyright (c) 2013 Los Alamos National Security, LLC. All rights +# reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# +# OMPI_PROFILING_DEFINES flag s enabled when we want our MPI_* symbols +# to be replaced by PMPI_*. In other words, this flag decides +# whether "profile/defines.h" is included or not. "profile/defines.h" +# replaces all MPI_* symbols with PMPI_* symbols. In this directory +# we definately need it to be 1. +# +AM_CPPFLAGS = -DOMPI_PROFILING_DEFINES=1 + +# +# This build needs to go through only if profiling is required. +# Further, this build HAS to go through if profiling is required. +# + +noinst_LTLIBRARIES = +if BUILD_PMPI_BINDINGS_LAYER +noinst_LTLIBRARIES += libmpi_pmpit.la +endif + +headers = defines.h + +nodist_libmpi_pmpit_la_SOURCES = \ + pcatagory_changed.c \ + pcatagory_get_catagories.c \ + pcatagory_get_cvars.c \ + pcatagory_get_info.c \ + pcatagory_get_num.c \ + pcatagory_get_pvars.c \ + pcvar_get_info.c \ + pcvar_get_num.c \ + pcvar_handle_alloc.c \ + pcvar_handle_free.c \ + pcvar_read.c \ + pcvar_write.c \ + penum_get_info.c \ + penum_get_item.c \ + pfinalize.c \ + pinit_thread.c \ + ppvar_get_info.c \ + ppvar_get_num.c \ + ppvar_handle_alloc.c \ + ppvar_handle_free.c \ + ppvar_read.c \ + ppvar_readreset.c \ + ppvar_reset.c \ + ppvar_session_create.c \ + ppvar_session_free.c \ + ppvar_start.c \ + ppvar_stop.c \ + ppvar_write.c + +# +# Sym link in the sources from the real MPI directory +# +$(nodist_libmpi_pmpit_la_SOURCES): + if test ! -r $@ ; then \ + pname=`echo $@ | cut -b '2-'` ; \ + $(LN_S) $(top_srcdir)/ompi/mpi/tool/$$pname $@ ; \ + fi + +# Conditionally install the header files + +if WANT_INSTALL_HEADERS +ompidir = $(includedir)/openmpi/$(subdir) +ompi_HEADERS = $(headers) +endif + +# These files were created by targets above + +MAINTAINERCLEANFILES = $(nodist_libmpi_pmpit_la_SOURCES) + +# Don't want these targets in here + +tags-recursive: +tags: +TAGS: +GTAGS: +ID: diff --git a/ompi/mpi/tool/profile/defines.h b/ompi/mpi/tool/profile/defines.h new file mode 100644 index 0000000000..afabc15146 --- /dev/null +++ b/ompi/mpi/tool/profile/defines.h @@ -0,0 +1,60 @@ +/* + * 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 (c) 2009-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2011 Sandia National Laboratories. All rights reserved. + * Copyright (c) 2012 Oak Rigde National Laboratory. All rights reserved. + * Copyright (c) 2013 Los Alamos National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef OMPIT_PROFILE_DEFINES_H +#define OMPIT_PROFILE_DEFINES_H +/* + * This file is included in the top directory only if + * profiling is required. Once profiling is required, + * this file will replace all MPI_* symbols with + * PMPI_* symbols + */ +#define MPI_T_category_changed PMPI_T_category_changed +#define MPI_T_category_get_categories PMPI_T_category_get_categories +#define MPI_T_category_get_cvars PMPI_T_category_get_cvars +#define MPI_T_category_get_info PMPI_T_category_get_info +#define MPI_T_category_get_num PMPI_T_category_get_num +#define MPI_T_category_get_pvars PMPI_T_category_get_pvars +#define MPI_T_cvar_get_info PMPI_T_cvar_get_info +#define MPI_T_cvar_get_num PMPI_T_cvar_get_num +#define MPI_T_cvar_handle_alloc PMPI_T_cvar_handle_alloc +#define MPI_T_cvar_handle_free PMPI_T_cvar_handle_free +#define MPI_T_cvar_read PMPI_T_cvar_read +#define MPI_T_cvar_write PMPI_T_cvar_write +#define MPI_T_enum_get_info PMPI_T_enum_get_info +#define MPI_T_enum_get_item PMPI_T_enum_get_item +#define MPI_T_finalize PMPI_T_finalize +#define MPI_T_init_thread PMPI_T_init_thread +#define MPI_T_pvar_get_info PMPI_T_pvar_get_info +#define MPI_T_pvar_get_num PMPI_T_pvar_get_num +#define MPI_T_pvar_handle_alloc PMPI_T_pvar_handle_alloc +#define MPI_T_pvar_handle_free PMPI_T_pvar_handle_free +#define MPI_T_pvar_read PMPI_T_pvar_read +#define MPI_T_pvar_readreset PMPI_T_pvar_readreset +#define MPI_T_pvar_reset PMPI_T_pvar_reset +#define MPI_T_pvar_session_create PMPI_T_pvar_session_create +#define MPI_T_pvar_session_free PMPI_T_pvar_session_free +#define MPI_T_pvar_start PMPI_T_pvar_start +#define MPI_T_pvar_stop PMPI_T_pvar_stop +#define MPI_T_pvar_write PMPI_T_pvar_write +#endif /* OMPIT_C_PROFILE_DEFINES_H */ diff --git a/ompi/mpit/pvar_get_info.c b/ompi/mpi/tool/pvar_get_info.c similarity index 90% rename from ompi/mpit/pvar_get_info.c rename to ompi/mpi/tool/pvar_get_info.c index fcccce8271..53ed772852 100644 --- a/ompi/mpit/pvar_get_info.c +++ b/ompi/mpi/tool/pvar_get_info.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_pvar_get_info = PMPI_T_pvar_get_info +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_pvar_get_info"; diff --git a/ompi/mpit/pvar_get_num.c b/ompi/mpi/tool/pvar_get_num.c similarity index 70% rename from ompi/mpit/pvar_get_num.c rename to ompi/mpi/tool/pvar_get_num.c index 3c355c1f25..bdaaed0b23 100644 --- a/ompi/mpit/pvar_get_num.c +++ b/ompi/mpi/tool/pvar_get_num.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_pvar_get_num = PMPI_T_pvar_get_num +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_pvar_get_num"; diff --git a/ompi/mpit/pvar_handle_alloc.c b/ompi/mpi/tool/pvar_handle_alloc.c similarity index 86% rename from ompi/mpit/pvar_handle_alloc.c rename to ompi/mpi/tool/pvar_handle_alloc.c index 15934be61a..cffe3a54f1 100644 --- a/ompi/mpit/pvar_handle_alloc.c +++ b/ompi/mpi/tool/pvar_handle_alloc.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_pvar_handle_alloc = PMPI_T_pvar_handle_alloc +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_pvar_handle_alloc"; diff --git a/ompi/mpit/pvar_handle_free.c b/ompi/mpi/tool/pvar_handle_free.c similarity index 82% rename from ompi/mpit/pvar_handle_free.c rename to ompi/mpi/tool/pvar_handle_free.c index eb6c642ede..75cfa5ba70 100644 --- a/ompi/mpit/pvar_handle_free.c +++ b/ompi/mpi/tool/pvar_handle_free.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_pvar_handle_free = PMPI_T_pvar_handle_free +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_pvar_handle_free"; diff --git a/ompi/mpit/pvar_read.c b/ompi/mpi/tool/pvar_read.c similarity index 73% rename from ompi/mpit/pvar_read.c rename to ompi/mpi/tool/pvar_read.c index 705a9efb63..52f61f5c0f 100644 --- a/ompi/mpit/pvar_read.c +++ b/ompi/mpi/tool/pvar_read.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_pvar_read = PMPI_T_pvar_read +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_pvar_read"; diff --git a/ompi/mpit/pvar_readreset.c b/ompi/mpi/tool/pvar_readreset.c similarity index 71% rename from ompi/mpit/pvar_readreset.c rename to ompi/mpi/tool/pvar_readreset.c index 9bd8b8e5f9..3832bd4ce9 100644 --- a/ompi/mpit/pvar_readreset.c +++ b/ompi/mpi/tool/pvar_readreset.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_pvar_readreset = PMPI_T_pvar_readreset +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_pvar_readreset"; diff --git a/ompi/mpit/pvar_reset.c b/ompi/mpi/tool/pvar_reset.c similarity index 81% rename from ompi/mpit/pvar_reset.c rename to ompi/mpi/tool/pvar_reset.c index bf685019c4..b3ebe9e085 100644 --- a/ompi/mpit/pvar_reset.c +++ b/ompi/mpi/tool/pvar_reset.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_pvar_reset = PMPI_T_pvar_reset +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_pvar_reset"; diff --git a/ompi/mpit/pvar_session_create.c b/ompi/mpi/tool/pvar_session_create.c similarity index 74% rename from ompi/mpit/pvar_session_create.c rename to ompi/mpi/tool/pvar_session_create.c index ecdc98cfe7..fece47e492 100644 --- a/ompi/mpit/pvar_session_create.c +++ b/ompi/mpi/tool/pvar_session_create.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_pvar_session_create = PMPI_T_pvar_session_create +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_pvar_session_create"; diff --git a/ompi/mpit/pvar_session_free.c b/ompi/mpi/tool/pvar_session_free.c similarity index 70% rename from ompi/mpit/pvar_session_free.c rename to ompi/mpi/tool/pvar_session_free.c index 6b9df1fa28..2c7aa19b0f 100644 --- a/ompi/mpit/pvar_session_free.c +++ b/ompi/mpi/tool/pvar_session_free.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_pvar_session_free = PMPI_T_pvar_session_free +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_pvar_session_free"; diff --git a/ompi/mpit/pvar_start.c b/ompi/mpi/tool/pvar_start.c similarity index 84% rename from ompi/mpit/pvar_start.c rename to ompi/mpi/tool/pvar_start.c index cd913fa3d8..8c45edb66b 100644 --- a/ompi/mpit/pvar_start.c +++ b/ompi/mpi/tool/pvar_start.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_pvar_start = PMPI_T_pvar_start +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_pvar_start"; diff --git a/ompi/mpit/pvar_stop.c b/ompi/mpi/tool/pvar_stop.c similarity index 85% rename from ompi/mpit/pvar_stop.c rename to ompi/mpi/tool/pvar_stop.c index e4ae8d672d..5f8ee1dddd 100644 --- a/ompi/mpit/pvar_stop.c +++ b/ompi/mpi/tool/pvar_stop.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_pvar_stop = PMPI_T_pvar_stop +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_pvar_stop"; diff --git a/ompi/mpit/pvar_write.c b/ompi/mpi/tool/pvar_write.c similarity index 73% rename from ompi/mpit/pvar_write.c rename to ompi/mpi/tool/pvar_write.c index a82ab3e345..0ce1d75fba 100644 --- a/ompi/mpit/pvar_write.c +++ b/ompi/mpi/tool/pvar_write.c @@ -9,7 +9,15 @@ * $HEADER$ */ -#include "ompi/mpit/mpit-internal.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES +#pragma weak MPI_T_pvar_write = PMPI_T_pvar_write +#endif + +#if OMPI_PROFILING_DEFINES +#include "ompi/mpi/tool/profile/defines.h" +#endif static const char FUNC_NAME[] = "MPI_T_pvar_write"; diff --git a/ompi/mpit/Makefile.am b/ompi/mpit/Makefile.am deleted file mode 100644 index 2fb7731429..0000000000 --- a/ompi/mpit/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -# -*- makefile -*- -# -# Copyright (c) 2004-2006 The University of Tennessee and The University -# of Tennessee Research Foundation. All rights -# reserved. -# Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, -# University of Stuttgart. All rights reserved. -# Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights -# reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# This Makefile.am does not stand on its own - it is included from ompi/Makefile.am - -headers += mpit/mpit-internal.h mpit/mpit-pvar.h - -libmpi_la_SOURCES += mpit/init_thread.c mpit/finalize.c mpit/cvar_get_num.c \ - mpit/cvar_get_info.c mpit/cvar_read.c mpit/cvar_write.c \ - mpit/cvar_handle_alloc.c mpit/cvar_handle_free.c \ - mpit/catagory_get_num.c mpit/catagory_get_info.c \ - mpit/catagory_get_cvars.c mpit/catagory_get_pvars.c \ - mpit/catagory_get_catagories.c mpit/catagory_changed.c \ - mpit/pvar_get_info.c mpit/pvar_get_num.c mpit/pvar_handle_alloc.c \ - mpit/pvar_handle_free.c mpit/pvar_read.c mpit/pvar_readreset.c \ - mpit/pvar_reset.c mpit/pvar_session_create.c mpit/pvar_session_free.c \ - mpit/pvar_start.c mpit/pvar_stop.c mpit/pvar_write.c \ - mpit/enum_get_info.c mpit/enum_get_item.c