本文整理汇总了C++中MPID_Datatype_get_ptr函数的典型用法代码示例。如果您正苦于以下问题:C++ MPID_Datatype_get_ptr函数的具体用法?C++ MPID_Datatype_get_ptr怎么用?C++ MPID_Datatype_get_ptr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MPID_Datatype_get_ptr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MPIR_Type_get_envelope_impl
void MPIR_Type_get_envelope_impl(MPI_Datatype datatype,
int *num_integers,
int *num_addresses,
int *num_datatypes,
int *combiner)
{
if (HANDLE_GET_KIND(datatype) == HANDLE_KIND_BUILTIN ||
datatype == MPI_FLOAT_INT ||
datatype == MPI_DOUBLE_INT ||
datatype == MPI_LONG_INT ||
datatype == MPI_SHORT_INT ||
datatype == MPI_LONG_DOUBLE_INT)
{
*combiner = MPI_COMBINER_NAMED;
*num_integers = 0;
*num_addresses = 0;
*num_datatypes = 0;
}
else {
MPID_Datatype *dtp;
MPID_Datatype_get_ptr(datatype, dtp);
*combiner = dtp->contents->combiner;
*num_integers = dtp->contents->nr_ints;
*num_addresses = dtp->contents->nr_aints;
*num_datatypes = dtp->contents->nr_types;
}
}
示例2: MPID_PSendRequest
static inline int
MPID_PSendRequest(const void * buf,
int count,
MPI_Datatype datatype,
int rank,
int tag,
MPID_Comm * comm,
int context_offset,
MPID_Request ** request)
{
MPID_Request* sreq = *request = MPIDI_Request_create2();
sreq->kind = MPID_PREQUEST_SEND;
sreq->comm = comm;
MPIR_Comm_add_ref(comm);
MPIDI_Request_setMatch(sreq, tag, rank, comm->context_id+context_offset);
sreq->mpid.userbuf = (void*)buf;
sreq->mpid.userbufcount = count;
sreq->mpid.datatype = datatype;
sreq->partner_request = NULL;
MPIDI_Request_complete(sreq);
if (HANDLE_GET_KIND(datatype) != HANDLE_KIND_BUILTIN)
{
MPID_Datatype_get_ptr(datatype, sreq->mpid.datatype_ptr);
MPID_Datatype_add_ref(sreq->mpid.datatype_ptr);
}
return MPI_SUCCESS;
}
示例3: count
/*@
MPI_Type_contiguous - Creates a contiguous datatype
Input Parameters:
+ count - replication count (nonnegative integer)
- oldtype - old datatype (handle)
Output Parameter:
. 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 old_type,
MPI_Datatype *new_type_p)
{
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_XXX macros defined in mpiimpl.h */
MPIR_ERRTEST_COUNT(count, mpi_errno);
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
MPIR_ERRTEST_DATATYPE(old_type, "datatype", mpi_errno);
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
if (HANDLE_GET_KIND(old_type) != HANDLE_KIND_BUILTIN) {
MPID_Datatype_get_ptr(old_type, 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, old_type, new_type_p);
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, old_type, new_type_p);
}
# endif
mpi_errno = MPIR_Err_return_comm( NULL, FCNAME, mpi_errno );
goto fn_exit;
/* --END ERROR HANDLING-- */
}
示例4: MPID_Recv_init
int MPID_Recv_init(void * buf,
int count,
MPI_Datatype datatype,
int rank,
int tag,
MPID_Comm * comm,
int context_offset,
MPID_Request ** request)
{
MPID_Request * rreq = *request = MPIDI_Request_create2();
rreq->kind = MPID_PREQUEST_RECV;
rreq->comm = comm;
MPIR_Comm_add_ref(comm);
MPIDI_Request_setMatch(rreq, tag, rank, comm->recvcontext_id+context_offset);
rreq->mpid.userbuf = buf;
rreq->mpid.userbufcount = count;
rreq->mpid.datatype = datatype;
rreq->partner_request = NULL;
MPIDI_Request_complete(rreq);
MPIDI_Request_setPType(rreq, MPIDI_REQUEST_PTYPE_RECV);
if (HANDLE_GET_KIND(datatype) != HANDLE_KIND_BUILTIN)
{
MPID_Datatype_get_ptr(datatype, rreq->mpid.datatype_ptr);
MPID_Datatype_add_ref(rreq->mpid.datatype_ptr);
}
return MPI_SUCCESS;
}
示例5: MPIR_Type_contiguous_impl
int MPIR_Type_contiguous_impl(int count,
MPI_Datatype old_type,
MPI_Datatype *new_type_p)
{
int mpi_errno = MPI_SUCCESS;
MPID_Datatype *new_dtp;
MPI_Datatype new_handle;
mpi_errno = MPID_Type_contiguous(count,
old_type,
&new_handle);
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
MPID_Datatype_get_ptr(new_handle, new_dtp);
mpi_errno = MPID_Datatype_set_contents(new_dtp,
MPI_COMBINER_CONTIGUOUS,
1, /* ints (count) */
0,
1,
&count,
NULL,
&old_type);
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
MPIU_OBJ_PUBLISH_HANDLE(*new_type_p, new_handle);
fn_exit:
return mpi_errno;
fn_fail:
goto fn_exit;
}
示例6: 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-- */
}
示例7: 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-- */
}
示例8: MPIR_Type_indexed_impl
int MPIR_Type_indexed_impl(int count, const int *array_of_blocklengths,
const int *array_of_displacements,
MPI_Datatype oldtype, MPI_Datatype *newtype)
{
int mpi_errno = MPI_SUCCESS;
MPI_Datatype new_handle;
MPID_Datatype *new_dtp;
int i, *ints;
MPIU_CHKLMEM_DECL(1);
mpi_errno = MPID_Type_indexed(count,
array_of_blocklengths,
array_of_displacements,
0, /* displacements not in bytes */
oldtype,
&new_handle);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
/* copy all integer values into a temporary buffer; this
* includes the count, the blocklengths, and the displacements.
*/
MPIU_CHKLMEM_MALLOC(ints, int *, (2 * count + 1) * sizeof(int), mpi_errno, "contents integer array");
ints[0] = count;
for (i=0; i < count; i++) {
ints[i+1] = array_of_blocklengths[i];
}
for (i=0; i < count; i++) {
ints[i + count + 1] = array_of_displacements[i];
}
MPID_Datatype_get_ptr(new_handle, new_dtp);
mpi_errno = MPID_Datatype_set_contents(new_dtp,
MPI_COMBINER_INDEXED,
2*count + 1, /* ints */
0, /* aints */
1, /* types */
ints,
NULL,
&oldtype);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
MPIU_OBJ_PUBLISH_HANDLE(*newtype, new_handle);
fn_exit:
MPIU_CHKLMEM_FREEALL();
return mpi_errno;
fn_fail:
goto fn_exit;
}
示例9: MPID_Type_commit
int MPID_Type_commit(MPI_Datatype *datatype_p)
{
int mpi_errno=MPI_SUCCESS;
MPID_Datatype *datatype_ptr;
MPIU_Assert(HANDLE_GET_KIND(*datatype_p) != HANDLE_KIND_BUILTIN);
MPID_Datatype_get_ptr(*datatype_p, datatype_ptr);
if (datatype_ptr->is_committed == 0) {
datatype_ptr->is_committed = 1;
#ifdef MPID_NEEDS_DLOOP_ALL_BYTES
/* If MPID implementation needs use to reduce everything to
a byte stream, do that. */
MPID_Dataloop_create(*datatype_p,
&datatype_ptr->dataloop,
&datatype_ptr->dataloop_size,
&datatype_ptr->dataloop_depth,
MPID_DATALOOP_ALL_BYTES);
#else
MPID_Dataloop_create(*datatype_p,
&datatype_ptr->dataloop,
&datatype_ptr->dataloop_size,
&datatype_ptr->dataloop_depth,
MPID_DATALOOP_HOMOGENEOUS);
#endif
/* create heterogeneous dataloop */
MPID_Dataloop_create(*datatype_p,
&datatype_ptr->hetero_dloop,
&datatype_ptr->hetero_dloop_size,
&datatype_ptr->hetero_dloop_depth,
MPID_DATALOOP_HETEROGENEOUS);
MPL_DBG_MSG_D(MPIR_DBG_DATATYPE,TERSE,"# contig blocks = %d\n",
(int) datatype_ptr->max_contig_blocks);
#if 0
MPIDI_Dataloop_dot_printf(datatype_ptr->dataloop, 0, 1);
#endif
#ifdef MPID_Dev_datatype_commit_hook
MPID_Dev_datatype_commit_hook(datatype_p);
#endif /* MPID_Dev_datatype_commit_hook */
}
return mpi_errno;
}
示例10: MPIR_Type_get_true_extent_impl
void MPIR_Type_get_true_extent_impl(MPI_Datatype datatype, MPI_Aint *true_lb, MPI_Aint *true_extent)
{
MPID_Datatype *datatype_ptr = NULL;
MPID_Datatype_get_ptr(datatype, datatype_ptr);
if (HANDLE_GET_KIND(datatype) == HANDLE_KIND_BUILTIN) {
*true_lb = 0;
*true_extent = MPID_Datatype_get_basic_size(datatype);
}
else {
*true_lb = datatype_ptr->true_lb;
*true_extent = datatype_ptr->true_ub - datatype_ptr->true_lb;
}
}
示例11: MPIR_Type_get_extent_x_impl
void MPIR_Type_get_extent_x_impl(MPI_Datatype datatype, MPI_Count *lb, MPI_Count *extent)
{
MPID_Datatype *datatype_ptr = NULL;
MPID_Datatype_get_ptr(datatype, datatype_ptr);
if (HANDLE_GET_KIND(datatype) == HANDLE_KIND_BUILTIN) {
*lb = 0;
*extent = MPID_Datatype_get_basic_size(datatype);
}
else {
*lb = datatype_ptr->lb;
*extent = datatype_ptr->extent; /* derived, should be same as ub - lb */
}
}
示例12: MPIR_Type_get_contig_blocks
int MPIR_Type_get_contig_blocks(MPI_Datatype type,
int *nr_blocks_p)
{
MPID_Datatype *datatype_ptr;
if (HANDLE_GET_KIND(type) == HANDLE_KIND_BUILTIN) {
*nr_blocks_p = 1;
return 0;
}
MPID_Datatype_get_ptr(type, datatype_ptr);
MPIU_Assert(datatype_ptr->is_committed);
*nr_blocks_p = datatype_ptr->max_contig_blocks;
return 0;
}
示例13: MPIR_Type_create_struct_impl
int MPIR_Type_create_struct_impl(int count,
int array_of_blocklengths[],
MPI_Aint array_of_displacements[],
MPI_Datatype array_of_types[],
MPI_Datatype *newtype)
{
int mpi_errno = MPI_SUCCESS;
int i, *ints;
MPI_Datatype new_handle;
MPID_Datatype *new_dtp;
MPIU_CHKLMEM_DECL(1);
mpi_errno = MPID_Type_struct(count,
array_of_blocklengths,
array_of_displacements,
array_of_types,
&new_handle);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
MPIU_CHKLMEM_MALLOC_ORJUMP(ints, int *, (count + 1) * sizeof(int), mpi_errno, "content description");
ints[0] = count;
for (i=0; i < count; i++)
ints[i+1] = array_of_blocklengths[i];
MPID_Datatype_get_ptr(new_handle, new_dtp);
mpi_errno = MPID_Datatype_set_contents(new_dtp,
MPI_COMBINER_STRUCT,
count+1, /* ints (cnt,blklen) */
count, /* aints (disps) */
count, /* types */
ints,
array_of_displacements,
array_of_types);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
MPIU_OBJ_PUBLISH_HANDLE(*newtype, new_handle);
fn_exit:
MPIU_CHKLMEM_FREEALL();
return mpi_errno;
fn_fail:
goto fn_exit;
}
示例14: MPID_Recv_init
int MPID_Recv_init(void * buf, int count, MPI_Datatype datatype, int rank, int tag, MPID_Comm * comm, int context_offset,
MPID_Request ** request)
{
MPID_Request * rreq;
int mpi_errno = MPI_SUCCESS;
MPIDI_STATE_DECL(MPID_STATE_MPID_RECV_INIT);
MPIDI_FUNC_ENTER(MPID_STATE_MPID_RECV_INIT);
rreq = MPID_Request_create();
if (rreq == NULL)
{
/* --BEGIN ERROR HANDLING-- */
mpi_errno = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, FCNAME, __LINE__, MPI_ERR_OTHER, "**nomemreq", 0);
/* --END ERROR HANDLING-- */
goto fn_exit;
}
MPIU_Object_set_ref(rreq, 1);
rreq->kind = MPID_PREQUEST_RECV;
rreq->comm = comm;
MPID_cc_set(&rreq->cc, 0);
MPIR_Comm_add_ref(comm);
rreq->dev.match.parts.rank = rank;
rreq->dev.match.parts.tag = tag;
rreq->dev.match.parts.context_id = comm->recvcontext_id + context_offset;
rreq->dev.user_buf = (void *) buf;
rreq->dev.user_count = count;
rreq->dev.datatype = datatype;
rreq->partner_request = NULL;
MPIDI_Request_set_type(rreq, MPIDI_REQUEST_TYPE_RECV);
if (HANDLE_GET_KIND(datatype) != HANDLE_KIND_BUILTIN)
{
MPID_Datatype_get_ptr(datatype, rreq->dev.datatype_ptr);
MPID_Datatype_add_ref(rreq->dev.datatype_ptr);
}
*request = rreq;
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPID_RECV_INIT);
return mpi_errno;
}
示例15: MPID_Bsend_init
int MPID_Bsend_init(const void * buf, int count, MPI_Datatype datatype, int rank, int tag, MPID_Comm * comm, int context_offset,
MPID_Request ** request)
{
MPID_Request * sreq;
int mpi_errno = MPI_SUCCESS;
MPIDI_STATE_DECL(MPID_STATE_MPID_BSEND_INIT);
MPIDI_FUNC_ENTER(MPID_STATE_MPID_BSEND_INIT);
MPIDI_Request_create_psreq(sreq, mpi_errno, goto fn_exit);
MPIDI_Request_set_type(sreq, MPIDI_REQUEST_TYPE_BSEND);
if (HANDLE_GET_KIND(datatype) != HANDLE_KIND_BUILTIN)
{
MPID_Datatype_get_ptr(datatype, sreq->dev.datatype_ptr);
MPID_Datatype_add_ref(sreq->dev.datatype_ptr);
}
*request = sreq;
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPID_BSEND_INIT);
return mpi_errno;
}