-: 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:4381
-: 0:Programs:1376
-: 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)
186322: 31:{
-: 32: DLOOP_Count count;
186322: 33: int is_builtin, apply_contig_coalescing = 0;
-: 34: int new_loop_sz, new_loop_depth;
-: 35:
-: 36: DLOOP_Dataloop *new_dlp;
-: 37:
186322: 38: count = (DLOOP_Count) icount; /* avoid subsequent casting */
-: 39:
186322: 40: is_builtin = (DLOOP_Handle_hasloop_macro(oldtype)) ? 0 : 1;
-: 41:
186322: 42: if (is_builtin)
-: 43: {
178852: 44: new_loop_depth = 1;
-: 45: }
-: 46: else
-: 47: {
7470: 48: int old_loop_sz = 0, old_loop_depth = 0;
7470: 49: DLOOP_Offset old_size = 0, old_extent = 0;
-: 50: DLOOP_Dataloop *old_loop_ptr;
-: 51:
7470: 52: DLOOP_Handle_get_loopsize_macro(oldtype, old_loop_sz, flag);
7470: 53: DLOOP_Handle_get_loopdepth_macro(oldtype, old_loop_depth, flag);
7470: 54: DLOOP_Handle_get_loopptr_macro(oldtype, old_loop_ptr, flag);
7470: 55: DLOOP_Handle_get_size_macro(oldtype, old_size);
7470: 56: DLOOP_Handle_get_extent_macro(oldtype, old_extent);
-: 57:
-: 58: /* if we have a simple combination of contigs, coalesce */
7470: 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 */
662: 63: apply_contig_coalescing = 1;
662: 64: new_loop_depth = old_loop_depth;
-: 65: }
-: 66: else
-: 67: {
6808: 68: new_loop_depth = old_loop_depth + 1;
-: 69: }
-: 70: }
-: 71:
186322: 72: if (is_builtin)
-: 73: {
178852: 74: DLOOP_Offset basic_sz = 0;
-: 75:
178852: 76: PREPEND_PREFIX(Dataloop_alloc)(DLOOP_KIND_CONTIG,
-: 77: count,
-: 78: &new_dlp,
-: 79: &new_loop_sz);
|
178852: 96: new_dlp->el_size = basic_sz;
178852: 97: new_dlp->el_extent = new_dlp->el_size;
178852: 98: new_dlp->el_type = oldtype;
-: 99: }
-: 100:
178852: 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;
7470: 107: int old_loop_sz = 0;
-: 108:
7470: 109: DLOOP_Handle_get_loopptr_macro(oldtype, old_loop_ptr, flag);
7470: 110: DLOOP_Handle_get_loopsize_macro(oldtype, old_loop_sz, flag);
-: 111:
7470: 112: if (apply_contig_coalescing)
-: 113: {
-: 114: /* make a copy of the old loop and multiply the count */
662: 115: PREPEND_PREFIX(Dataloop_dup)(old_loop_ptr,
-: 116: old_loop_sz,
-: 117: &new_dlp);
|
662: 122: new_dlp->loop_params.c_t.count *= count;
-: 123:
662: 124: new_loop_sz = old_loop_sz;
662: 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 */
6808: 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);
|
6808: 140: new_dlp->kind = DLOOP_KIND_CONTIG;
6808: 141: DLOOP_Handle_get_size_macro(oldtype, new_dlp->el_size);
6808: 142: DLOOP_Handle_get_extent_macro(oldtype, new_dlp->el_extent);
6808: 143: DLOOP_Handle_get_basic_type_macro(oldtype, new_dlp->el_type);
-: 144:
6808: 145: new_dlp->loop_params.c_t.count = count;
-: 146: }
-: 147: }
-: 148:
186322: 149: *dlp_p = new_dlp;
186322: 150: *dlsz_p = new_loop_sz;
186322: 151: *dldepth_p = new_loop_depth;
-: 152:
186322: 153: return 0;
-: 154:}
|