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; }
/* --BEGIN ERROR HANDLING-- */ void MPIDI_Datatype_dot_printf(MPI_Datatype type, int depth, int header) { if (HANDLE_GET_KIND(type) == HANDLE_KIND_BUILTIN) { MPL_DBG_OUT(MPIR_DBG_DATATYPE, "MPIDI_Datatype_dot_printf: type is a basic"); return; } else { MPIDU_Datatype *dt_p; MPIDU_Dataloop *loop_p; MPIDU_Datatype_get_ptr(type, dt_p); loop_p = dt_p->dataloop; MPIDI_Dataloop_dot_printf(loop_p, depth, header); return; } }
void MPIDI_Dataloop_dot_printf(MPIDU_Dataloop *loop_p, int depth, int header) { int i; if (loop_p == NULL) { MPL_DBG_OUT_FMT(MPIR_DBG_DATATYPE,(MPL_DBG_FDEST,"<null dataloop>\n")); return; } if (header) { MPL_DBG_OUT_FMT(MPIR_DBG_DATATYPE,(MPL_DBG_FDEST, /* graphviz does not like the 0xNNN format */ "digraph %lld { {", (long long int)loop_p)); } switch (loop_p->kind & DLOOP_KIND_MASK) { case DLOOP_KIND_CONTIG: MPL_DBG_OUT_FMT(MPIR_DBG_DATATYPE,(MPL_DBG_FDEST, " dl%d [shape = record, label = \"contig |{ ct = %d; el_sz = " MPI_AINT_FMT_DEC_SPEC "; el_ext = " MPI_AINT_FMT_DEC_SPEC " }\"];", depth, (int) loop_p->loop_params.c_t.count, (MPI_Aint) loop_p->el_size, (MPI_Aint) loop_p->el_extent)); break; case DLOOP_KIND_VECTOR: MPL_DBG_OUT_FMT(MPIR_DBG_DATATYPE,(MPL_DBG_FDEST, " dl%d [shape = record, label = \"vector |{ ct = %d; blk = %d; str = " MPI_AINT_FMT_DEC_SPEC "; el_sz = " MPI_AINT_FMT_DEC_SPEC "; el_ext = "MPI_AINT_FMT_DEC_SPEC " }\"];", depth, (int) loop_p->loop_params.v_t.count, (int) loop_p->loop_params.v_t.blocksize, (MPI_Aint) loop_p->loop_params.v_t.stride, (MPI_Aint) loop_p->el_size, (MPI_Aint) loop_p->el_extent)); break; case DLOOP_KIND_INDEXED: MPL_DBG_OUT_FMT(MPIR_DBG_DATATYPE,(MPL_DBG_FDEST, " dl%d [shape = record, label = \"indexed |{ ct = %d; tot_blks = %d; regions = ", depth, (int) loop_p->loop_params.i_t.count, (int) loop_p->loop_params.i_t.total_blocks)); for (i=0; i < NR_TYPE_CUTOFF && i < loop_p->loop_params.i_t.count; i++) { if (i + 1 < loop_p->loop_params.i_t.count) { /* more regions after this one */ MPL_DBG_OUT_FMT(MPIR_DBG_DATATYPE,(MPL_DBG_FDEST, "\\n(" MPI_AINT_FMT_DEC_SPEC ", %d), ", (MPI_Aint) loop_p->loop_params.i_t.offset_array[i], (int) loop_p->loop_params.i_t.blocksize_array[i])); } else { MPL_DBG_OUT_FMT(MPIR_DBG_DATATYPE,(MPL_DBG_FDEST, "\\n(" MPI_AINT_FMT_DEC_SPEC ", %d); ", (MPI_Aint) loop_p->loop_params.i_t.offset_array[i], (int) loop_p->loop_params.i_t.blocksize_array[i])); } } if (i < loop_p->loop_params.i_t.count) { MPL_DBG_OUT(MPIR_DBG_DATATYPE,"\\n...; "); } MPL_DBG_OUT_FMT(MPIR_DBG_DATATYPE,(MPL_DBG_FDEST, "\\nel_sz = " MPI_AINT_FMT_DEC_SPEC "; el_ext = " MPI_AINT_FMT_DEC_SPEC " }\"];\n", (MPI_Aint) loop_p->el_size, (MPI_Aint) loop_p->el_extent)); break; case DLOOP_KIND_BLOCKINDEXED: MPL_DBG_OUT_FMT(MPIR_DBG_DATATYPE,(MPL_DBG_FDEST, " dl%d [shape = record, label = \"blockindexed |{ ct = %d; blk = %d; disps = ", depth, (int) loop_p->loop_params.bi_t.count, (int) loop_p->loop_params.bi_t.blocksize)); for (i=0; i < NR_TYPE_CUTOFF && i < loop_p->loop_params.bi_t.count; i++) { if (i + 1 < loop_p->loop_params.bi_t.count) { /* more regions after this one */ MPL_DBG_OUT_FMT(MPIR_DBG_DATATYPE,(MPL_DBG_FDEST, MPI_AINT_FMT_DEC_SPEC ",\\n ", (MPI_Aint) loop_p->loop_params.bi_t.offset_array[i])); } else { MPL_DBG_OUT_FMT(MPIR_DBG_DATATYPE,(MPL_DBG_FDEST, MPI_AINT_FMT_DEC_SPEC "; ", (MPI_Aint) loop_p->loop_params.bi_t.offset_array[i])); } } if (i < loop_p->loop_params.bi_t.count) { MPL_DBG_OUT(MPIR_DBG_DATATYPE,"...; "); } MPL_DBG_OUT_FMT(MPIR_DBG_DATATYPE,(MPL_DBG_FDEST, "\\nel_sz = " MPI_AINT_FMT_DEC_SPEC "; el_ext = " MPI_AINT_FMT_DEC_SPEC " }\"];", (MPI_Aint) loop_p->el_size, (MPI_Aint) loop_p->el_extent)); break; case DLOOP_KIND_STRUCT: MPL_DBG_OUT_FMT(MPIR_DBG_DATATYPE,(MPL_DBG_FDEST, " dl%d [shape = record, label = \"struct | {ct = %d; blks = ", depth, (int) loop_p->loop_params.s_t.count)); for (i=0; i < NR_TYPE_CUTOFF && i < loop_p->loop_params.s_t.count; i++) { if (i + 1 < loop_p->loop_params.s_t.count) { MPL_DBG_OUT_FMT(MPIR_DBG_DATATYPE,(MPL_DBG_FDEST,"%d, ", (int) loop_p->loop_params.s_t.blocksize_array[i])); } else { MPL_DBG_OUT_FMT(MPIR_DBG_DATATYPE,(MPL_DBG_FDEST,"%d; ", (int) loop_p->loop_params.s_t.blocksize_array[i])); } } if (i < loop_p->loop_params.s_t.count) { MPL_DBG_OUT(MPIR_DBG_DATATYPE,"...; disps = "); } else { MPL_DBG_OUT(MPIR_DBG_DATATYPE,"disps = "); } for (i=0; i < NR_TYPE_CUTOFF && i < loop_p->loop_params.s_t.count; i++) { if (i + 1 < loop_p->loop_params.s_t.count) { MPL_DBG_OUT_FMT(MPIR_DBG_DATATYPE,(MPL_DBG_FDEST,MPI_AINT_FMT_DEC_SPEC ", ", (MPI_Aint) loop_p->loop_params.s_t.offset_array[i])); } else { MPL_DBG_OUT_FMT(MPIR_DBG_DATATYPE,(MPL_DBG_FDEST,MPI_AINT_FMT_DEC_SPEC "; ", (MPI_Aint) loop_p->loop_params.s_t.offset_array[i])); } } if (i < loop_p->loop_params.s_t.count) { MPL_DBG_OUT(MPIR_DBG_DATATYPE,"... }\"];"); } else { MPL_DBG_OUT(MPIR_DBG_DATATYPE,"}\"];"); } break; default: MPIR_Assert(0); } if (!(loop_p->kind & DLOOP_FINAL_MASK)) { /* more loops to go; recurse */ MPL_DBG_OUT_FMT(MPIR_DBG_DATATYPE,(MPL_DBG_FDEST, " dl%d -> dl%d;\n", depth, depth + 1)); switch (loop_p->kind & DLOOP_KIND_MASK) { case DLOOP_KIND_CONTIG: MPIDI_Dataloop_dot_printf(loop_p->loop_params.c_t.dataloop, depth + 1, 0); break; case DLOOP_KIND_VECTOR: MPIDI_Dataloop_dot_printf(loop_p->loop_params.v_t.dataloop, depth + 1, 0); break; case DLOOP_KIND_INDEXED: MPIDI_Dataloop_dot_printf(loop_p->loop_params.i_t.dataloop, depth + 1, 0); break; case DLOOP_KIND_BLOCKINDEXED: MPIDI_Dataloop_dot_printf(loop_p->loop_params.bi_t.dataloop, depth + 1, 0); break; case DLOOP_KIND_STRUCT: for (i=0; i < loop_p->loop_params.s_t.count; i++) { MPIDI_Dataloop_dot_printf(loop_p->loop_params.s_t.dataloop_array[i], depth + 1, 0); } break; default: MPL_DBG_OUT(MPIR_DBG_DATATYPE," < unsupported type >"); } } if (header) { MPL_DBG_OUT(MPIR_DBG_DATATYPE," }\n}"); } return; }