-: 0:Source:/home/MPI/testing/mpich2/mpich2/src/mpi/datatype/unpack_external.c
-: 0:Graph:unpack_external.gcno
-: 0:Data:unpack_external.gcda
-: 0:Runs:510
-: 0:Programs:137
-: 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 "mpiimpl.h"
-: 9:
-: 10:/* -- Begin Profiling Symbol Block for routine MPI_Unpack_external */
-: 11:#if defined(HAVE_PRAGMA_WEAK)
-: 12:#pragma weak MPI_Unpack_external = PMPI_Unpack_external
-: 13:#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
-: 14:#pragma _HP_SECONDARY_DEF PMPI_Unpack_external MPI_Unpack_external
-: 15:#elif defined(HAVE_PRAGMA_CRI_DUP)
-: 16:#pragma _CRI duplicate MPI_Unpack_external as PMPI_Unpack_external
-: 17:#endif
-: 18:/* -- End Profiling Symbol Block */
-: 19:
-: 20:/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
-: 21: the MPI routines */
-: 22:#ifndef MPICH_MPI_FROM_PMPI
-: 23:#undef MPI_Unpack_external
-: 24:#define MPI_Unpack_external PMPI_Unpack_external
-: 25:
-: 26:#endif
-: 27:
-: 28:#undef FUNCNAME
-: 29:#define FUNCNAME MPI_Unpack_external
-: 30:
-: 31:/*@
-: 32: MPI_Unpack_external - Unpack a buffer (packed with MPI_Pack_external)
-: 33: according to a datatype into contiguous memory
-: 34:
-: 35: Input Parameters:
-: 36:+ datarep - data representation (string)
-: 37:. inbuf - input buffer start (choice)
-: 38:. insize - input buffer size, in bytes (address integer)
-: 39:. outcount - number of output data items (integer)
-: 40:. datatype - datatype of output data item (handle)
-: 41:
-: 42: Input/Output Parameter:
-: 43:. position - current position in buffer, in bytes (address integer)
-: 44:
-: 45: Output Parameter:
-: 46:. outbuf - output buffer start (choice)
-: 47:
-: 48:.N ThreadSafe
-: 49:
-: 50:.N Fortran
-: 51:
-: 52:.N Errors
-: 53:.N MPI_SUCCESS
-: 54:.N MPI_ERR_TYPE
-: 55:.N MPI_ERR_ARG
-: 56:@*/
-: 57:int MPI_Unpack_external(char *datarep,
-: 58: void *inbuf,
-: 59: MPI_Aint insize,
-: 60: MPI_Aint *position,
-: 61: void *outbuf,
-: 62: int outcount,
-: 63: MPI_Datatype datatype)
4: 64:{
-: 65: static const char FCNAME[] = "MPI_Unpack_external";
4: 66: int mpi_errno = MPI_SUCCESS;
-: 67: MPI_Aint first, last;
-: 68: MPID_Segment *segp;
-: 69: MPID_MPI_STATE_DECL(MPID_STATE_MPI_UNPACK_EXTERNAL);
-: 70:
4: 71: MPIR_ERRTEST_INITIALIZED_ORDIE();
-: 72:
-: 73: MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_UNPACK_EXTERNAL);
-: 74:
-: 75: /* Validate parameters, especially handles needing to be converted */
|
-: 76:# ifdef HAVE_ERROR_CHECKING
-: 77: {
-: 78: MPID_BEGIN_ERROR_CHECKS;
-: 79: {
4: 80: if (insize > 0) {
4: 81: MPIR_ERRTEST_ARGNULL(inbuf, "input buffer", mpi_errno);
-: 82: }
-: 83: /* NOTE: outbuf could be MPI_BOTTOM; don't test for NULL */
4: 84: MPIR_ERRTEST_COUNT(insize, mpi_errno);
4: 85: MPIR_ERRTEST_COUNT(outcount, mpi_errno);
-: 86:
4: 87: MPIR_ERRTEST_DATATYPE(datatype, "datatype", mpi_errno);
4: 88: if (mpi_errno != MPI_SUCCESS) goto fn_fail;
-: 89:
4: 90: if (datatype != MPI_DATATYPE_NULL && HANDLE_GET_KIND(datatype) != HANDLE_KIND_BUILTIN) {
#####: 91: MPID_Datatype *datatype_ptr = NULL;
-: 92:
#####: 93: MPID_Datatype_get_ptr(datatype, datatype_ptr);
#####: 94: MPID_Datatype_valid_ptr(datatype_ptr, mpi_errno);
#####: 95: MPID_Datatype_committed_ptr(datatype_ptr, mpi_errno);
-: 96: }
-: 97:
-: 98: /* If datatye_ptr is not valid, it will be reset to null */
4: 99: if (mpi_errno) goto fn_fail;
-: 100: }
-: 101: MPID_END_ERROR_CHECKS;
-: 102: }
-: 103:# endif /* HAVE_ERROR_CHECKING */
-: 104:
-: 105: /* ... body of routine ... */
|
4: 106: if (insize == 0) {
|
#####: 107: goto fn_exit;
-: 108: }
-: 109:
|
4: 110: segp = MPID_Segment_alloc();
4: 111: MPIU_ERR_CHKANDJUMP1((segp == NULL), mpi_errno, MPI_ERR_OTHER, "**nomem", "**nomem %s", "MPID_Segment_alloc");
4: 112: mpi_errno = MPID_Segment_init(outbuf, outcount, datatype, segp, 1);
|
4: 113: if (mpi_errno != MPI_SUCCESS) goto fn_fail;
-: 114:
-: 115: /* NOTE: buffer values and positions in MPI_Unpack_external are used very
-: 116: * differently from use in MPID_Segment_unpack_external...
-: 117: */
|
4: 118: first = 0;
4: 119: last = SEGMENT_IGNORE_LAST;
-: 120:
-: 121: /* Ensure that pointer increment fits in a pointer */
-: 122: MPID_Ensure_Aint_fits_in_pointer((MPI_VOID_PTR_CAST_TO_MPI_AINT inbuf) + *position);
-: 123:
4: 124: MPID_Segment_unpack_external32(segp,
-: 125: first,
-: 126: &last,
-: 127: (void *) ((char *) inbuf + *position));
-: 128:
4: 129: *position += last;
-: 130:
4: 131: MPID_Segment_free(segp);
|
4: 132: if (mpi_errno != MPI_SUCCESS) goto fn_fail;
-: 133:
-: 134: /* ... end of body of routine ... */
-: 135:
|
4: 136: fn_exit:
|
-: 137: MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_UNPACK_EXTERNAL);
|
4: 138: return mpi_errno;
-: 139:
|
#####: 140: fn_fail:
-: 141: /* --BEGIN ERROR HANDLING-- */
-: 142:# ifdef HAVE_ERROR_CHECKING
-: 143: {
#####: 144: mpi_errno = MPIR_Err_create_code(
-: 145: mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER, "**mpi_unpack_external",
-: 146: "**mpi_unpack_external %s %p %d %p %p %d %D", datarep, inbuf, insize, position, outbuf, outcount, datatype);
-: 147: }
-: 148:# endif
#####: 149: mpi_errno = MPIR_Err_return_comm(NULL, FCNAME, mpi_errno);
#####: 150: goto fn_exit;
-: 151: /* --END ERROR HANDLING-- */
-: 152:}
|