📄 mpid_datatype.h
字号:
ADI3 API uses two routines, 'MPIU_Object_add_ref' and 'MPIU_Object_release_ref', to increment and decrement the reference count. S*/typedef struct MPID_Datatype { /* handle and ref_count are filled in by MPIU_Handle_obj_alloc() */ int handle; /* value of MPI_Datatype for structure */ volatile int ref_count; /* basic parameters for datatype, accessible via MPI calls */ int size; MPI_Aint extent, ub, lb, true_ub, true_lb; /* chars affecting subsequent datatype processing and creation */ int alignsize, has_sticky_ub, has_sticky_lb; int is_permanent; /* non-zero if datatype is a predefined type */ int is_committed; /* element information; used for accumulate and get elements * * if type is composed of more than one element type, then * eltype == MPI_DATATYPE_NULL and element_size == -1 */ int eltype, n_elements; MPI_Aint element_size; /* information on contiguity of type, for processing shortcuts. * * is_contig is non-zero only if N instances of the type would be * contiguous. */ int is_contig; int n_contig_blocks; /* # of contig blocks in one instance */ /* pointer to contents and envelope data for the datatype */ MPID_Datatype_contents *contents; /* dataloop members, including a pointer to the loop, the size in bytes, * and a depth used to verify that we can process it (limited stack depth */ struct MPID_Dataloop *dataloop; /* might be optimized for homogenous */ int dataloop_size; int dataloop_depth;#if defined(MPID_HAS_HETERO) || 1 struct MPID_Dataloop *hetero_dloop; /* heterogeneous dataloop */ int hetero_dloop_size; int hetero_dloop_depth;#endif /* MPID_HAS_HETERO */ /* MPI-2 attributes and name */ struct MPID_Attribute *attributes; char name[MPI_MAX_OBJECT_NAME]; /* not yet used; will be used to track what processes have cached * copies of this type. */ int32_t cache_id; /* MPID_Lpidmask mask; */ /* int (*free_fn)( struct MPID_Datatype * ); */ /* Function to free this datatype */ /* Other, device-specific information */#ifdef MPID_DEV_DATATYPE_DECL MPID_DEV_DATATYPE_DECL#endif} MPID_Datatype;extern MPIU_Object_alloc_t MPID_Datatype_mem;/* Preallocated datatype objects *//* The C++ types BOOL, COMPLEX, DOUBLE_COMPLEX, and LONG_DOUBLE_COMPLEX added a few more builtin types */#define MPID_DATATYPE_N_BUILTIN 55extern MPID_Datatype MPID_Datatype_builtin[MPID_DATATYPE_N_BUILTIN + 1];extern MPID_Datatype MPID_Datatype_direct[];#define MPID_DTYPE_BEGINNING 0#define MPID_DTYPE_END -1/* LB/UB calculation helper macros *//* MPID_DATATYPE_CONTIG_LB_UB() * * Determines the new LB and UB for a block of old types given the * old type's LB, UB, and extent, and a count of these types in the * block. * * Note: if the displacement is non-zero, the MPID_DATATYPE_BLOCK_LB_UB() * should be used instead (see below). */#define MPID_DATATYPE_CONTIG_LB_UB(cnt_, \ old_lb_, \ old_ub_, \ old_extent_, \ lb_, \ ub_) \{ \ if (cnt_ == 0) { \ lb_ = old_lb_; \ ub_ = old_ub_; \ } \ else if (old_ub_ >= old_lb_) { \ lb_ = old_lb_; \ ub_ = old_ub_ + (old_extent_) * (cnt_ - 1); \ } \ else /* negative extent */ { \ lb_ = old_lb_ + (old_extent_) * (cnt_ - 1); \ ub_ = old_ub_; \ } \}/* MPID_DATATYPE_VECTOR_LB_UB() * * Determines the new LB and UB for a vector of blocks of old types * given the old type's LB, UB, and extent, and a count, stride, and * blocklen describing the vectorization. */#define MPID_DATATYPE_VECTOR_LB_UB(cnt_, \ stride_, \ blklen_, \ old_lb_, \ old_ub_, \ old_extent_, \ lb_, \ ub_) \{ \ if (cnt_ == 0 || blklen_ == 0) { \ lb_ = old_lb_; \ ub_ = old_ub_; \ } \ else if (stride_ >= 0 && (old_extent_) >= 0) { \ lb_ = old_lb_; \ ub_ = old_ub_ + (old_extent_) * ((blklen_) - 1) + \ (stride_) * ((cnt_) - 1); \ } \ else if (stride_ < 0 && (old_extent_) >= 0) { \ lb_ = old_lb_ + (stride_) * ((cnt_) - 1); \ ub_ = old_ub_ + (old_extent_) * ((blklen_) - 1); \ } \ else if (stride_ >= 0 && (old_extent_) < 0) { \ lb_ = old_lb_ + (old_extent_) * ((blklen_) - 1); \ ub_ = old_ub_ + (stride_) * ((cnt_) - 1); \ } \ else { \ lb_ = old_lb_ + (old_extent_) * ((blklen_) - 1) + \ (stride_) * ((cnt_) - 1); \ ub_ = old_ub_; \ } \}/* MPID_DATATYPE_BLOCK_LB_UB() * * Determines the new LB and UB for a block of old types given the LB, * UB, and extent of the old type as well as a new displacement and count * of types. * * Note: we need the extent here in addition to the lb and ub because the * extent might have some padding in it that we need to take into account. */#define MPID_DATATYPE_BLOCK_LB_UB(cnt_, \ disp_, \ old_lb_, \ old_ub_, \ old_extent_, \ lb_, \ ub_) \{ \ if (cnt_ == 0) { \ lb_ = old_lb_ + (disp_); \ ub_ = old_ub_ + (disp_); \ } \ else if (old_ub_ >= old_lb_) { \ lb_ = old_lb_ + (disp_); \ ub_ = old_ub_ + (disp_) + (old_extent_) * ((cnt_) - 1); \ } \ else /* negative extent */ { \ lb_ = old_lb_ + (disp_) + (old_extent_) * ((cnt_) - 1); \ ub_ = old_ub_ + (disp_); \ } \}/* Datatype functions */int MPID_Type_commit(MPI_Datatype *type);int MPID_Type_dup(MPI_Datatype oldtype, MPI_Datatype *newtype);int MPID_Type_struct(int count, int *blocklength_array, MPI_Aint *displacement_array, MPI_Datatype *oldtype_array, MPI_Datatype *newtype);int MPID_Type_indexed(int count, int *blocklength_array, void *displacement_array, int dispinbytes, MPI_Datatype oldtype, MPI_Datatype *newtype);int MPID_Type_blockindexed(int count, int blocklength, void *displacement_array, int dispinbytes, MPI_Datatype oldtype, MPI_Datatype *newtype);int MPID_Type_vector(int count, int blocklength, MPI_Aint stride, int strideinbytes, MPI_Datatype oldtype, MPI_Datatype *newtype);int MPID_Type_contiguous(int count, MPI_Datatype oldtype, MPI_Datatype *newtype);int MPID_Type_zerolen(MPI_Datatype *newtype);int MPID_Type_create_resized(MPI_Datatype oldtype, MPI_Aint lb, MPI_Aint extent, MPI_Datatype *newtype);int MPID_Type_get_envelope(MPI_Datatype datatype, int *num_integers, int *num_addresses, int *num_datatypes, int *combiner);int MPID_Type_get_contents(MPI_Datatype datatype, int max_integers, int max_addresses, int max_datatypes, int array_of_integers[], MPI_Aint array_of_addresses[], MPI_Datatype array_of_datatypes[]);int MPID_Type_create_pairtype(MPI_Datatype datatype, MPID_Datatype *new_dtp);/* internal debugging functions */void MPIDI_Datatype_printf(MPI_Datatype type, int depth, MPI_Aint displacement, int blocklength, int header);/* Dataloop functions */void MPID_Dataloop_copy(void *dest, void *src, int size);void MPID_Dataloop_print(struct MPID_Dataloop *dataloop, int depth);void MPID_Dataloop_alloc(int kind, int count, DLOOP_Dataloop **new_loop_p, int *new_loop_sz_p);void MPID_Dataloop_alloc_and_copy(int kind, int count, struct DLOOP_Dataloop *old_loop, int old_loop_sz, struct DLOOP_Dataloop **new_loop_p, int *new_loop_sz_p);void MPID_Dataloop_struct_alloc(int count, int old_loop_sz, int basic_ct, DLOOP_Dataloop **old_loop_p, DLOOP_Dataloop **new_loop_p, int *new_loop_sz_p);void MPID_Dataloop_dup(DLOOP_Dataloop *old_loop, int old_loop_sz, DLOOP_Dataloop **new_loop_p);void MPID_Dataloop_free(struct MPID_Dataloop **dataloop);/* Segment functions specific to MPICH2 */void MPID_Segment_pack_vector(struct DLOOP_Segment *segp, DLOOP_Offset first, DLOOP_Offset *lastp, DLOOP_VECTOR *vector, int *lengthp);void MPID_Segment_unpack_vector(struct DLOOP_Segment *segp, DLOOP_Offset first, DLOOP_Offset *lastp, DLOOP_VECTOR *vector, int *lengthp);void MPID_Segment_flatten(struct DLOOP_Segment *segp, DLOOP_Offset first, DLOOP_Offset *lastp, DLOOP_Offset *offp, int *sizep, DLOOP_Offset *lengthp);/* misc */int MPID_Datatype_set_contents(struct MPID_Datatype *ptr, int combiner, int nr_ints, int nr_aints, int nr_types, int *ints, MPI_Aint *aints, MPI_Datatype *types);void MPID_Datatype_free_contents(struct MPID_Datatype *ptr);void MPIDI_Datatype_get_contents_aints(MPID_Datatype_contents *cp, MPI_Aint *user_aints);void MPIDI_Datatype_get_contents_types(MPID_Datatype_contents *cp, MPI_Datatype *user_types);void MPIDI_Datatype_get_contents_ints(MPID_Datatype_contents *cp, int *user_ints);void MPID_Datatype_free(struct MPID_Datatype *ptr);void MPID_Dataloop_update(struct DLOOP_Dataloop *dataloop, MPI_Aint ptrdiff);int MPIR_Type_get_contig_blocks(MPI_Datatype type, int *nr_blocks_p);int MPIR_Type_flatten(MPI_Datatype type, MPI_Aint *off_array, int *size_array, MPI_Aint *array_len_p);void MPID_Segment_pack_external32(struct DLOOP_Segment *segp, DLOOP_Offset first, DLOOP_Offset *lastp, void *pack_buffer);void MPID_Segment_unpack_external32(struct DLOOP_Segment *segp, DLOOP_Offset first, DLOOP_Offset *lastp, DLOOP_Buffer unpack_buffer);MPI_Aint MPID_Datatype_size_external32(MPI_Datatype type);MPI_Aint MPIDI_Datatype_get_basic_size_external32(MPI_Datatype el_type);/* debugging helper functions */char *MPIDU_Datatype_builtin_to_string(MPI_Datatype type);char *MPIDU_Datatype_combiner_to_string(int combiner);void MPIDU_Datatype_debug(MPI_Datatype type, int array_ct);/* contents accessor functions */void MPID_Type_access_contents(MPI_Datatype type, int **ints_p, MPI_Aint **aints_p, MPI_Datatype **types_p);void MPID_Type_release_contents(MPI_Datatype type, int **ints_p, MPI_Aint **aints_p, MPI_Datatype **types_p);/* end of file */#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -