root/ompi/mpiext/pcollreq/c/reduce_scatter_block_init.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPIX_Reduce_scatter_block_init

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

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