Commit 39e5fa15 authored by Junchao Zhang's avatar Junchao Zhang Committed by Pavan Balaji
Browse files

Primary implementation of MPI_T specified in MPI3



Implemented the framework for MPI_T enums, categories, performance variables.
and control variables specified in MPI3. Fix #1898, #1930.

The code should make MPICH MPI_T compliant, though not all MPICH pvars/cvars
are currently exposed through MPI_T.

The code supports multithreading up to MPI_THREAD_MULTIPLE.
Signed-off-by: Pavan Balaji's avatarPavan Balaji <balaji@mcs.anl.gov>
parent 7ff6a970
......@@ -569,17 +569,18 @@ typedef struct MPI_Status {
} MPI_Status;
/* types for the MPI_T_ interface */
struct MPIR_T_enum;
typedef struct MPIR_T_enum * MPI_T_enum;
struct MPIR_T_cvar_handle;
typedef struct MPIR_T_cvar_handle * MPI_T_cvar_handle;
struct MPIR_T_pvar_handle;
typedef struct MPIR_T_pvar_handle * MPI_T_pvar_handle;
struct MPIR_T_pvar_session;
typedef struct MPIR_T_pvar_session * MPI_T_pvar_session;
struct MPIR_T_enum_s;
struct MPIR_T_cvar_handle_s;
struct MPIR_T_pvar_handle_s;
struct MPIR_T_pvar_session_s;
typedef struct MPIR_T_enum_s * MPI_T_enum;
typedef struct MPIR_T_cvar_handle_s * MPI_T_cvar_handle;
typedef struct MPIR_T_pvar_handle_s * MPI_T_pvar_handle;
typedef struct MPIR_T_pvar_session_s * MPI_T_pvar_session;
/* extra const at front would be safer, but is incompatible with MPI_T_ prototypes */
extern struct MPIR_T_pvar_handle * const MPI_T_PVAR_ALL_HANDLES;
extern struct MPIR_T_pvar_handle_s * const MPI_T_PVAR_ALL_HANDLES;
#define MPI_T_ENUM_NULL ((MPI_T_enum)NULL)
#define MPI_T_CVAR_HANDLE_NULL ((MPI_T_cvar_handle)NULL)
......@@ -588,7 +589,7 @@ extern struct MPIR_T_pvar_handle * const MPI_T_PVAR_ALL_HANDLES;
/* the MPI_T_ interface requires that these VERBOSITY constants occur in this
* relative order with increasing values */
enum MPIR_T_verbosity_t {
typedef enum MPIR_T_verbosity_t {
/* don't name-shift this if/when MPI_T_ is accepted, this is an MPICH-only
* extension */
MPIX_T_VERBOSITY_INVALID = 0,
......@@ -605,9 +606,9 @@ enum MPIR_T_verbosity_t {
MPI_T_VERBOSITY_MPIDEV_BASIC,
MPI_T_VERBOSITY_MPIDEV_DETAIL,
MPI_T_VERBOSITY_MPIDEV_ALL
};
} MPIR_T_verbosity_t;
enum MPIR_T_bind_t {
typedef enum MPIR_T_bind_t {
/* don't name-shift this if/when MPI_T_ is accepted, this is an MPICH-only
* extension */
MPIX_T_BIND_INVALID = 0,
......@@ -624,9 +625,9 @@ enum MPIR_T_bind_t {
MPI_T_BIND_MPI_WIN,
MPI_T_BIND_MPI_MESSAGE,
MPI_T_BIND_MPI_INFO
};
} MPIR_T_bind_t;
enum MPIR_T_scope_t {
typedef enum MPIR_T_scope_t {
/* don't name-shift this if/when MPI_T_ is accepted, this is an MPICH-only
* extension */
MPIX_T_SCOPE_INVALID = 0,
......@@ -639,15 +640,16 @@ enum MPIR_T_scope_t {
MPI_T_SCOPE_GROUP_EQ,
MPI_T_SCOPE_ALL,
MPI_T_SCOPE_ALL_EQ
};
} MPIR_T_scope_t;
enum MPIR_T_pvar_class_t {
typedef enum MPIR_T_pvar_class_t {
/* don't name-shift this if/when MPI_T_ is accepted, this is an MPICH-only
* extension */
MPIX_T_PVAR_CLASS_INVALID = 0,
/* arbitrarily shift values to aid debugging and reduce accidental errors */
MPI_T_PVAR_CLASS_STATE = 240,
MPIR_T_PVAR_CLASS_FIRST = 240,
MPI_T_PVAR_CLASS_STATE = MPIR_T_PVAR_CLASS_FIRST,
MPI_T_PVAR_CLASS_LEVEL,
MPI_T_PVAR_CLASS_SIZE,
MPI_T_PVAR_CLASS_PERCENTAGE,
......@@ -656,8 +658,10 @@ enum MPIR_T_pvar_class_t {
MPI_T_PVAR_CLASS_COUNTER,
MPI_T_PVAR_CLASS_AGGREGATE,
MPI_T_PVAR_CLASS_TIMER,
MPI_T_PVAR_CLASS_GENERIC
};
MPI_T_PVAR_CLASS_GENERIC,
MPIR_T_PVAR_CLASS_LAST,
MPIR_T_PVAR_CLASS_NUMBER = MPIR_T_PVAR_CLASS_LAST - MPIR_T_PVAR_CLASS_FIRST
} MPIR_T_pvar_class_t;
/* Handle conversion types/functions */
......
......@@ -3515,116 +3515,8 @@ typedef struct MPID_Grequest_class {
} MPID_Grequest_class;
/* types and other internal defintions that must be kept out of mpi.h */
/* forward decls */
struct MPIR_T_pvar_info;
struct MPIR_T_enum {
/* TODO replace this struct's contents with a real implementation once we
* actually have/support an enum type */
int dummy;
};
struct MPIR_T_cvar_handle {
struct MPIR_Param_t *p;
};
struct MPIR_T_pvar_session {
/* a utlist-managed list (see mpl_utlist.h) -- _must_ be initialized to NULL
* at alloc time or the macros won't work */
struct MPIR_T_pvar_handle *hlist;
/* TODO does anything else need to go in here at this stage? */
};
typedef int MPIR_T_pvar_handle_creator_fn(void *obj_handle,
struct MPIR_T_pvar_handle *handle,
int *countp);
enum MPIR_T_pvar_impl_kind {
/* generic read/write impl is fine, just deref pointer */
MPIR_T_PVAR_IMPL_SIMPLE,
/* read/write are dispatched to callbacks to load/store variable values */
MPIR_T_PVAR_IMPL_CB
};
/* These are descriptors that lower level intialization code creates and feeds
* into the overall MPI_T_pvar_ system in order to permit the upper level code
* to implement MPI_T_pvar_{get_num,get_info,handle_alloc}. */
struct MPIR_T_pvar_info {
int idx; /* pvar index value for pvar_get_info and friends */
/* fields for get_info */
char *name;
enum MPIR_T_verbosity_t verbosity;
enum MPIR_T_pvar_class_t varclass;
MPI_Datatype dtype;
struct MPIR_T_enum *etype;
char *desc;
enum MPIR_T_bind_t binding;
int readonly;
int continuous;
int atomic;
/* fields for handle_alloc */
enum MPIR_T_pvar_impl_kind impl_kind;
void *var_state;
MPIR_T_pvar_handle_creator_fn *create_fn;
};
struct MPIR_T_pvar_handle {
/* for linked list of handles attached to the pvar_session */
struct MPIR_T_pvar_handle *next;
struct MPIR_T_pvar_handle *prev;
struct MPIR_T_pvar_info *info;
struct MPIR_T_pvar_session *session;
int count;
int bytes; /* for _IMPL_SIMPLE */
/* for _IMPL_CB types this vtable prevents us from having to duplicate
* multiple sets of function pointers in each handle at the expense of an
* extra pointer indirection */
struct MPIR_T_pvar_hnd_vtable *vtable;
void *handle_state;
int free_handle_state; /* boolean -- true iff the "handle_state" pointer
* should be freed when this handle is freed */
};
/* vtable structure for handle "objects". Implements all major handle operations */
struct MPIR_T_pvar_hnd_vtable {
int (*free)(struct MPIR_T_pvar_session *session, struct MPIR_T_pvar_handle *handle);
int (*start)(struct MPIR_T_pvar_session *session, struct MPIR_T_pvar_handle *handle);
int (*stop)(struct MPIR_T_pvar_session *session, struct MPIR_T_pvar_handle *handle);
int (*read)(struct MPIR_T_pvar_session *session, struct MPIR_T_pvar_handle *handle, void *buf);
int (*write)(struct MPIR_T_pvar_session *session, struct MPIR_T_pvar_handle *handle, void *buf);
int (*reset)(struct MPIR_T_pvar_session *session, struct MPIR_T_pvar_handle *handle);
int (*readreset)(struct MPIR_T_pvar_session *session, struct MPIR_T_pvar_handle *handle, void *buf);
};
/* Called by lower-level initialization code to add pvars to the global list.
* Will cause the value returned by MPI_T_pvar_get_num to be incremented and
* sets up that new index to work with get_info, handle_alloc, etc. */
int MPIR_T_pvar_add(const char *name,
enum MPIR_T_verbosity_t verbosity,
enum MPIR_T_pvar_class_t varclass,
MPI_Datatype dtype,
struct MPIR_T_enum *enumtype,
const char *desc,
enum MPIR_T_bind_t bind,
int readonly,
int continuous,
int atomic,
enum MPIR_T_pvar_impl_kind impl_kind,
void *var_state,
MPIR_T_pvar_handle_creator_fn *create_fn,
int *index_p);
int MPIR_T_get_num_pvars(int *num);
int MPIR_T_get_pvar_info_by_idx(int idx, struct MPIR_T_pvar_info **info_p);
int MPIR_T_finalize_pvars(void);
void MPIU_Tool_strncpy(char *dst, const char *src, int *len);
/* Interfaces exposed by MPI_T */
#include "mpit.h"
/*TTopoOverview.tex
*
......@@ -4288,18 +4180,9 @@ int MPIR_Ialltoallw_intra(const void *sendbuf, const int *sendcounts, const int
int MPIR_Ialltoallw_inter(const void *sendbuf, const int *sendcounts, const int *sdispls, const MPI_Datatype *sendtypes, void *recvbuf, const int *recvcounts, const int *rdispls, const MPI_Datatype *recvtypes, MPID_Comm *comm_ptr, MPID_Sched_t s);
/* begin impl functions for MPI_T (MPI_T_ right now) */
int MPIR_T_init_thread_impl(int required, int *provided);
int MPIR_T_finalize_impl(void);
int MPIR_T_enum_get_info_impl(MPI_T_enum enumtype, int *num, char *name, int *name_len);
int MPIR_T_enum_get_item_impl(MPI_T_enum enumtype, int num, int *value, char *name, int *name_len);
int MPIR_T_cvar_get_num_impl(int *num_cvar);
int MPIR_T_cvar_get_info_impl(int cvar_index, char *name, int *name_len, int *verbosity, MPI_Datatype *datatype, MPI_T_enum *enumtype, char *desc, int *desc_len, int *binding, int *scope);
int MPIR_T_cvar_handle_alloc_impl(int cvar_index, void *obj_handle, MPI_T_cvar_handle *handle, int *count);
int MPIR_T_cvar_handle_free_impl(MPI_T_cvar_handle *handle);
int MPIR_T_cvar_read_impl(MPI_T_cvar_handle handle, void *buf);
int MPIR_T_cvar_write_impl(MPI_T_cvar_handle handle, void *buf);
int MPIR_T_pvar_get_num_impl(int *num_pvar);
int MPIR_T_pvar_get_info_impl(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 *binding, int *readonly, int *continuous, int *atomic);
int MPIR_T_pvar_session_create_impl(MPI_T_pvar_session *session);
int MPIR_T_pvar_session_free_impl(MPI_T_pvar_session *session);
int MPIR_T_pvar_handle_alloc_impl(MPI_T_pvar_session session, int pvar_index, void *obj_handle, MPI_T_pvar_handle *handle, int *count);
......@@ -4310,12 +4193,9 @@ int MPIR_T_pvar_read_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle,
int MPIR_T_pvar_write_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf);
int MPIR_T_pvar_reset_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle);
int MPIR_T_pvar_readreset_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf);
int MPIR_T_category_get_num_impl(int *num_cat);
int MPIR_T_category_get_info_impl(int cat_index, char *name, int *name_len, char *desc, int *desc_len, int *num_controlvars, int *num_pvars, int *num_categories);
int MPIR_T_category_get_cvars_impl(int cat_index, int len, int indices[]);
int MPIR_T_category_get_pvars_impl(int cat_index, int len, int indices[]);
int MPIR_T_category_get_categories_impl(int cat_index, int len, int indices[]);
int MPIR_T_category_changed_impl(int *stamp);
/* end impl functions for MPI_T (MPI_T_ right now) */
/* MPI-3 "large count" impl routines */
......@@ -4325,8 +4205,6 @@ void MPIR_Type_get_extent_x_impl(MPI_Datatype datatype, MPI_Count *lb, MPI_Count
void MPIR_Type_get_true_extent_x_impl(MPI_Datatype datatype, MPI_Count *true_lb, MPI_Count *true_extent);
int MPIR_Type_size_x_impl(MPI_Datatype datatype, MPI_Count *size);
int MPIR_T_is_initialized(void);
/* random initializers */
int MPIR_Group_init(void);
int MPIR_Comm_init(MPID_Comm *);
......
This diff is collapsed.
This diff is collapsed.
......@@ -21,25 +21,6 @@
#ifndef MPICH_MPI_FROM_PMPI
#undef MPI_T_category_changed
#define MPI_T_category_changed PMPI_T_category_changed
/* any non-MPI functions go here, especially non-static ones */
#undef FUNCNAME
#define FUNCNAME MPIR_T_category_changed_impl
#undef FCNAME
#define FCNAME MPIU_QUOTE(FUNCNAME)
int MPIR_T_category_changed_impl(int *stamp)
{
int mpi_errno = MPI_ERR_INTERN;
/* TODO implement this function */
fn_exit:
return mpi_errno;
fn_fail:
goto fn_exit;
}
#endif /* MPICH_MPI_FROM_PMPI */
#undef FUNCNAME
......@@ -61,48 +42,22 @@ Output Parameters:
int MPI_T_category_changed(int *stamp)
{
int mpi_errno = MPI_SUCCESS;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_T_CATEGORY_CHANGED);
MPIU_THREAD_CS_ENTER(ALLFUNC,);
MPID_MPI_STATE_DECL(MPID_STATE_MPI_T_CATEGORY_CHANGED);
MPIR_T_FAIL_IF_UNINITIALIZED();
MPIR_T_THREAD_CS_ENTER();
MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_T_CATEGORY_CHANGED);
/* Validate parameters, especially handles needing to be converted */
# ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS
{
/* TODO more checks may be appropriate */
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
}
MPID_END_ERROR_CHECKS
}
# endif /* HAVE_ERROR_CHECKING */
/* Convert MPI object handles to object pointers */
/* Validate parameters and objects (post conversion) */
# ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS
{
MPIR_ERRTEST_ARGNULL(stamp, "stamp", mpi_errno);
/* TODO more checks may be appropriate (counts, in_place, buffer aliasing, etc) */
}
MPID_END_ERROR_CHECKS
}
# endif /* HAVE_ERROR_CHECKING */
/* ... body of routine ... */
mpi_errno = MPIR_T_category_changed_impl(stamp);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
if (stamp != NULL)
*stamp = cat_stamp;
/* ... end of body of routine ... */
fn_exit:
MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_T_CATEGORY_CHANGED);
MPIU_THREAD_CS_EXIT(ALLFUNC,);
MPIR_T_THREAD_CS_EXIT();
return mpi_errno;
fn_fail:
......
......@@ -30,9 +30,17 @@
#define FCNAME MPIU_QUOTE(FUNCNAME)
int MPIR_T_category_get_categories_impl(int cat_index, int len, int indices[])
{
int mpi_errno = MPI_ERR_INTERN;
int mpi_errno = MPI_SUCCESS;
cat_table_entry_t *cat;
int i, num_subcats, count;
cat = (cat_table_entry_t *)utarray_eltptr(cat_table, cat_index);
num_subcats = utarray_len(cat->subcat_indices);
count = len < num_subcats ? len : num_subcats;
/* TODO implement this function */
for (i = 0; i < count; i++) {
indices[i] = *(int *)utarray_eltptr(cat->subcat_indices, i);
}
fn_exit:
return mpi_errno;
......@@ -65,39 +73,31 @@ Output Parameters:
int MPI_T_category_get_categories(int cat_index, int len, int indices[])
{
int mpi_errno = MPI_SUCCESS;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_T_CATEGORY_GET_CATEGORIES);
MPIU_THREAD_CS_ENTER(ALLFUNC,);
MPID_MPI_STATE_DECL(MPID_STATE_MPI_T_CATEGORY_GET_CATEGORIES);
MPIR_T_FAIL_IF_UNINITIALIZED();
MPIR_T_THREAD_CS_ENTER();
MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_T_CATEGORY_GET_CATEGORIES);
/* Validate parameters, especially handles needing to be converted */
/* Validate parameters */
# ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS
{
/* TODO more checks may be appropriate */
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
if (len != 0)
MPIR_ERRTEST_ARGNULL(indices, "indices", mpi_errno);
}
MPID_END_ERROR_CHECKS
}
# endif /* HAVE_ERROR_CHECKING */
/* Convert MPI object handles to object pointers */
/* Validate parameters and objects (post conversion) */
# ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS
{
/* TODO more checks may be appropriate (counts, in_place, buffer aliasing, etc) */
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
}
MPID_END_ERROR_CHECKS
/* ... body of routine ... */
if (cat_index < 0 || cat_index >= utarray_len(cat_table)) {
mpi_errno = MPI_T_ERR_INVALID_INDEX;
goto fn_fail;
}
# endif /* HAVE_ERROR_CHECKING */
/* ... body of routine ... */
if (len == 0) goto fn_exit;
mpi_errno = MPIR_T_category_get_categories_impl(cat_index, len, indices);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
......@@ -106,7 +106,7 @@ int MPI_T_category_get_categories(int cat_index, int len, int indices[])
fn_exit:
MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_T_CATEGORY_GET_CATEGORIES);
MPIU_THREAD_CS_EXIT(ALLFUNC,);
MPIR_T_THREAD_CS_EXIT();
return mpi_errno;
fn_fail:
......
......@@ -30,9 +30,17 @@
#define FCNAME MPIU_QUOTE(FUNCNAME)
int MPIR_T_category_get_cvars_impl(int cat_index, int len, int indices[])
{
int mpi_errno = MPI_ERR_INTERN;
int mpi_errno = MPI_SUCCESS;
cat_table_entry_t *cat;
int i, num_cvars, count;
cat = (cat_table_entry_t *)utarray_eltptr(cat_table, cat_index);
num_cvars = utarray_len(cat->cvar_indices);
count = len < num_cvars ? len : num_cvars;
/* TODO implement this function */
for (i = 0; i < count; i++) {
indices[i] = *(int *)utarray_eltptr(cat->cvar_indices, i);
}
fn_exit:
return mpi_errno;
......@@ -65,39 +73,31 @@ Output Parameters:
int MPI_T_category_get_cvars(int cat_index, int len, int indices[])
{
int mpi_errno = MPI_SUCCESS;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_T_CATEGORY_GET_CVARS);
MPIU_THREAD_CS_ENTER(ALLFUNC,);
MPID_MPI_STATE_DECL(MPID_STATE_MPI_T_CATEGORY_GET_CVARS);
MPIR_T_FAIL_IF_UNINITIALIZED();
MPIR_T_THREAD_CS_ENTER();
MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_T_CATEGORY_GET_CVARS);
/* Validate parameters, especially handles needing to be converted */
/* Validate parameters */
# ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS
{
/* TODO more checks may be appropriate */
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
if (len != 0)
MPIR_ERRTEST_ARGNULL(indices, "indices", mpi_errno);
}
MPID_END_ERROR_CHECKS
}
# endif /* HAVE_ERROR_CHECKING */
/* Convert MPI object handles to object pointers */
/* Validate parameters and objects (post conversion) */
# ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS
{
/* TODO more checks may be appropriate (counts, in_place, buffer aliasing, etc) */
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
}
MPID_END_ERROR_CHECKS
/* ... body of routine ... */
if (cat_index < 0 || cat_index >= utarray_len(cat_table)) {
mpi_errno = MPI_T_ERR_INVALID_INDEX;
goto fn_fail;
}
# endif /* HAVE_ERROR_CHECKING */
/* ... body of routine ... */
if (len == 0) goto fn_exit;
mpi_errno = MPIR_T_category_get_cvars_impl(cat_index, len, indices);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
......@@ -106,7 +106,7 @@ int MPI_T_category_get_cvars(int cat_index, int len, int indices[])
fn_exit:
MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_T_CATEGORY_GET_CVARS);
MPIU_THREAD_CS_EXIT(ALLFUNC,);
MPIR_T_THREAD_CS_EXIT();
return mpi_errno;
fn_fail:
......
......@@ -21,25 +21,6 @@
#ifndef MPICH_MPI_FROM_PMPI
#undef MPI_T_category_get_info
#define MPI_T_category_get_info PMPI_T_category_get_info
/* any non-MPI functions go here, especially non-static ones */
#undef FUNCNAME
#define FUNCNAME MPIR_T_category_get_info_impl
#undef FCNAME
#define FCNAME MPIU_QUOTE(FUNCNAME)
int MPIR_T_category_get_info_impl(int cat_index, char *name, int *name_len, char *desc, int *desc_len, int *num_cvars, int *num_pvars, int *num_categories)
{
int mpi_errno = MPI_ERR_INTERN;
/* TODO implement this function */
fn_exit:
return mpi_errno;
fn_fail:
goto fn_exit;
}
#endif /* MPICH_MPI_FROM_PMPI */
#undef FUNCNAME
......@@ -69,55 +50,53 @@ Output Parameters:
.N Errors
@*/
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)
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)
{
int mpi_errno = MPI_SUCCESS;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_T_CATEGORY_GET_INFO);
MPIU_THREAD_CS_ENTER(ALLFUNC,);
MPID_MPI_STATE_DECL(MPID_STATE_MPI_T_CATEGORY_GET_INFO);
MPIR_T_FAIL_IF_UNINITIALIZED();
MPIR_T_THREAD_CS_ENTER();
MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_T_CATEGORY_GET_INFO);
/* Validate parameters, especially handles needing to be converted */
/* Validate parameters */
# ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS
{
/* TODO more checks may be appropriate */
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
/* Do not do _TEST_ARGNULL for any argument, since this is
* allowed or will be allowed by MPI_T standard.
*/
}
MPID_END_ERROR_CHECKS
}
# endif /* HAVE_ERROR_CHECKING */
/* Convert MPI object handles to object pointers */
/* Validate parameters and objects (post conversion) */
# ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS
{
MPIR_ERRTEST_ARGNULL(name_len, "name_len", mpi_errno);
MPIR_ERRTEST_ARGNULL(desc_len, "desc_len", mpi_errno);
MPIR_ERRTEST_ARGNULL(num_cvars, "num_cvars", mpi_errno);
MPIR_ERRTEST_ARGNULL(num_pvars, "num_pvars", mpi_errno);
MPIR_ERRTEST_ARGNULL(num_categories, "num_categories", mpi_errno);
/* TODO more checks may be appropriate (counts, in_place, buffer aliasing, etc) */
}
MPID_END_ERROR_CHECKS
/* ... body of routine ... */
if (cat_index < 0 || cat_index >= utarray_len(cat_table)) {
mpi_errno = MPI_T_ERR_INVALID_INDEX;
goto fn_fail;
}
# endif /* HAVE_ERROR_CHECKING */
/* ... body of routine ... */
cat_table_entry_t *cat;
cat = (cat_table_entry_t *)utarray_eltptr(cat_table, cat_index);
MPIR_T_strncpy(name, cat->name, name_len);
MPIR_T_strncpy(desc, cat->desc, desc_len);
if (num_cvars != NULL)
*num_cvars = utarray_len(cat->cvar_indices);
mpi_errno = MPIR_T_category_get_info_impl(cat_index, name, name_len, desc, desc_len, num_cvars, num_pvars, num_categories);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
if (num_pvars != NULL)
*num_pvars = utarray_len(cat->pvar_indices);
if (num_categories != NULL)
*num_categories = utarray_len(cat->subcat_indices);
/* ... end of body of routine ... */
fn_exit:
MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_T_CATEGORY_GET_INFO);
MPIU_THREAD_CS_EXIT(ALLFUNC,);
MPIR_T_THREAD_CS_EXIT();
return mpi_errno;
fn_fail:
......@@ -126,7 +105,8 @@ fn_fail:
{
mpi_errno = MPIR_Err_create_code(
mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER,
"**mpi_t_category_get_info", "**mpi_t_category_get_info %d %p %p %p %p %p %p %p", cat_index, name, name_len, desc, desc_len, num_cvars, num_pvars, num_categories);
"**mpi_t_category_get_info", "**mpi_t_category_get_info %d %p %p %p %p %p %p %p",
cat_index, name, name_len, desc, desc_len, num_cvars, num_pvars, num_categories);
}
# endif
mpi_errno = MPIR_Err_return_comm(NULL, FCNAME, mpi_errno);
......
......@@ -21,26 +21,6 @@
#ifndef MPICH_MPI_FROM_PMPI
#undef MPI_T_category_get_num
#define MPI_T_category_get_num PMPI_T_category_get_num
/* any non-MPI functions go here, especially non-static ones */
#undef FUNCNAME