root/ompi/mpi/c/status_set_elements_x.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. MPI_Status_set_elements_x

   1 /*
   2  * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2010 The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
   9  *                         University of Stuttgart.  All rights reserved.
  10  * Copyright (c) 2004-2005 The Regents of the University of California.
  11  *                         All rights reserved.
  12  * Copyright (c) 2007      Cisco Systems, Inc.  All rights reserved.
  13  * Copyright (c) 2013      Los Alamos National Security, LLC. All rights
  14  *                         reserved.
  15  * Copyright (c) 2015      Research Organization for Information Science
  16  *                         and Technology (RIST). All rights reserved.
  17  * $COPYRIGHT$
  18  *
  19  * Additional copyrights may follow
  20  *
  21  * $HEADER$
  22  */
  23 
  24 #include "ompi_config.h"
  25 #include <stdio.h>
  26 
  27 #include "ompi/mpi/c/bindings.h"
  28 #include "ompi/runtime/params.h"
  29 #include "ompi/communicator/communicator.h"
  30 #include "ompi/errhandler/errhandler.h"
  31 #include "ompi/datatype/ompi_datatype.h"
  32 #include "ompi/memchecker.h"
  33 
  34 #if OMPI_BUILD_MPI_PROFILING
  35 #if OPAL_HAVE_WEAK_SYMBOLS
  36 #pragma weak MPI_Status_set_elements_x = PMPI_Status_set_elements_x
  37 #endif
  38 #define MPI_Status_set_elements_x PMPI_Status_set_elements_x
  39 #endif
  40 
  41 static const char FUNC_NAME[] = "MPI_Status_set_elements_x";
  42 
  43 int MPI_Status_set_elements_x(MPI_Status *status, MPI_Datatype datatype, MPI_Count count)
  44 {
  45     int rc = MPI_SUCCESS;
  46     size_t size;
  47 
  48     MEMCHECKER(
  49         if(status != MPI_STATUSES_IGNORE) {
  50             /*
  51              * Before checking the complete status, we need to reset the definedness
  52              * of the MPI_ERROR-field (single-completion calls wait/test).
  53              */
  54             opal_memchecker_base_mem_defined(&status->MPI_ERROR, sizeof(int));
  55             memchecker_status (status);
  56             memchecker_datatype(datatype);
  57         }
  58     );
  59 
  60     OPAL_CR_NOOP_PROGRESS();
  61 
  62     if (MPI_PARAM_CHECK) {
  63         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  64         if (NULL == datatype || MPI_DATATYPE_NULL == datatype) {
  65             rc = MPI_ERR_TYPE;
  66         } else if (count < 0) {
  67             rc = MPI_ERR_COUNT;
  68         }
  69         OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
  70     }
  71 
  72     /* ROMIO calls MPI_STATUS_SET_ELEMENTS with IGNORE values, so we
  73        need to allow it.  Blah! */
  74     if (MPI_STATUS_IGNORE == status || MPI_STATUSES_IGNORE == status) {
  75         return MPI_SUCCESS;
  76     }
  77 
  78     if( ompi_datatype_is_predefined(datatype) ) {
  79         ompi_datatype_type_size( datatype, &size );
  80         status->_ucount = count * size;
  81     } else {
  82         ompi_datatype_set_element_count( datatype, count, &size );
  83         status->_ucount = size;
  84     }
  85     return MPI_SUCCESS;
  86 }

/* [<][>][^][v][top][bottom][index][help] */