root/ompi/mpi/c/ireduce_scatter_block.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_Ireduce_scatter_block

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2018 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2005 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2006-2012 Cisco Systems, Inc.  All rights reserved.
  14  * Copyright (c) 2012      Oak Ridge National Labs. All rights reserved.
  15  * Copyright (c) 2013      Los Alamos National Security, LLC.  All rights
  16  *                         reserved.
  17  * Copyright (c) 2015      Research Organization for Information Science
  18  *                         and Technology (RIST). All rights reserved.
  19  * $COPYRIGHT$
  20  *
  21  * Additional copyrights may follow
  22  *
  23  * $HEADER$
  24  */
  25 #include "ompi_config.h"
  26 #include <stdio.h>
  27 
  28 #include "ompi/mpi/c/bindings.h"
  29 #include "ompi/runtime/params.h"
  30 #include "ompi/communicator/communicator.h"
  31 #include "ompi/errhandler/errhandler.h"
  32 #include "ompi/datatype/ompi_datatype.h"
  33 #include "ompi/op/op.h"
  34 #include "ompi/memchecker.h"
  35 #include "ompi/runtime/ompi_spc.h"
  36 
  37 #if OMPI_BUILD_MPI_PROFILING
  38 #if OPAL_HAVE_WEAK_SYMBOLS
  39 #pragma weak MPI_Ireduce_scatter_block = PMPI_Ireduce_scatter_block
  40 #endif
  41 #define MPI_Ireduce_scatter_block PMPI_Ireduce_scatter_block
  42 #endif
  43 
  44 static const char FUNC_NAME[] = "MPI_Ireduce_scatter_block";
  45 
  46 
  47 int MPI_Ireduce_scatter_block(const void *sendbuf, void *recvbuf, int recvcount,
  48                               MPI_Datatype datatype, MPI_Op op,
  49                               MPI_Comm comm, MPI_Request *request)
  50 {
  51     int err;
  52 
  53     SPC_RECORD(OMPI_SPC_IREDUCE_SCATTER_BLOCK, 1);
  54 
  55     MEMCHECKER(
  56         memchecker_comm(comm);
  57         memchecker_datatype(datatype);
  58 
  59         /* check receive buffer of current proccess, whether it's addressable. */
  60         memchecker_call(&opal_memchecker_base_isaddressable, recvbuf,
  61                         recvcount, datatype);
  62 
  63         /* check whether the actual send buffer is defined. */
  64         if(MPI_IN_PLACE == sendbuf) {
  65             memchecker_call(&opal_memchecker_base_isdefined, recvbuf, recvcount, datatype);
  66         } else {
  67             memchecker_call(&opal_memchecker_base_isdefined, sendbuf, recvcount, datatype);
  68 
  69         }
  70     );
  71 
  72     if (MPI_PARAM_CHECK) {
  73         char *msg;
  74         err = MPI_SUCCESS;
  75         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  76         if (ompi_comm_invalid(comm)) {
  77             return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
  78                                           FUNC_NAME);
  79         }
  80 
  81         /* Unrooted operation; same checks for all ranks on both
  82            intracommunicators and intercommunicators */
  83 
  84         else if (MPI_OP_NULL == op || NULL == op) {
  85           err = MPI_ERR_OP;
  86         } else if (!ompi_op_is_valid(op, datatype, &msg, FUNC_NAME)) {
  87             int ret = OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_OP, msg);
  88             free(msg);
  89             return ret;
  90         } else if (MPI_IN_PLACE == recvbuf) {
  91           err = MPI_ERR_ARG;
  92         }
  93         OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
  94 
  95         OMPI_CHECK_DATATYPE_FOR_SEND(err, datatype, recvcount);
  96         OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
  97     }
  98 
  99     OPAL_CR_ENTER_LIBRARY();
 100 
 101     /* Invoke the coll component to perform the back-end operation */
 102 
 103     OBJ_RETAIN(op);
 104     err = comm->c_coll->coll_ireduce_scatter_block(sendbuf, recvbuf, recvcount,
 105                                                   datatype, op, comm, request,
 106                                                   comm->c_coll->coll_ireduce_scatter_block_module);
 107     OBJ_RELEASE(op);
 108     OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
 109 }

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