root/ompi/mca/coll/sm/coll_sm_allreduce.c

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

DEFINITIONS

This source file includes following definitions.
  1. mca_coll_sm_allreduce_intra

   1 /*
   2  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2005 The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * Copyright (c) 2004-2005 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) 2009      Cisco Systems, Inc.  All rights reserved.
  13  * Copyright (c) 2015      Research Organization for Information Science
  14  *                         and Technology (RIST). All rights reserved.
  15  * $COPYRIGHT$
  16  *
  17  * Additional copyrights may follow
  18  *
  19  * $HEADER$
  20  */
  21 /** @file */
  22 
  23 #include "ompi_config.h"
  24 
  25 #include "ompi/constants.h"
  26 #include "ompi/communicator/communicator.h"
  27 #include "coll_sm.h"
  28 
  29 
  30 /**
  31  * Shared memory allreduce.
  32  *
  33  * For the moment, all we're doing is a reduce to root==0 and then a
  34  * broadcast.  It is possible that we'll do something better someday.
  35  */
  36 int mca_coll_sm_allreduce_intra(const void *sbuf, void *rbuf, int count,
  37                                 struct ompi_datatype_t *dtype,
  38                                 struct ompi_op_t *op,
  39                                 struct ompi_communicator_t *comm,
  40                                 mca_coll_base_module_t *module)
  41 {
  42     int ret;
  43 
  44     /* Note that only the root can pass MPI_IN_PLACE to MPI_REDUCE, so
  45        have slightly different logic for that case. */
  46 
  47     if (MPI_IN_PLACE == sbuf) {
  48         int rank = ompi_comm_rank(comm);
  49         if (0 == rank) {
  50             ret = mca_coll_sm_reduce_intra(sbuf, rbuf, count, dtype, op, 0,
  51                                            comm, module);
  52         } else {
  53             ret = mca_coll_sm_reduce_intra(rbuf, NULL, count, dtype, op, 0,
  54                                            comm, module);
  55         }
  56     } else {
  57         ret = mca_coll_sm_reduce_intra(sbuf, rbuf, count, dtype, op, 0,
  58                                        comm, module);
  59     }
  60     return (ret == OMPI_SUCCESS) ?
  61         mca_coll_sm_bcast_intra(rbuf, count, dtype, 0, comm, module) : ret;
  62 }

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