⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mpid_type_debug.c

📁 fortran并行计算包
💻 C
📖 第 1 页 / 共 2 页
字号:
    static char t_floatint[]         = "MPI_FLOAT_INT";    static char t_doubleint[]        = "MPI_DOUBLE_INT";    static char t_longint[]          = "MPI_LONG_INT";    static char t_shortint[]         = "MPI_SHORT_INT";    static char t_2int[]             = "MPI_2INT";    static char t_longdoubleint[]    = "MPI_LONG_DOUBLE_INT";    static char t_complex[]          = "MPI_COMPLEX";    static char t_doublecomplex[]    = "MPI_DOUBLE_COMPLEX";    static char t_logical[]          = "MPI_LOGICAL";    static char t_real[]             = "MPI_REAL";    static char t_doubleprecision[]  = "MPI_DOUBLE_PRECISION";    static char t_integer[]          = "MPI_INTEGER";    static char t_2integer[]         = "MPI_2INTEGER";    static char t_2complex[]         = "MPI_2COMPLEX";    static char t_2doublecomplex[]   = "MPI_2DOUBLE_COMPLEX";    static char t_2real[]            = "MPI_2REAL";    static char t_2doubleprecision[] = "MPI_2DOUBLE_PRECISION";    static char t_character[]        = "MPI_CHARACTER";    if (type == MPI_CHAR)              return t_char;    if (type == MPI_UNSIGNED_CHAR)     return t_uchar;    if (type == MPI_SIGNED_CHAR)       return t_schar;    if (type == MPI_BYTE)              return t_byte;    if (type == MPI_WCHAR)             return t_wchar_t;    if (type == MPI_SHORT)             return t_short;    if (type == MPI_UNSIGNED_SHORT)    return t_ushort;    if (type == MPI_INT)               return t_int;    if (type == MPI_UNSIGNED)          return t_uint;    if (type == MPI_LONG)              return t_long;    if (type == MPI_UNSIGNED_LONG)     return t_ulong;    if (type == MPI_FLOAT)             return t_float;    if (type == MPI_DOUBLE)            return t_double;    if (type == MPI_LONG_DOUBLE)       return t_longdouble;    if (type == MPI_LONG_LONG_INT)     return t_longlongint;    if (type == MPI_LONG_LONG)         return t_longlong;    if (type == MPI_UNSIGNED_LONG_LONG) return t_ulonglong;	    if (type == MPI_PACKED)            return t_packed;    if (type == MPI_LB)                return t_lb;    if (type == MPI_UB)                return t_ub;	    if (type == MPI_FLOAT_INT)         return t_floatint;    if (type == MPI_DOUBLE_INT)        return t_doubleint;    if (type == MPI_LONG_INT)          return t_longint;    if (type == MPI_SHORT_INT)         return t_shortint;    if (type == MPI_2INT)              return t_2int;    if (type == MPI_LONG_DOUBLE_INT)   return t_longdoubleint;	    if (type == MPI_COMPLEX)           return t_complex;    if (type == MPI_DOUBLE_COMPLEX)    return t_doublecomplex;    if (type == MPI_LOGICAL)           return t_logical;    if (type == MPI_REAL)              return t_real;    if (type == MPI_DOUBLE_PRECISION)  return t_doubleprecision;    if (type == MPI_INTEGER)           return t_integer;    if (type == MPI_2INTEGER)          return t_2integer;    if (type == MPI_2COMPLEX)          return t_2complex;    if (type == MPI_2DOUBLE_COMPLEX)   return t_2doublecomplex;    if (type == MPI_2REAL)             return t_2real;    if (type == MPI_2DOUBLE_PRECISION) return t_2doubleprecision;    if (type == MPI_CHARACTER)         return t_character;        return NULL;}/* MPIDU_Datatype_combiner_to_string(combiner) * * Converts a numeric combiner into a pointer to a string used for printing. * * longest string is 16 characters. */char *MPIDU_Datatype_combiner_to_string(int combiner){    static char c_named[]    = "named";    static char c_contig[]   = "contig";    static char c_vector[]   = "vector";    static char c_hvector[]  = "hvector";    static char c_indexed[]  = "indexed";    static char c_hindexed[] = "hindexed";    static char c_struct[]   = "struct";    static char c_dup[]              = "dup";    static char c_hvector_integer[]  = "hvector_integer";    static char c_hindexed_integer[] = "hindexed_integer";    static char c_indexed_block[]    = "indexed_block";    static char c_struct_integer[]   = "struct_integer";    static char c_subarray[]         = "subarray";    static char c_darray[]           = "darray";    static char c_f90_real[]         = "f90_real";    static char c_f90_complex[]      = "f90_complex";    static char c_f90_integer[]      = "f90_integer";    static char c_resized[]          = "resized";    if (combiner == MPI_COMBINER_NAMED)      return c_named;    if (combiner == MPI_COMBINER_CONTIGUOUS) return c_contig;    if (combiner == MPI_COMBINER_VECTOR)     return c_vector;    if (combiner == MPI_COMBINER_HVECTOR)    return c_hvector;    if (combiner == MPI_COMBINER_INDEXED)    return c_indexed;    if (combiner == MPI_COMBINER_HINDEXED)   return c_hindexed;    if (combiner == MPI_COMBINER_STRUCT)     return c_struct;    if (combiner == MPI_COMBINER_DUP)              return c_dup;    if (combiner == MPI_COMBINER_HVECTOR_INTEGER)  return c_hvector_integer;    if (combiner == MPI_COMBINER_HINDEXED_INTEGER) return c_hindexed_integer;    if (combiner == MPI_COMBINER_INDEXED_BLOCK)    return c_indexed_block;    if (combiner == MPI_COMBINER_STRUCT_INTEGER)   return c_struct_integer;    if (combiner == MPI_COMBINER_SUBARRAY)         return c_subarray;    if (combiner == MPI_COMBINER_DARRAY)           return c_darray;    if (combiner == MPI_COMBINER_F90_REAL)         return c_f90_real;    if (combiner == MPI_COMBINER_F90_COMPLEX)      return c_f90_complex;    if (combiner == MPI_COMBINER_F90_INTEGER)      return c_f90_integer;    if (combiner == MPI_COMBINER_RESIZED)          return c_resized;        return NULL;}/* --BEGIN ERROR HANDLING-- */void MPIDU_Datatype_debug(MPI_Datatype type,			  int array_ct){    int is_builtin;    MPID_Datatype *dtp;    is_builtin = (HANDLE_GET_KIND(type) == HANDLE_KIND_BUILTIN);    /* can get a NULL type a number of different ways, including not having     * fortran support included.     */    if (type == MPI_DATATYPE_NULL) {	MPIU_DBG_OUT_FMT(DATATYPE,			 (MPIU_DBG_FDEST,			  "# MPIU_Datatype_debug: MPI_Datatype = MPI_DATATYPE_NULL"));	return;    }    MPIU_DBG_OUT_FMT(DATATYPE,(MPIU_DBG_FDEST,	       "# MPIU_Datatype_debug: MPI_Datatype = 0x%0x (%s)", type,	       (is_builtin) ? MPIDU_Datatype_builtin_to_string(type) :	        "derived"));    if (is_builtin) return;    MPID_Datatype_get_ptr(type, dtp);    MPIU_Assert(dtp != NULL);    MPIU_DBG_OUT_FMT(DATATYPE,(MPIU_DBG_FDEST,      "# Size = %d, Extent = %d, LB = %d%s, UB = %d%s, Extent = %d, Element Size = %d (%s), %s",		    (int) dtp->size,		    (int) dtp->extent,		    (int) dtp->lb,		    (dtp->has_sticky_lb) ? "(sticky)" : "",		    (int) dtp->ub,		    (dtp->has_sticky_ub) ? "(sticky)" : "",		    (int) dtp->extent,		    (int) dtp->element_size,		    dtp->element_size == -1 ? "multiple types" :		    MPIDU_Datatype_builtin_to_string(dtp->eltype),		    dtp->is_contig ? "is N contig" : "is not N contig"));    MPIU_DBG_OUT(DATATYPE,"# Contents:");    MPIDI_Datatype_contents_printf(type, 0, array_ct);    MPIU_DBG_OUT(DATATYPE,"# Dataloop:");    MPIDI_Datatype_dot_printf(type, 0, 1);}static char *MPIDI_Datatype_depth_spacing(int depth){    static char d0[] = "";    static char d1[] = "  ";    static char d2[] = "    ";    static char d3[] = "      ";    static char d4[] = "        ";    static char d5[] = "          ";    switch (depth) {	case 0: return d0;	case 1: return d1;	case 2: return d2;	case 3: return d3;	case 4: return d4;	default: return d5;    }}void MPIDI_Datatype_contents_printf(MPI_Datatype type,				    int depth,				    int acount){    int i;    MPID_Datatype *dtp;    MPID_Datatype_contents *cp;    MPI_Aint *aints;    MPI_Datatype *types;    int *ints;    if (HANDLE_GET_KIND(type) == HANDLE_KIND_BUILTIN) {	MPIU_DBG_OUT_FMT(DATATYPE,(MPIU_DBG_FDEST,"# %stype: %s\n",			MPIDI_Datatype_depth_spacing(depth),			MPIDU_Datatype_builtin_to_string(type)));	return;    }    MPID_Datatype_get_ptr(type, dtp);    cp = dtp->contents;    if (cp == NULL) {	MPIU_DBG_OUT_FMT(DATATYPE,(MPIU_DBG_FDEST,"# <NULL>\n"));	return;    }    types = (MPI_Datatype *) (((char *) cp) +			      sizeof(MPID_Datatype_contents));    ints  = (int *) (((char *) types) +		     cp->nr_types * sizeof(MPI_Datatype));    aints = (MPI_Aint *) (((char *) ints) +			  cp->nr_ints * sizeof(int));    MPIU_DBG_OUT_FMT(DATATYPE,(MPIU_DBG_FDEST,"# %scombiner: %s",		    MPIDI_Datatype_depth_spacing(depth),		    MPIDU_Datatype_combiner_to_string(cp->combiner)));    switch (cp->combiner) {	case MPI_COMBINER_NAMED:	case MPI_COMBINER_DUP:	    return;	case MPI_COMBINER_RESIZED:	    /* not done */	    return;	case MPI_COMBINER_CONTIGUOUS:	    MPIU_DBG_OUT_FMT(DATATYPE,(MPIU_DBG_FDEST,"# %scontig ct = %d\n", 			    MPIDI_Datatype_depth_spacing(depth),				       *ints));	    MPIDI_Datatype_contents_printf(*types,					   depth + 1,					   acount);	    return;	case MPI_COMBINER_VECTOR:	    MPIU_DBG_OUT_FMT(DATATYPE,(MPIU_DBG_FDEST,	                "# %svector ct = %d, blk = %d, str = %d\n",			MPIDI_Datatype_depth_spacing(depth), 			    ints[0],			    ints[1],			    ints[2]));	    MPIDI_Datatype_contents_printf(*types,					   depth + 1,					   acount);	    return;        case MPI_COMBINER_HVECTOR:	    MPIU_DBG_OUT_FMT(DATATYPE,(MPIU_DBG_FDEST,	                  "# %shvector ct = %d, blk = %d, str = %d\n",			    MPIDI_Datatype_depth_spacing(depth),			    ints[0],			    ints[1],			    (int) aints[0]));	    MPIDI_Datatype_contents_printf(*types,					   depth + 1,					   acount);	    return;	case MPI_COMBINER_INDEXED:	    MPIU_DBG_OUT_FMT(DATATYPE,(MPIU_DBG_FDEST,"# %sindexed ct = %d:",			    MPIDI_Datatype_depth_spacing(depth),			    ints[0]));	    for (i=0; i < acount && i < ints[0]; i++) {		MPIU_DBG_OUT_FMT(DATATYPE,(MPIU_DBG_FDEST,		         "# %s  indexed [%d]: blk = %d, disp = %d\n",				MPIDI_Datatype_depth_spacing(depth),				i,				ints[i+1],				ints[i+(cp->nr_ints/2)+1]));		MPIDI_Datatype_contents_printf(*types,					       depth + 1,					       acount);	    }	    return;	case MPI_COMBINER_HINDEXED:	    MPIU_DBG_OUT_FMT(DATATYPE,(MPIU_DBG_FDEST,"# %shindexed ct = %d:",			    MPIDI_Datatype_depth_spacing(depth),			    ints[0]));	    for (i=0; i < acount && i < ints[0]; i++) {		MPIU_DBG_OUT_FMT(DATATYPE,(MPIU_DBG_FDEST,		            "# %s  hindexed [%d]: blk = %d, disp = %d\n",				MPIDI_Datatype_depth_spacing(depth),				i,				(int) ints[i+1],				(int) aints[i]));		MPIDI_Datatype_contents_printf(*types,					       depth + 1,					       acount);	    }	    return;	case MPI_COMBINER_STRUCT:	    MPIU_DBG_OUT_FMT(DATATYPE,(MPIU_DBG_FDEST,"# %sstruct ct = %d:",			    MPIDI_Datatype_depth_spacing(depth),			    (int) ints[0]));	    for (i=0; i < acount && i < ints[0]; i++) {		MPIU_DBG_OUT_FMT(DATATYPE,(MPIU_DBG_FDEST,		           "# %s  struct[%d]: blk = %d, disp = %d\n",				MPIDI_Datatype_depth_spacing(depth),				i,				(int) ints[i+1],				(int) aints[i]));		MPIDI_Datatype_contents_printf(types[i],					       depth + 1,					       acount);	    }	    return;	default:	    MPIU_DBG_OUT_FMT(DATATYPE,(MPIU_DBG_FDEST,"# %sunhandled combiner",			MPIDI_Datatype_depth_spacing(depth)));	    return;    }}/* --END ERROR HANDLING-- */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -