Skip to content

Commit

Permalink
Add initial support for the MPI 3.0 tools interface (MPI_T).
Browse files Browse the repository at this point in the history
Currently MPI_T support:
 - Full cvar interface.
 - Full categories interface.
 - No pvar support at this time.
  • Loading branch information
hjelmn committed Apr 5, 2013
1 parent b7229df commit 689d7d5
Show file tree
Hide file tree
Showing 40 changed files with 1,477 additions and 131 deletions.
1 change: 1 addition & 0 deletions ompi/Makefile.am
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ include tools/Makefile.am
include mpi/Makefile.am include mpi/Makefile.am
include mpi/man/man3/Makefile.extra include mpi/man/man3/Makefile.extra
include mpiext/Makefile.am include mpiext/Makefile.am
include mpit/Makefile.am
include patterns/net/Makefile.am include patterns/net/Makefile.am
include patterns/comm/Makefile.am include patterns/comm/Makefile.am


Expand Down
130 changes: 128 additions & 2 deletions ompi/include/mpi.h.in
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ typedef struct ompi_request_t *MPI_Request;
typedef struct ompi_message_t *MPI_Message; typedef struct ompi_message_t *MPI_Message;
typedef struct ompi_status_public_t MPI_Status; typedef struct ompi_status_public_t MPI_Status;
typedef struct ompi_win_t *MPI_Win; 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 * MPI_Status
Expand Down Expand Up @@ -562,10 +566,24 @@ enum {
#define MPI_ERR_UNSUPPORTED_DATAREP 51 #define MPI_ERR_UNSUPPORTED_DATAREP 51
#define MPI_ERR_UNSUPPORTED_OPERATION 52 #define MPI_ERR_UNSUPPORTED_OPERATION 52
#define MPI_ERR_WIN 53 #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 /* 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_<foo> code. So just set it equal to the last code --
MPI_ERR_WIN, in this case. */ MPI_T_ERR_PVAR_NO_ATOMIC, in this case. */
#define MPI_ERR_LASTCODE MPI_ERR_WIN #define MPI_ERR_LASTCODE MPI_T_ERR_PVAR_NO_ATOMIC


#define MPI_ERR_SYSRESOURCE -2 #define MPI_ERR_SYSRESOURCE -2


Expand Down Expand Up @@ -629,6 +647,66 @@ enum {
MPI_COMM_TYPE_SHARED 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 * NULL handles
Expand All @@ -644,6 +722,7 @@ enum {
#if OMPI_PROVIDE_MPI_FILE_INTERFACE #if OMPI_PROVIDE_MPI_FILE_INTERFACE
#define MPI_FILE_NULL OMPI_PREDEFINED_GLOBAL(MPI_File, ompi_mpi_file_null) #define MPI_FILE_NULL OMPI_PREDEFINED_GLOBAL(MPI_File, ompi_mpi_file_null)
#endif #endif
#define MPI_T_ENUM_NULL NULL


/* /*
* MPI_INFO_ENV handle * MPI_INFO_ENV handle
Expand Down Expand Up @@ -2224,6 +2303,53 @@ OMPI_DECLSPEC int PMPI_Win_wait(MPI_Win win);
OMPI_DECLSPEC double PMPI_Wtick(void); OMPI_DECLSPEC double PMPI_Wtick(void);
OMPI_DECLSPEC double PMPI_Wtime(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) #if defined(c_plusplus) || defined(__cplusplus)
} }
#endif #endif
Expand Down
18 changes: 17 additions & 1 deletion ompi/include/mpif-values.pl
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -299,7 +299,23 @@ sub write_file {
$constants->{MPI_ERR_UNSUPPORTED_DATAREP} = 51; $constants->{MPI_ERR_UNSUPPORTED_DATAREP} = 51;
$constants->{MPI_ERR_UNSUPPORTED_OPERATION} = 52; $constants->{MPI_ERR_UNSUPPORTED_OPERATION} = 52;
$constants->{MPI_ERR_WIN} = 53; $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; $constants->{MPI_ERR_SYSRESOURCE} = -2;


Expand Down
31 changes: 31 additions & 0 deletions ompi/mpit/Makefile.am
Original file line number Original file line Diff line number Diff line change
@@ -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
27 changes: 27 additions & 0 deletions ompi/mpit/catagory_changed.c
Original file line number Original file line Diff line number Diff line change
@@ -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;
}
47 changes: 47 additions & 0 deletions ompi/mpit/catagory_get_catagories.c
Original file line number Original file line Diff line number Diff line change
@@ -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;
}
47 changes: 47 additions & 0 deletions ompi/mpit/catagory_get_cvars.c
Original file line number Original file line Diff line number Diff line change
@@ -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;
}
Loading

0 comments on commit 689d7d5

Please sign in to comment.