本文整理汇总了C++中MPID_MPI_FUNC_EXIT函数的典型用法代码示例。如果您正苦于以下问题:C++ MPID_MPI_FUNC_EXIT函数的具体用法?C++ MPID_MPI_FUNC_EXIT怎么用?C++ MPID_MPI_FUNC_EXIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MPID_MPI_FUNC_EXIT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: attached
/*@
MPI_Win_set_attr - Stores attribute value associated with a key
Input Parameters:
+ win - MPI window object to which attribute will be attached (handle)
. win_keyval - key value, as returned by 'MPI_Win_create_keyval' (integer)
- attribute_val - attribute value
Notes:
The type of the attribute value depends on whether C or Fortran is being used.
In C, an attribute value is a pointer ('void *'); in Fortran, it is an
address-sized integer.
If an attribute is already present, the delete function (specified when the
corresponding keyval was created) will be called.
.N ThreadSafe
.N Fortran
.N Errors
.N MPI_SUCCESS
.N MPI_ERR_WIN
.N MPI_ERR_KEYVAL
@*/
int MPI_Win_set_attr(MPI_Win win, int win_keyval, void *attribute_val)
{
int mpi_errno = MPI_SUCCESS;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_WIN_SET_ATTR);
MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_WIN_SET_ATTR);
MPIR_ERRTEST_INITIALIZED_ORDIE();
/* ... body of routine ... */
mpi_errno = MPIR_WinSetAttr( win, win_keyval, attribute_val,
MPIR_ATTR_PTR );
if (mpi_errno) goto fn_fail;
/* ... end of body of routine ... */
fn_exit:
MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_WIN_SET_ATTR);
return mpi_errno;
fn_fail:
/* --BEGIN ERROR HANDLING-- */
# ifdef HAVE_ERROR_CHECKING
{
mpi_errno = MPIR_Err_create_code(
mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER, "**mpi_win_set_attr",
"**mpi_win_set_attr %W %d %p", win, win_keyval, attribute_val);
}
# endif
goto fn_exit;
/* --END ERROR HANDLING-- */
}
示例2: MPIR_Group_incl_impl
int MPIR_Group_incl_impl(MPID_Group *group_ptr, int n, const int ranks[], MPID_Group **new_group_ptr)
{
int mpi_errno = MPI_SUCCESS;
int i;
MPID_MPI_STATE_DECL(MPID_STATE_MPIR_GROUP_INCL_IMPL);
MPID_MPI_FUNC_ENTER(MPID_STATE_MPIR_GROUP_INCL_IMPL);
if (n == 0) {
*new_group_ptr = MPID_Group_empty;
goto fn_exit;
}
/* Allocate a new group and lrank_to_lpid array */
mpi_errno = MPIR_Group_create( n, new_group_ptr );
if (mpi_errno) goto fn_fail;
(*new_group_ptr)->rank = MPI_UNDEFINED;
for (i = 0; i < n; i++) {
(*new_group_ptr)->lrank_to_lpid[i].lrank = i;
(*new_group_ptr)->lrank_to_lpid[i].lpid = group_ptr->lrank_to_lpid[ranks[i]].lpid;
if (ranks[i] == group_ptr->rank)
(*new_group_ptr)->rank = i;
}
(*new_group_ptr)->size = n;
(*new_group_ptr)->idx_of_first_lpid = -1;
/* TODO calculate is_local_dense_monotonic */
fn_exit:
MPID_MPI_FUNC_EXIT(MPID_STATE_MPIR_GROUP_INCL_IMPL);
return mpi_errno;
fn_fail:
goto fn_exit;
}
示例3: session
/*@
MPI_T_pvar_start - XXX description here
Input Parameters:
+ session - identifier of performance experiment session (handle)
- handle - handle of a performance variable (handle)
.N ThreadSafe
.N Fortran
.N Errors
@*/
int MPI_T_pvar_start(MPI_T_pvar_session session, MPI_T_pvar_handle handle)
{
int mpi_errno = MPI_SUCCESS;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_T_PVAR_START);
MPIU_THREAD_CS_ENTER(ALLFUNC,);
MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_T_PVAR_START);
/* 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
{
/* TODO more checks may be appropriate (counts, in_place, buffer aliasing, etc) */
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
}
MPID_END_ERROR_CHECKS
}
# endif /* HAVE_ERROR_CHECKING */
/* ... body of routine ... */
mpi_errno = MPIR_T_pvar_start_impl(session, handle);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
/* ... end of body of routine ... */
fn_exit:
MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_T_PVAR_START);
MPIU_THREAD_CS_EXIT(ALLFUNC,);
return mpi_errno;
fn_fail:
/* --BEGIN ERROR HANDLING-- */
# ifdef HAVE_ERROR_CHECKING
{
mpi_errno = MPIR_Err_create_code(
mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER,
"**mpi_t_pvar_start", "**mpi_t_pvar_start %p %p", session, handle);
}
# endif
mpi_errno = MPIR_Err_return_comm(NULL, FCNAME, mpi_errno);
goto fn_exit;
/* --END ERROR HANDLING-- */
}
示例4: MPIR_Comm_apply_hints
int MPIR_Comm_apply_hints(MPID_Comm * comm_ptr, MPID_Info * info_ptr)
{
int mpi_errno = MPI_SUCCESS;
MPID_Info *hint = NULL;
char hint_name[MPI_MAX_INFO_KEY] = { 0 };
struct MPIR_Comm_hint_fn_elt *hint_fn = NULL;
MPID_MPI_STATE_DECL(MPID_STATE_MPIR_COMM_APPLY_HINTS);
MPID_MPI_FUNC_ENTER(MPID_STATE_MPIR_COMM_APPLY_HINTS);
MPL_LL_FOREACH(info_ptr, hint) {
/* Have we hit the default, empty info hint? */
if (hint->key == NULL)
continue;
strncpy(hint_name, hint->key, MPI_MAX_INFO_KEY);
HASH_FIND_STR(MPID_hint_fns, hint_name, hint_fn);
/* Skip hints that MPICH doesn't recognize. */
if (hint_fn) {
mpi_errno = hint_fn->fn(comm_ptr, hint, hint_fn->state);
if (mpi_errno)
MPIR_ERR_POP(mpi_errno);
}
}
fn_exit:
MPID_MPI_FUNC_EXIT(MPID_STATE_MPIR_COMM_APPLY_HINTS);
return mpi_errno;
fn_fail:
goto fn_exit;
}
示例5: name
/*@
MPI_T_category_get_info - Get the information about a category
Input/Output Parameters:
+ name_len - length of the string and/or buffer for name (integer)
- desc_len - length of the string and/or buffer for desc (integer)
Input Parameters:
. cat_index - index of the category to be queried (integer)
Output Parameters:
+ name - buffer to return the string containing the name of the category (string)
. desc - buffer to return the string containing the description of the category (string)
. num_cvars - number of control variables contained in the category (integer)
. num_pvars - number of performance variables contained in the category (integer)
- num_categories - number of categories contained in the category (integer)
.N ThreadSafe
.N Errors
.N MPI_SUCCESS
.N MPI_T_ERR_NOT_INITIALIZED
.N MPI_T_ERR_INVALID_INDEX
@*/
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;
cat_table_entry_t *cat;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_T_CATEGORY_GET_INFO);
MPIR_ERRTEST_MPIT_INITIALIZED(mpi_errno);
MPIR_T_THREAD_CS_ENTER();
MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_T_CATEGORY_GET_INFO);
/* Validate parameters */
# ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS
{
MPIR_ERRTEST_CAT_INDEX(cat_index, mpi_errno);
/* Do not do _TEST_ARGNULL for other arguments, since this is
* allowed or will be allowed by MPI_T standard.
*/
}
MPID_END_ERROR_CHECKS
}
# endif /* HAVE_ERROR_CHECKING */
/* ... body of routine ... */
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);
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);
MPIR_T_THREAD_CS_EXIT();
return mpi_errno;
fn_fail:
/* --BEGIN ERROR HANDLING-- */
# ifdef HAVE_ERROR_CHECKING
{
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);
}
# endif
mpi_errno = MPIR_Err_return_comm(NULL, FCNAME, mpi_errno);
goto fn_exit;
/* --END ERROR HANDLING-- */
}
示例6: value
/*@
MPI_Keyval_free - Frees an attribute key for communicators
Input Parameters:
. keyval - Frees the integer key value (integer)
Note:
Key values are global (they can be used with any and all communicators)
.N Deprecated
The replacement for this routine is 'MPI_Comm_free_keyval'.
.N ThreadSafe
.N Fortran
.N Errors
.N MPI_SUCCESS
.N MPI_ERR_ARG
.N MPI_ERR_PERM_KEY
.seealso: MPI_Keyval_create, MPI_Comm_free_keyval
@*/
int MPI_Keyval_free(int *keyval)
{
static const char FCNAME[] = "MPI_Keyval_free";
int mpi_errno = MPI_SUCCESS;
MPID_Keyval *keyval_ptr = NULL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_KEYVAL_FREE);
MPIR_ERRTEST_INITIALIZED_ORDIE();
MPIU_THREAD_CS_ENTER(ALLFUNC,);
MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_KEYVAL_FREE);
# ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS;
{
MPIR_ERRTEST_ARGNULL(keyval, "keyval", mpi_errno);
}
MPID_END_ERROR_CHECKS;
}
# endif /* HAVE_ERROR_CHECKING */
/* Convert MPI object handles to object pointers */
MPID_Keyval_get_ptr( *keyval, keyval_ptr );
/* Validate parameters and objects (post conversion) */
# ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS;
{
MPID_Keyval_valid_ptr( keyval_ptr, mpi_errno );
if (mpi_errno) goto fn_fail;
}
MPID_END_ERROR_CHECKS;
}
# endif /* HAVE_ERROR_CHECKING */
/* ... body of routine ... */
MPIR_Comm_free_keyval_impl(*keyval);
*keyval = MPI_KEYVAL_INVALID;
/* ... end of body of routine ... */
fn_exit:
MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_KEYVAL_FREE);
MPIU_THREAD_CS_EXIT(ALLFUNC,);
return mpi_errno;
fn_fail:
/* --BEGIN ERROR HANDLING-- */
# ifdef HAVE_ERROR_CHECKING
{
mpi_errno = MPIR_Err_create_code(
mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER, "**mpi_keyval_free", "**mpi_keyval_free %p", keyval);
}
# endif
mpi_errno = MPIR_Err_return_comm( NULL, FCNAME, mpi_errno );
goto fn_exit;
/* --END ERROR HANDLING-- */
}
示例7: session
/*@
MPI_T_pvar_readreset - Read the value of a performance variable and then reset it
Input Parameters:
+ session - identifier of performance experiment session (handle)
- handle - handle of a performance variable (handle)
Output Parameters:
. buf - initial address of storage location for variable value (choice)
.N ThreadSafe
.N Errors
.N MPI_SUCCESS
.N MPI_T_ERR_NOT_INITIALIZED
.N MPI_T_ERR_INVALID_SESSION
.N MPI_T_ERR_INVALID_HANDLE
.N MPI_T_ERR_PVAR_NO_WRITE
.N MPI_T_ERR_PVAR_NO_ATOMIC
@*/
int MPI_T_pvar_readreset(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf)
{
int mpi_errno = MPI_SUCCESS;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_T_PVAR_READRESET);
MPIR_ERRTEST_MPIT_INITIALIZED(mpi_errno);
MPIR_T_THREAD_CS_ENTER();
MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_T_PVAR_READRESET);
/* Validate parameters */
# ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS
{
MPIR_ERRTEST_PVAR_SESSION(session, mpi_errno);
MPIR_ERRTEST_PVAR_HANDLE(handle, mpi_errno);
MPIR_ERRTEST_ARGNULL(buf, "buf", mpi_errno);
if (handle == MPI_T_PVAR_ALL_HANDLES || session != handle->session
|| !MPIR_T_pvar_is_oncestarted(handle))
{
mpi_errno = MPI_T_ERR_INVALID_HANDLE;
goto fn_fail;
}
if (!MPIR_T_pvar_is_atomic(handle))
{
mpi_errno = MPI_T_ERR_PVAR_NO_ATOMIC;
goto fn_fail;
}
}
MPID_END_ERROR_CHECKS
}
# endif /* HAVE_ERROR_CHECKING */
/* ... body of routine ... */
mpi_errno = MPIR_T_pvar_readreset_impl(session, handle, buf);
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
/* ... end of body of routine ... */
fn_exit:
MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_T_PVAR_READRESET);
MPIR_T_THREAD_CS_EXIT();
return mpi_errno;
fn_fail:
/* --BEGIN ERROR HANDLING-- */
# ifdef HAVE_ERROR_CHECKING
{
mpi_errno = MPIR_Err_create_code(
mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER,
"**mpi_t_pvar_readreset", "**mpi_t_pvar_readreset %p %p %p", session, handle, buf);
}
# endif
mpi_errno = MPIR_Err_return_comm(NULL, FCNAME, mpi_errno);
goto fn_exit;
/* --END ERROR HANDLING-- */
}
示例8: MPIR_Comm_group_impl
int MPIR_Comm_group_impl(MPID_Comm *comm_ptr, MPID_Group **group_ptr)
{
int mpi_errno = MPI_SUCCESS;
MPID_VCR *local_vcr;
int i, lpid, n;
int comm_world_size = MPIR_Process.comm_world->local_size;
MPID_MPI_STATE_DECL(MPID_STATE_MPIR_COMM_GROUP_IMPL);
MPID_MPI_FUNC_ENTER(MPID_STATE_MPIR_COMM_GROUP_IMPL);
/* Create a group if necessary and populate it with the
local process ids */
if (!comm_ptr->local_group) {
n = comm_ptr->local_size;
mpi_errno = MPIR_Group_create( n, group_ptr );
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
/* Make sure that we get the correct group */
if (comm_ptr->comm_kind == MPID_INTERCOMM) {
local_vcr = comm_ptr->local_vcr;
}
else
local_vcr = comm_ptr->vcr;
(*group_ptr)->is_local_dense_monotonic = TRUE;
for (i=0; i<n; i++) {
(void) MPID_VCR_Get_lpid( local_vcr[i], &lpid );
(*group_ptr)->lrank_to_lpid[i].lrank = i;
(*group_ptr)->lrank_to_lpid[i].lpid = lpid;
if (lpid > comm_world_size ||
(i > 0 && (*group_ptr)->lrank_to_lpid[i-1].lpid != (lpid-1)))
{
(*group_ptr)->is_local_dense_monotonic = FALSE;
}
}
(*group_ptr)->size = n;
(*group_ptr)->rank = comm_ptr->rank;
(*group_ptr)->idx_of_first_lpid = -1;
comm_ptr->local_group = *group_ptr;
} else {
*group_ptr = comm_ptr->local_group;
}
/* FIXME : Add a sanity check that the size of the group is the same as
the size of the communicator. This helps catch corrupted
communicators */
MPIR_Group_add_ref( comm_ptr->local_group );
fn_exit:
MPID_MPI_FUNC_EXIT(MPID_STATE_MPIR_COMM_GROUP_IMPL);
return mpi_errno;
fn_fail:
goto fn_exit;
}
示例9: operation
/*@
MPI_Get_count - Gets the number of "top level" elements
Input Parameters:
+ status - return status of receive operation (Status)
- datatype - datatype of each receive buffer element (handle)
Output Parameters:
. count - number of received elements (integer)
Notes:
If the size of the datatype is zero, this routine will return a count of
zero. If the amount of data in 'status' is not an exact multiple of the
size of 'datatype' (so that 'count' would not be integral), a 'count' of
'MPI_UNDEFINED' is returned instead.
.N Fortran
.N Errors
.N MPI_SUCCESS
.N MPI_ERR_TYPE
@*/
int MPI_Get_count( const MPI_Status *status, MPI_Datatype datatype, int *count )
{
int mpi_errno = MPI_SUCCESS;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_GET_COUNT);
MPIR_ERRTEST_INITIALIZED_ORDIE();
MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_GET_COUNT);
# ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS;
{
MPID_Datatype *datatype_ptr = NULL;
MPIR_ERRTEST_ARGNULL(status, "status", mpi_errno);
MPIR_ERRTEST_ARGNULL(count, "count", mpi_errno);
MPIR_ERRTEST_DATATYPE(datatype, "datatype", mpi_errno);
/* Validate datatype_ptr */
if (HANDLE_GET_KIND(datatype) != HANDLE_KIND_BUILTIN) {
MPID_Datatype_get_ptr(datatype, datatype_ptr);
MPID_Datatype_valid_ptr(datatype_ptr, mpi_errno);
if (mpi_errno) goto fn_fail;
/* Q: Must the type be committed to be used with this function? */
}
}
MPID_END_ERROR_CHECKS;
}
# endif /* HAVE_ERROR_CHECKING */
/* ... body of routine ... */
MPIR_Get_count_impl(status, datatype, count);
/* ... end of body of routine ... */
#ifdef HAVE_ERROR_CHECKING
fn_exit:
#endif
MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_GET_COUNT);
return mpi_errno;
/* --BEGIN ERROR HANDLING-- */
# ifdef HAVE_ERROR_CHECKING
fn_fail:
{
mpi_errno = MPIR_Err_create_code(
mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER,
"**mpi_get_count",
"**mpi_get_count %p %D %p", status, datatype, count);
}
mpi_errno = MPIR_Err_return_comm( 0, FCNAME, mpi_errno );
goto fn_exit;
# endif
/* --END ERROR HANDLING-- */
}
示例10: count
/*@
MPI_Type_contiguous - Creates a contiguous datatype
Input Parameters:
+ count - replication count (nonnegative integer)
- oldtype - old datatype (handle)
Output Parameters:
. newtype - new datatype (handle)
.N ThreadSafe
.N Fortran
.N Errors
.N MPI_SUCCESS
.N MPI_ERR_TYPE
.N MPI_ERR_COUNT
.N MPI_ERR_EXHAUSTED
@*/
int MPI_Type_contiguous(int count,
MPI_Datatype oldtype,
MPI_Datatype *newtype)
{
int mpi_errno = MPI_SUCCESS;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_TYPE_CONTIGUOUS);
MPIR_ERRTEST_INITIALIZED_ORDIE();
MPIU_THREAD_CS_ENTER(ALLFUNC,);
MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_CONTIGUOUS);
# ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS;
{
MPID_Datatype *datatype_ptr = NULL;
MPIR_ERRTEST_COUNT(count, mpi_errno);
MPIR_ERRTEST_DATATYPE(oldtype, "datatype", mpi_errno);
if (HANDLE_GET_KIND(oldtype) != HANDLE_KIND_BUILTIN) {
MPID_Datatype_get_ptr(oldtype, datatype_ptr);
MPID_Datatype_valid_ptr(datatype_ptr, mpi_errno);
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
}
}
MPID_END_ERROR_CHECKS;
}
# endif /* HAVE_ERROR_CHECKING */
/* ... body of routine ... */
mpi_errno = MPIR_Type_contiguous_impl(count, oldtype, newtype);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
/* ... end of body of routine ... */
fn_exit:
MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_CONTIGUOUS);
MPIU_THREAD_CS_EXIT(ALLFUNC,);
return mpi_errno;
fn_fail:
/* --BEGIN ERROR HANDLING-- */
# ifdef HAVE_ERROR_CHECKING
{
mpi_errno = MPIR_Err_create_code(
mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER, "**mpi_type_contiguous",
"**mpi_type_contiguous %d %D %p", count, oldtype, newtype);
}
# endif
mpi_errno = MPIR_Err_return_comm( NULL, FCNAME, mpi_errno );
goto fn_exit;
/* --END ERROR HANDLING-- */
}
示例11: MPIR_Get_intercomm_contextid
int MPIR_Get_intercomm_contextid(MPID_Comm * comm_ptr, MPIU_Context_id_t * context_id,
MPIU_Context_id_t * recvcontext_id)
{
MPIU_Context_id_t mycontext_id, remote_context_id;
int mpi_errno = MPI_SUCCESS;
int tag = 31567; /* FIXME - we need an internal tag or
* communication channel. Can we use a different
* context instead?. Or can we use the tag
* provided in the intercomm routine? (not on a dup,
* but in that case it can use the collective context) */
MPIR_Errflag_t errflag = MPIR_ERR_NONE;
MPID_MPI_STATE_DECL(MPID_STATE_MPIR_GET_INTERCOMM_CONTEXTID);
MPID_MPI_FUNC_ENTER(MPID_STATE_MPIR_GET_INTERCOMM_CONTEXTID);
if (!comm_ptr->local_comm) {
/* Manufacture the local communicator */
mpi_errno = MPIR_Setup_intercomm_localcomm(comm_ptr);
if (mpi_errno)
MPIR_ERR_POP(mpi_errno);
}
mpi_errno = MPIR_Get_contextid_sparse(comm_ptr->local_comm, &mycontext_id, FALSE);
if (mpi_errno)
MPIR_ERR_POP(mpi_errno);
MPIU_Assert(mycontext_id != 0);
/* MPIC routine uses an internal context id. The local leads (process 0)
* exchange data */
remote_context_id = -1;
if (comm_ptr->rank == 0) {
mpi_errno = MPIC_Sendrecv(&mycontext_id, 1, MPIU_CONTEXT_ID_T_DATATYPE, 0, tag,
&remote_context_id, 1, MPIU_CONTEXT_ID_T_DATATYPE, 0, tag,
comm_ptr, MPI_STATUS_IGNORE, &errflag);
if (mpi_errno)
MPIR_ERR_POP(mpi_errno);
}
/* Make sure that all of the local processes now have this
* id */
mpi_errno = MPIR_Bcast_impl(&remote_context_id, 1, MPIU_CONTEXT_ID_T_DATATYPE,
0, comm_ptr->local_comm, &errflag);
if (mpi_errno)
MPIR_ERR_POP(mpi_errno);
MPIR_ERR_CHKANDJUMP(errflag, mpi_errno, MPI_ERR_OTHER, "**coll_fail");
/* The recvcontext_id must be the one that was allocated out of the local
* group, not the remote group. Otherwise we could end up posting two
* MPI_ANY_SOURCE,MPI_ANY_TAG recvs on the same context IDs even though we
* are attempting to post them for two separate communicators. */
*context_id = remote_context_id;
*recvcontext_id = mycontext_id;
fn_fail:
MPID_MPI_FUNC_EXIT(MPID_STATE_MPIR_GET_INTERCOMM_CONTEXTID);
return mpi_errno;
}
示例12: MPIR_Comm_copy_data
int MPIR_Comm_copy_data(MPID_Comm * comm_ptr, MPID_Comm ** outcomm_ptr)
{
int mpi_errno = MPI_SUCCESS;
MPID_Comm *newcomm_ptr = NULL;
MPID_MPI_STATE_DECL(MPID_STATE_MPIR_COMM_COPY_DATA);
MPID_MPI_FUNC_ENTER(MPID_STATE_MPIR_COMM_COPY_DATA);
mpi_errno = MPIR_Comm_create(&newcomm_ptr);
if (mpi_errno)
goto fn_fail;
/* use a large garbage value to ensure errors are caught more easily */
newcomm_ptr->context_id = 32767;
newcomm_ptr->recvcontext_id = 32767;
/* Save the kind of the communicator */
newcomm_ptr->comm_kind = comm_ptr->comm_kind;
newcomm_ptr->local_comm = 0;
if (comm_ptr->comm_kind == MPID_INTRACOMM)
MPIR_Comm_map_dup(newcomm_ptr, comm_ptr, MPIR_COMM_MAP_DIR_L2L);
else
MPIR_Comm_map_dup(newcomm_ptr, comm_ptr, MPIR_COMM_MAP_DIR_R2R);
/* If it is an intercomm, duplicate the network address mapping */
if (comm_ptr->comm_kind == MPID_INTERCOMM) {
MPIR_Comm_map_dup(newcomm_ptr, comm_ptr, MPIR_COMM_MAP_DIR_L2L);
}
/* Set the sizes and ranks */
newcomm_ptr->rank = comm_ptr->rank;
newcomm_ptr->local_size = comm_ptr->local_size;
newcomm_ptr->remote_size = comm_ptr->remote_size;
newcomm_ptr->is_low_group = comm_ptr->is_low_group; /* only relevant for intercomms */
/* Inherit the error handler (if any) */
MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_POBJ_COMM_MUTEX(comm_ptr));
newcomm_ptr->errhandler = comm_ptr->errhandler;
if (comm_ptr->errhandler) {
MPIR_Errhandler_add_ref(comm_ptr->errhandler);
}
MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_POBJ_COMM_MUTEX(comm_ptr));
/* FIXME do we want to copy coll_fns here? */
/* Start with no attributes on this communicator */
newcomm_ptr->attributes = 0;
*outcomm_ptr = newcomm_ptr;
fn_fail:
fn_exit:
MPID_MPI_FUNC_EXIT(MPID_STATE_MPIR_COMM_COPY_DATA);
return mpi_errno;
}
示例13: MPI_Initialized
/*@
MPI_Initialized - Indicates whether 'MPI_Init' has been called.
Output Parameters:
. flag - Flag is true if 'MPI_Init' or 'MPI_Init_thread' has been called and
false otherwise.
Notes:
.N Fortran
.N Errors
.N MPI_SUCCESS
@*/
int MPI_Initialized( int *flag )
{
#ifdef HAVE_ERROR_CHECKING
static const char FCNAME[] = "MPI_Initialized";
#endif
int mpi_errno = MPI_SUCCESS;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_INITIALIZED);
MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_INITIALIZED);
# ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS;
{
/* Should check that flag is not null */
if (flag == NULL)
{
mpi_errno = MPI_ERR_ARG;
goto fn_fail;
}
}
MPID_END_ERROR_CHECKS;
}
# endif /* HAVE_ERROR_CHECKING */
/* ... body of routine ... */
*flag = (MPIR_Process.initialized >= MPICH_WITHIN_MPI);
/* ... end of body of routine ... */
#ifdef HAVE_ERROR_CHECKING
fn_exit:
#endif
MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_INITIALIZED);
return mpi_errno;
/* --BEGIN ERROR HANDLING-- */
# ifdef HAVE_ERROR_CHECKING
fn_fail:
if (MPIR_Process.initialized == MPICH_WITHIN_MPI)
{
{
mpi_errno = MPIR_Err_create_code(
mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__,
MPI_ERR_OTHER, "**mpi_initialized",
"**mpi_initialized %p", flag);
}
mpi_errno = MPIR_Err_return_comm( 0, FCNAME, mpi_errno );
}
goto fn_exit;
# endif
/* --END ERROR HANDLING-- */
}
示例14: procedure
/*@
MPI_File_create_errhandler - Create a file error handler
Input Parameters:
. file_errhandler_fn - user defined error handling procedure (function)
Output Parameters:
. errhandler - MPI error handler (handle)
.N ThreadSafe
.N Fortran
.N Errors
.N MPI_SUCCESS
@*/
int MPI_File_create_errhandler(MPI_File_errhandler_function *file_errhandler_fn,
MPI_Errhandler *errhandler)
{
static const char FCNAME[] = "MPI_File_create_errhandler";
int mpi_errno = MPI_SUCCESS;
MPID_Errhandler *errhan_ptr;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_FILE_CREATE_ERRHANDLER);
MPIR_ERRTEST_INITIALIZED_ORDIE();
MPIU_THREAD_CS_ENTER(ALLFUNC,);
MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_FILE_CREATE_ERRHANDLER);
/* Validate parameters, especially handles needing to be converted */
# ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS;
{
MPIR_ERRTEST_ARGNULL(file_errhandler_fn, "file_errhandler_fn", mpi_errno);
MPIR_ERRTEST_ARGNULL(errhandler, "errhandler", mpi_errno);
}
MPID_END_ERROR_CHECKS;
}
# endif /* HAVE_ERROR_CHECKING */
/* ... body of routine ... */
errhan_ptr = (MPID_Errhandler *)MPIU_Handle_obj_alloc( &MPID_Errhandler_mem );
MPIU_ERR_CHKANDJUMP(!errhan_ptr,mpi_errno,MPI_ERR_OTHER,"**nomem");
errhan_ptr->language = MPID_LANG_C;
errhan_ptr->kind = MPID_FILE;
MPIU_Object_set_ref(errhan_ptr,1);
errhan_ptr->errfn.C_File_Handler_function = file_errhandler_fn;
MPIU_OBJ_PUBLISH_HANDLE(*errhandler, errhan_ptr->handle);
/* ... end of body of routine ... */
fn_exit:
MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_FILE_CREATE_ERRHANDLER);
MPIU_THREAD_CS_EXIT(ALLFUNC,);
return mpi_errno;
fn_fail:
/* --BEGIN ERROR HANDLING-- */
# ifdef HAVE_ERROR_CHECKING
{
mpi_errno = MPIR_Err_create_code(
mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER, "**mpi_file_create_errhandler",
"**mpi_file_create_errhandler %p %p", file_errhandler_fn, errhandler);
}
# endif
mpi_errno = MPIR_Err_return_comm( NULL, FCNAME, mpi_errno );
goto fn_exit;
/* --END ERROR HANDLING-- */
}
示例15: with
/*@
MPI_Status_set_elements - Set the number of elements in a status
Input Parameters:
+ status - status to associate count with (Status)
. datatype - datatype associated with count (handle)
- count - number of elements to associate with status (integer)
.N ThreadSafe
.N Fortran
.N Errors
.N MPI_SUCCESS
.N MPI_ERR_ARG
.N MPI_ERR_TYPE
@*/
int MPI_Status_set_elements(MPI_Status *status, MPI_Datatype datatype,
int count)
{
int mpi_errno = MPI_SUCCESS;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_STATUS_SET_ELEMENTS);
MPIR_ERRTEST_INITIALIZED_ORDIE();
MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_STATUS_SET_ELEMENTS);
/* Validate parameters and objects (post conversion) */
# ifdef HAVE_ERROR_CHECKING
{
MPID_BEGIN_ERROR_CHECKS;
{
MPID_Datatype *datatype_ptr = NULL;
MPIR_ERRTEST_COUNT(count,mpi_errno);
MPIR_ERRTEST_ARGNULL(status,"status",mpi_errno);
MPIR_ERRTEST_DATATYPE(datatype, "datatype", mpi_errno);
/* Validate datatype_ptr */
MPID_Datatype_get_ptr( datatype, datatype_ptr );
MPID_Datatype_valid_ptr( datatype_ptr, mpi_errno );
/* If datatype_ptr is not valid, it will be reset to null */
if (mpi_errno) goto fn_fail;
}
MPID_END_ERROR_CHECKS;
}
# endif /* HAVE_ERROR_CHECKING */
/* ... body of routine ... */
mpi_errno = MPIR_Status_set_elements_x_impl(status, datatype, (MPI_Count)count);
if (mpi_errno) MPIR_ERR_POP(mpi_errno);
/* ... end of body of routine ... */
fn_exit:
MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_STATUS_SET_ELEMENTS);
return mpi_errno;
/* --BEGIN ERROR HANDLING-- */
fn_fail:
{
mpi_errno = MPIR_Err_create_code(
mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER,
"**mpi_status_set_elements",
"**mpi_status_set_elements %p %D %d", status, datatype, count);
}
mpi_errno = MPIR_Err_return_comm( NULL, FCNAME, mpi_errno );
goto fn_exit;
/* --END ERROR HANDLING-- */
}