-: 0:Source:/home/MPI/testing/mpich2/mpich2/src/mpid/common/datatype/dataloop/dataloop_create_contig.c
-: 0:Graph:dataloop_create_contig.gcno
-: 0:Data:dataloop_create_contig.gcda
-: 0:Runs:3459
-: 0:Programs:899
-: 1:/* -*- Mode: C; c-basic-offset:4 ; -*- */
-: 2:
-: 3:/*
-: 4: * (C) 2001 by Argonne National Laboratory.
-: 5: * See COPYRIGHT in top-level directory.
-: 6: */
-: 7:
-: 8:#include "./dataloop.h"
-: 9:
-: 10:/*@
-: 11: Dataloop_contiguous - create the dataloop representation for a
-: 12: contiguous datatype
-: 13:
-: 14: Arguments:
-: 15:+ int icount,
-: 16:. MPI_Datatype oldtype,
-: 17:. DLOOP_Dataloop **dlp_p,
-: 18:. int *dlsz_p,
-: 19:. int *dldepth_p,
-: 20:- int flag
-: 21:
-: 22:.N Errors
-: 23:.N Returns 0 on success, -1 on failure.
-: 24:@*/
-: 25:int PREPEND_PREFIX(Dataloop_create_contiguous)(int icount,
-: 26: DLOOP_Type oldtype,
-: 27: DLOOP_Dataloop **dlp_p,
-: 28: int *dlsz_p,
-: 29: int *dldepth_p,
-: 30: int flag)
145672: 31:{
-: 32: DLOOP_Count count;
145672: 33: int is_builtin, apply_contig_coalescing = 0;
-: 34: int new_loop_sz, new_loop_depth;
-: 35:
-: 36: DLOOP_Dataloop *new_dlp;
-: 37:
145672: 38: count = (DLOOP_Count) icount; /* avoid subsequent casting */
-: 39:
145672: 40: is_builtin = (DLOOP_Handle_hasloop_macro(oldtype)) ? 0 : 1;
-: 41:
145672: 42: if (is_builtin)
-: 43: {
139682: 44: new_loop_depth = 1;
-: 45: }
-: 46: else
-: 47: {
5990: 48: int old_loop_sz = 0, old_loop_depth = 0;
5990: 49: DLOOP_Offset old_size = 0, old_extent = 0;
-: 50: DLOOP_Dataloop *old_loop_ptr;
-: 51:
5990: 52: DLOOP_Handle_get_loopsize_macro(oldtype, old_loop_sz, flag);
5990: 53: DLOOP_Handle_get_loopdepth_macro(oldtype, old_loop_depth, flag);
5990: 54: DLOOP_Handle_get_loopptr_macro(oldtype, old_loop_ptr, flag);
5990: 55: DLOOP_Handle_get_size_macro(oldtype, old_size);
5990: 56: DLOOP_Handle_get_extent_macro(oldtype, old_extent);
-: 57:
-: 58: /* if we have a simple combination of contigs, coalesce */
5990: 59: if (((old_loop_ptr->kind & DLOOP_KIND_MASK) == DLOOP_KIND_CONTIG)
-: 60: && (old_size == old_extent))
-: 61: {
-: 62: /* will just copy contig and multiply count */
584: 63: apply_contig_coalescing = 1;
584: 64: new_loop_depth = old_loop_depth;
-: 65: }
-: 66: else
-: 67: {
5406: 68: new_loop_depth = old_loop_depth + 1;
-: 69: }
-: 70: }
-: 71:
145672: 72: if (is_builtin)
-: 73: {
139682: 74: DLOOP_Offset basic_sz = 0;
-: 75:
139682: 76: PREPEND_PREFIX(Dataloop_alloc)(DLOOP_KIND_CONTIG,
-: 77: count,
-: 78: &new_dlp,
-: 79: &new_loop_sz);
|
139682: 96: new_dlp->el_size = basic_sz;
139682: 97: new_dlp->el_extent = new_dlp->el_size;
139682: 98: new_dlp->el_type = oldtype;
-: 99: }
-: 100:
139682: 101: new_dlp->loop_params.c_t.count = count;
-: 102: }
-: 103: else
-: 104: {
-: 105: /* user-defined base type (oldtype) */
-: 106: DLOOP_Dataloop *old_loop_ptr;
5990: 107: int old_loop_sz = 0;
-: 108:
5990: 109: DLOOP_Handle_get_loopptr_macro(oldtype, old_loop_ptr, flag);
5990: 110: DLOOP_Handle_get_loopsize_macro(oldtype, old_loop_sz, flag);
-: 111:
5990: 112: if (apply_contig_coalescing)
-: 113: {
-: 114: /* make a copy of the old loop and multiply the count */
584: 115: PREPEND_PREFIX(Dataloop_dup)(old_loop_ptr,
-: 116: old_loop_sz,
-: 117: &new_dlp);
|
584: 122: new_dlp->loop_params.c_t.count *= count;
-: 123:
584: 124: new_loop_sz = old_loop_sz;
584: 125: DLOOP_Handle_get_loopdepth_macro(oldtype, new_loop_depth, flag);
-: 126: }
-: 127: else
-: 128: {
-: 129: /* allocate space for new loop including copy of old */
5406: 130: PREPEND_PREFIX(Dataloop_alloc_and_copy)(DLOOP_KIND_CONTIG,
-: 131: count,
-: 132: old_loop_ptr,
-: 133: old_loop_sz,
-: 134: &new_dlp,
-: 135: &new_loop_sz);
|
5406: 140: new_dlp->kind = DLOOP_KIND_CONTIG;
5406: 141: DLOOP_Handle_get_size_macro(oldtype, new_dlp->el_size);
5406: 142: DLOOP_Handle_get_extent_macro(oldtype, new_dlp->el_extent);
5406: 143: DLOOP_Handle_get_basic_type_macro(oldtype, new_dlp->el_type);
-: 144:
5406: 145: new_dlp->loop_params.c_t.count = count;
-: 146: }
-: 147: }
-: 148:
145672: 149: *dlp_p = new_dlp;
145672: 150: *dlsz_p = new_loop_sz;
145672: 151: *dldepth_p = new_loop_depth;
-: 152:
145672: 153: return 0;
-: 154:}
|