Permalink
Browse files

Add initial support for the MPI 3.0 tools interface (MPI_T).

Currently MPI_T support:
 - Full cvar interface.
 - Full categories interface.
 - No pvar support at this time.
  • Loading branch information...
1 parent b7229df commit 689d7d5d95f982794bcba8afb385cdce80bf75e1 @hjelmn committed Mar 9, 2013
Showing with 1,477 additions and 131 deletions.
  1. +1 −0 ompi/Makefile.am
  2. +128 −2 ompi/include/mpi.h.in
  3. +17 −1 ompi/include/mpif-values.pl
  4. +31 −0 ompi/mpit/Makefile.am
  5. +27 −0 ompi/mpit/catagory_changed.c
  6. +47 −0 ompi/mpit/catagory_get_catagories.c
  7. +47 −0 ompi/mpit/catagory_get_cvars.c
  8. +56 −0 ompi/mpit/catagory_get_info.c
  9. +31 −0 ompi/mpit/catagory_get_num.c
  10. +24 −0 ompi/mpit/catagory_get_pvars.c
  11. +85 −0 ompi/mpit/cvar_get_info.c
  12. +30 −0 ompi/mpit/cvar_get_num.c
  13. +66 −0 ompi/mpit/cvar_handle_alloc.c
  14. +24 −0 ompi/mpit/cvar_handle_free.c
  15. +69 −0 ompi/mpit/cvar_read.c
  16. +83 −0 ompi/mpit/cvar_write.c
  17. +41 −0 ompi/mpit/enum_get_info.c
  18. +52 −0 ompi/mpit/enum_get_item.c
  19. +36 −0 ompi/mpit/finalize.c
  20. +82 −0 ompi/mpit/init_thread.c
  21. +78 −0 ompi/mpit/mpit-internal.h
  22. +27 −0 ompi/mpit/pvar_get_info.c
  23. +31 −0 ompi/mpit/pvar_get_num.c
  24. +25 −0 ompi/mpit/pvar_handle_alloc.c
  25. +24 −0 ompi/mpit/pvar_handle_free.c
  26. +25 −0 ompi/mpit/pvar_read.c
  27. +25 −0 ompi/mpit/pvar_readreset.c
  28. +24 −0 ompi/mpit/pvar_reset.c
  29. +24 −0 ompi/mpit/pvar_session_create.c
  30. +24 −0 ompi/mpit/pvar_session_free.c
  31. +24 −0 ompi/mpit/pvar_start.c
  32. +24 −0 ompi/mpit/pvar_stop.c
  33. +25 −0 ompi/mpit/pvar_write.c
  34. +4 −2 ompi/runtime/Makefile.am
  35. +8 −0 ompi/runtime/mpiruntime.h
  36. +31 −24 ompi/runtime/ompi_mpi_init.c
  37. +0 −54 ompi/tools/ompi_info/components.c
  38. +45 −23 opal/runtime/opal_info_support.c
  39. +4 −0 opal/runtime/opal_info_support.h
  40. +28 −25 orte/runtime/orte_info_support.c
