root/ompi/mpi/c/reduce_local.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_Reduce_local

   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-2009 Cisco Systems, Inc.  All rights reserved.
  14  * Copyright (c) 2013      Los Alamos National Security, LLC.  All rights
  15  *                         reserved.
  16  * Copyright (c) 2015      Research Organization for Information Science
  17  *                         and Technology (RIST). All rights reserved.
  18  * Copyright (c) 2016-2017 IBM Corporation.  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 
  36 #if OMPI_BUILD_MPI_PROFILING
  37 #if OPAL_HAVE_WEAK_SYMBOLS
  38 #pragma weak MPI_Reduce_local = PMPI_Reduce_local
  39 #endif
  40 #define MPI_Reduce_local PMPI_Reduce_local
  41 #endif
  42 
  43 static const char FUNC_NAME[] = "MPI_Reduce_local";
  44 
  45 
  46 int MPI_Reduce_local(const void *inbuf, void *inoutbuf, int count,
  47                      MPI_Datatype datatype, MPI_Op op)
  48 {
  49     int err;
  50 
  51     MEMCHECKER(
  52         memchecker_datatype(datatype);
  53     );
  54 
  55     if (MPI_PARAM_CHECK) {
  56         char *msg;
  57         err = MPI_SUCCESS;
  58         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  59 
  60         if (MPI_OP_NULL == op || NULL == op) {
  61             err = MPI_ERR_OP;
  62         } else if (!ompi_op_is_valid(op, datatype, &msg, FUNC_NAME)) {
  63             int ret = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OP, msg);
  64             free(msg);
  65             return ret;
  66         } else {
  67             OMPI_CHECK_DATATYPE_FOR_SEND(err, datatype, count);
  68         }
  69         OMPI_ERRHANDLER_CHECK(err, MPI_COMM_WORLD, err, FUNC_NAME);
  70     }
  71 
  72     /* If the count is 0, just return */
  73     if (0 == count) {
  74         return MPI_SUCCESS;
  75     }
  76 
  77     OPAL_CR_ENTER_LIBRARY();
  78 
  79     /* Invoke the op component to perform the back-end operation */
  80     OBJ_RETAIN(op);
  81     OBJ_RETAIN(datatype);
  82     // Since there is no 'comm' parameter to this interface use 'self' since
  83     // this is a local operation to this process.
  84     ompi_communicator_t *comm = &ompi_mpi_comm_self.comm;
  85     err = comm->c_coll->coll_reduce_local(inbuf, inoutbuf, count, datatype, op,
  86                                          comm->c_coll->coll_reduce_local_module);
  87     OBJ_RELEASE(datatype);
  88     OBJ_RELEASE(op);
  89 
  90     OMPI_ERRHANDLER_RETURN(err, MPI_COMM_WORLD, err, FUNC_NAME);
  91 }

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