root/ompi/mpi/c/reduce_scatter_block.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_Reduce_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-2017 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-2018 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_Reduce_scatter_block = PMPI_Reduce_scatter_block
  40 #endif
  41 #define MPI_Reduce_scatter_block PMPI_Reduce_scatter_block
  42 #endif
  43 
  44 static const char FUNC_NAME[] = "MPI_Reduce_scatter_block";
  45 
  46 
  47 int MPI_Reduce_scatter_block(const void *sendbuf, void *recvbuf, int recvcount,
  48                              MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
  49 {
  50     int err;
  51 
  52     SPC_RECORD(OMPI_SPC_REDUCE_SCATTER_BLOCK, 1);
  53 
  54     MEMCHECKER(
  55         memchecker_comm(comm);
  56         memchecker_datatype(datatype);
  57 
  58         /* check receive buffer of current proccess, whether it's addressable. */
  59         memchecker_call(&opal_memchecker_base_isaddressable, recvbuf,
  60                         recvcount, datatype);
  61 
  62         /* check whether the actual send buffer is defined. */
  63         if(MPI_IN_PLACE == sendbuf) {
  64             memchecker_call(&opal_memchecker_base_isdefined, recvbuf, recvcount, datatype);
  65         } else {
  66             memchecker_call(&opal_memchecker_base_isdefined, sendbuf, recvcount, datatype);
  67 
  68         }
  69     );
  70 
  71     if (MPI_PARAM_CHECK) {
  72         char *msg;
  73         err = MPI_SUCCESS;
  74         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  75         if (ompi_comm_invalid(comm)) {
  76             return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
  77                                           FUNC_NAME);
  78         }
  79 
  80         /* Unrooted operation; same checks for all ranks on both
  81            intracommunicators and intercommunicators */
  82 
  83         else if (MPI_OP_NULL == op || NULL == op) {
  84           err = MPI_ERR_OP;
  85         } else if (!ompi_op_is_valid(op, datatype, &msg, FUNC_NAME)) {
  86             int ret = OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_OP, msg);
  87             free(msg);
  88             return ret;
  89         } else if (MPI_IN_PLACE == recvbuf) {
  90           err = MPI_ERR_ARG;
  91         }
  92         OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
  93 
  94         OMPI_CHECK_DATATYPE_FOR_SEND(err, datatype, recvcount);
  95         OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
  96     }
  97 
  98     OPAL_CR_ENTER_LIBRARY();
  99 
 100     /* Invoke the coll component to perform the back-end operation */
 101 
 102     OBJ_RETAIN(op);
 103     err = comm->c_coll->coll_reduce_scatter_block(sendbuf, recvbuf, recvcount,
 104                                                  datatype, op, comm,
 105                                                  comm->c_coll->coll_reduce_scatter_block_module);
 106     OBJ_RELEASE(op);
 107     OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
 108 }

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