View
@@ -180,6 +180,7 @@ 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
View
@@ -328,6 +328,10 @@ typedef struct ompi_request_t *MPI_Request;
typedef struct ompi_message_t *MPI_Message;
typedef struct ompi_status_public_t MPI_Status;
typedef struct ompi_win_t *MPI_Win;
+typedef struct mca_base_var_enum_t *MPI_T_enum;
+typedef struct ompi_mpit_cvar_handle_t *MPI_T_cvar_handle;
+typedef struct ompi_mpit_pvar_handle_t *MPI_T_pvar_handle;
+typedef struct ompi_mpit_pvar_session_t *MPI_T_pvar_session;
/*
* MPI_Status
@@ -562,10 +566,24 @@ enum {
#define MPI_ERR_UNSUPPORTED_DATAREP 51
#define MPI_ERR_UNSUPPORTED_OPERATION 52
#define MPI_ERR_WIN 53
+#define MPI_T_ERR_MEMORY 54
+#define MPI_T_ERR_NOT_INITIALIZED 55
+#define MPI_T_ERR_CANNOT_INIT 56
+#define MPI_T_ERR_INVALID_INDEX 57
+#define MPI_T_ERR_INVALID_ITEM 58
+#define MPI_T_ERR_INVALID_HANDLE 59
+#define MPI_T_ERR_OUT_OF_HANDLES 60
+#define MPI_T_ERR_OUT_OF_SESSIONS 61
+#define MPI_T_ERR_INVALID_SESSION 62
+#define MPI_T_ERR_CVAR_SET_NOT_NOW 63
+#define MPI_T_ERR_CVAR_SET_NEVER 64
+#define MPI_T_ERR_PVAR_NO_STARTSTOP 65
+#define MPI_T_ERR_PVAR_NO_WRITE 66
+#define MPI_T_ERR_PVAR_NO_ATOMIC 67
/* Per MPI-3 p349 47, MPI_ERR_LASTCODE must be >= the last predefined
MPI_ERR_<foo> code. So just set it equal to the last code --
- MPI_ERR_WIN, in this case. */
-#define MPI_ERR_LASTCODE MPI_ERR_WIN
+ MPI_T_ERR_PVAR_NO_ATOMIC, in this case. */
+#define MPI_ERR_LASTCODE MPI_T_ERR_PVAR_NO_ATOMIC
#define MPI_ERR_SYSRESOURCE -2
@@ -629,6 +647,66 @@ enum {
MPI_COMM_TYPE_SHARED
};
+/*
+ * MPIT Verbosity Levels
+ */
+enum {
+ MPI_T_VERBOSITY_USER_BASIC,
+ MPI_T_VERBOSITY_USER_DETAIL,
+ MPI_T_VERBOSITY_USER_ALL,
+ MPI_T_VERBOSITY_TUNER_BASIC,
+ MPI_T_VERBOSITY_TUNER_DETAIL,
+ MPI_T_VERBOSITY_TUNER_ALL,
+ MPI_T_VERBOSITY_MPIDEV_BASIC,
+ MPI_T_VERBOSITY_MPIDEV_DETAIL,
+ MPI_T_VERBOSITY_MPIDEV_ALL
+};
+
+/*
+ * MPIT Scopes
+ */
+enum {
+ MPI_T_SCOPE_CONSTANT,
+ MPI_T_SCOPE_READONLY,
+ MPI_T_SCOPE_LOCAL,
+ MPI_T_SCOPE_GROUP,
+ MPI_T_SCOPE_GROUP_EQ,
+ MPI_T_SCOPE_ALL,
+ MPI_T_SCOPE_ALL_EQ
+};
+
+/*
+ * MPIT Object Binding
+ */
+enum {
+ MPI_T_BIND_NO_OBJECT,
+ MPI_T_BIND_MPI_COMM,
+ MPI_T_BIND_MPI_DATATYPE,
+ MPI_T_BIND_MPI_ERRHANDLER,
+ MPI_T_BIND_MPI_FILE,
+ MPI_T_BIND_MPI_GROUP,
+ MPI_T_BIND_MPI_OP,
+ MPI_T_BIND_MPI_REQUEST,
+ MPI_T_BIND_MPI_WIN,
+ MPI_T_BIND_MPI_MESSAGE,
+ MPI_T_BIND_MPI_INFO
+};
+
+/*
+ * MPIT pvar classes
+ */
+enum {
+ MPI_T_PVAR_CLASS_STATE,
+ MPI_T_PVAR_CLASS_LEVEL,
+ MPI_T_PVAR_CLASS_SIZE,
+ MPI_T_PVAR_CLASS_PERCENTAGE,
+ MPI_T_PVAR_CLASS_HIGHWATERMARK,
+ MPI_T_PVAR_CLASS_LOWWATERMARK,
+ MPI_T_PVAR_CLASS_COUNTER,
+ MPI_T_PVAR_CLASS_AGGREGATE,
+ MPI_T_PVAR_CLASS_TIMER,
+ MPI_T_PVAR_CLASS_GENERIC
+};
/*
* NULL handles
@@ -644,6 +722,7 @@ enum {
#if OMPI_PROVIDE_MPI_FILE_INTERFACE
#define MPI_FILE_NULL OMPI_PREDEFINED_GLOBAL(MPI_File, ompi_mpi_file_null)
#endif
+#define MPI_T_ENUM_NULL NULL
/*
* MPI_INFO_ENV handle
@@ -2224,6 +2303,53 @@ OMPI_DECLSPEC int PMPI_Win_wait(MPI_Win win);
OMPI_DECLSPEC double PMPI_Wtick(void);
OMPI_DECLSPEC double PMPI_Wtime(void);
+ /*
+ * Tool MPI API
+ */
+OMPI_DECLSPEC int MPI_T_init_thread (int required, int *provided);
+OMPI_DECLSPEC int MPI_T_finalize (void);
+OMPI_DECLSPEC int MPI_T_cvar_get_num (int *num_cvar);
+OMPI_DECLSPEC int MPI_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 MPI_T_cvar_handle_alloc (int cvar_index, void *obj_handle,
+ MPI_T_cvar_handle *handle, int *count);
+OMPI_DECLSPEC int MPI_T_cvar_handle_free (MPI_T_cvar_handle *handle);
+OMPI_DECLSPEC int MPI_T_cvar_read (MPI_T_cvar_handle handle, void *buf);
+OMPI_DECLSPEC int MPI_T_cvar_write (MPI_T_cvar_handle handle, const void *buf);
+OMPI_DECLSPEC int MPI_T_category_get_num(int *num_cat);
+OMPI_DECLSPEC int MPI_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 MPI_T_category_get_cvars(int cat_index, int len, int indices[]);
+OMPI_DECLSPEC int MPI_T_category_get_pvars(int cat_index, int len, int indices[]);
+OMPI_DECLSPEC int MPI_T_category_get_categories(int cat_index, int len, int indices[]);
+OMPI_DECLSPEC int MPI_T_category_changed(int *stamp);
+
+OMPI_DECLSPEC int MPI_T_pvar_get_num(int *num_pvar);
+OMPI_DECLSPEC int MPI_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 MPI_T_pvar_session_create(MPI_T_pvar_session *session);
+OMPI_DECLSPEC int MPI_T_pvar_session_free(MPI_T_pvar_session *session);
+OMPI_DECLSPEC int MPI_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 MPI_T_pvar_handle_free(MPI_T_pvar_session session, MPI_T_pvar_handle *handle);
+OMPI_DECLSPEC int MPI_T_pvar_start(MPI_T_pvar_session session, MPI_T_pvar_handle handle);
+OMPI_DECLSPEC int MPI_T_pvar_stop(MPI_T_pvar_session session, MPI_T_pvar_handle handle);
+OMPI_DECLSPEC int MPI_T_pvar_read(MPI_T_pvar_session session, MPI_T_pvar_handle handle,
+ void *buf);
+OMPI_DECLSPEC int MPI_T_pvar_write(MPI_T_pvar_session session, MPI_T_pvar_handle handle,
+ const void *buf);
+OMPI_DECLSPEC int MPI_T_pvar_reset(MPI_T_pvar_session session, MPI_T_pvar_handle handle);
+OMPI_DECLSPEC int MPI_T_pvar_readreset(MPI_T_pvar_session session, MPI_T_pvar_handle handle,
+ void *buf);
+OMPI_DECLSPEC int MPI_T_enum_get_info(MPI_T_enum enumtype, int *num, char *name, int *name_len);
+OMPI_DECLSPEC int MPI_T_enum_get_item(MPI_T_enum enumtype, int index, int *value, char *name,
+ int *name_len);
+
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
@@ -299,7 +299,23 @@ sub write_file {
$constants->{MPI_ERR_UNSUPPORTED_DATAREP} = 51;
$constants->{MPI_ERR_UNSUPPORTED_OPERATION} = 52;
$constants->{MPI_ERR_WIN} = 53;
-$constants->{MPI_ERR_LASTCODE} = $constants->{MPI_ERR_WIN};
+# these error codes will never be returned by a fortran function
+# since there are no fortran bindings for MPI_T
+$constants->{MPI_T_ERR_MEMORY} = 54;
+$constants->{MPI_T_ERR_NOT_INITIALIZED} = 55;
+$constants->{MPI_T_ERR_CANNOT_INIT} = 56;
+$constants->{MPI_T_ERR_INVALID_INDEX} = 57;
+$constants->{MPI_T_ERR_INVALID_ITEM} = 58;
+$constants->{MPI_T_ERR_INVALID_HANDLE} = 59;
+$constants->{MPI_T_ERR_OUT_OF_HANDLES} = 60;
+$constants->{MPI_T_ERR_OUT_OF_SESSIONS} = 61;
+$constants->{MPI_T_ERR_INVALID_SESSION} = 62;
+$constants->{MPI_T_ERR_CVAR_SET_NOT_NOW} = 63;
+$constants->{MPI_T_ERR_CVAR_SET_NEVER} = 64;
+$constants->{MPI_T_ERR_PVAR_NO_STARTSTOP} = 65;
+$constants->{MPI_T_ERR_PVAR_NO_WRITE} = 66;
+$constants->{MPI_T_ERR_PVAR_NO_ATOMIC} = 67;
+$constants->{MPI_ERR_LASTCODE} = $constants->{MPI_T_ERR_PVAR_NO_ATOMIC};
$constants->{MPI_ERR_SYSRESOURCE} = -2;
View
@@ -0,0 +1,31 @@
+# -*- 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
+
+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
@@ -0,0 +1,27 @@
+/* -*- 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/mpit/mpit-internal.h"
+
+static const char FUNC_NAME[] = "MPI_T_category_changed";
+
+int MPI_T_category_changed(int *stamp)
+{
+ if (!mpit_is_initialized ()) {
+ return MPI_T_ERR_NOT_INITIALIZED;
+ }
+
+ mpit_lock ();
+ *stamp = mca_base_var_group_get_stamp ();
+ mpit_unlock ();
+
+ return MPI_SUCCESS;
+}
@@ -0,0 +1,47 @@
+/* -*- 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/mpit/mpit-internal.h"
+
+static const char FUNC_NAME[] = "MPI_T_category_get_categories";
+
+int MPI_T_category_get_categories(int cat_index, int len, int indices[])
+{
+ const mca_base_var_group_t *group;
+ const int *subgroups;
+ int rc = MPI_SUCCESS;
+ int i, size;
+
+ if (!mpit_is_initialized ()) {
+ return MPI_T_ERR_NOT_INITIALIZED;
+ }
+
+ mpit_lock ();
+
+ do {
+ rc = mca_base_var_group_get (cat_index, &group);
+ if (0 > rc) {
+ rc = (OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX : MPI_ERR_OTHER;
+ break;
+ }
+
+ size = opal_value_array_get_size((opal_value_array_t *) &group->group_subgroups);
+ subgroups = OPAL_VALUE_ARRAY_GET_BASE(&group->group_subgroups, int);
+
+ for (i = 0 ; i < len && i < size ; ++i) {
+ indices[i] = subgroups[i];
+ }
+ } while (0);
+
+ mpit_unlock ();
+
+ return rc;
+}
@@ -0,0 +1,47 @@
+/* -*- 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/mpit/mpit-internal.h"
+
+static const char FUNC_NAME[] = "MPI_T_category_get_cvars";
+
+int MPI_T_category_get_cvars(int cat_index, int len, int indices[])
+{
+ const mca_base_var_group_t *group;
+ int rc = MPI_SUCCESS;
+ const int *vars;
+ int i, size;
+
+ if (!mpit_is_initialized ()) {
+ return MPI_T_ERR_NOT_INITIALIZED;
+ }
+
+ mpit_lock ();
+
+ do {
+ rc = mca_base_var_group_get (cat_index, &group);
+ if (0 > rc) {
+ rc = (OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX : MPI_ERR_OTHER;
+ break;
+ }
+
+ size = opal_value_array_get_size((opal_value_array_t *) &group->group_vars);
+ vars = OPAL_VALUE_ARRAY_GET_BASE(&group->group_vars, int);
+
+ for (i = 0 ; i < len && i < size ; ++i) {
+ indices[i] = vars[i];
+ }
+ } while (0);
+
+ mpit_unlock ();
+
+ return rc;
+}
Oops, something went wrong.

0 comments on commit 689d7d5

Please sign in to comment.