root/ompi/mca/coll/base/coll_base_functions.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. ompi_coll_base_free_reqs

   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-2015 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2005 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) 2008      Sun Microsystems, Inc.  All rights reserved.
  14  * Copyright (c) 2008      Cisco Systems, Inc.  All rights reserved.
  15  * Copyright (c) 2013-2016 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 (c) 2016-2017 IBM Corporation.  All rights reserved.
  20  * Copyright (c) 2017      FUJITSU LIMITED.  All rights reserved.
  21  * $COPYRIGHT$
  22  *
  23  * Additional copyrights may follow
  24  *
  25  * $HEADER$
  26  */
  27 
  28 #ifndef MCA_COLL_BASE_EXPORT_H
  29 #define MCA_COLL_BASE_EXPORT_H
  30 
  31 #include "ompi_config.h"
  32 
  33 #include "ompi/mca/coll/base/base.h"
  34 #include "ompi/mca/mca.h"
  35 #include "ompi/mca/coll/coll.h"
  36 #include "ompi/info/info.h"
  37 #include "ompi/request/request.h"
  38 
  39 /* need to include our own topo prototypes so we can malloc data on the comm correctly */
  40 #include "coll_base_topo.h"
  41 
  42 /* some fixed value index vars to simplify certain operations */
  43 typedef enum COLLTYPE {
  44     ALLGATHER = 0,       /*  0 */
  45     ALLGATHERV,          /*  1 */
  46     ALLREDUCE,           /*  2 */
  47     ALLTOALL,            /*  3 */
  48     ALLTOALLV,           /*  4 */
  49     ALLTOALLW,           /*  5 */
  50     BARRIER,             /*  6 */
  51     BCAST,               /*  7 */
  52     EXSCAN,              /*  8 */
  53     GATHER,              /*  9 */
  54     GATHERV,             /* 10 */
  55     REDUCE,              /* 11 */
  56     REDUCESCATTER,       /* 12 */
  57     REDUCESCATTERBLOCK,  /* 13 */
  58     SCAN,                /* 14 */
  59     SCATTER,             /* 15 */
  60     SCATTERV,            /* 16 */
  61     NEIGHBOR_ALLGATHER,  /* 17 */
  62     NEIGHBOR_ALLGATHERV, /* 18 */
  63     NEIGHBOR_ALLTOALL,   /* 19 */
  64     NEIGHBOR_ALLTOALLV,  /* 20 */
  65     NEIGHBOR_ALLTOALLW,  /* 21 */
  66     COLLCOUNT            /* 22 end counter keep it as last element */
  67 } COLLTYPE_T;
  68 
  69 /* defined arg lists to simply auto inclusion of user overriding decision functions */
  70 #define ALLGATHER_BASE_ARGS           const void *sendbuf, int sendcount, struct ompi_datatype_t *sendtype, void *recvbuf, int recvcount, struct ompi_datatype_t *recvtype, struct ompi_communicator_t *comm
  71 #define ALLGATHERV_BASE_ARGS          const void *sendbuf, int sendcount, struct ompi_datatype_t *sendtype, void *recvbuf, const int recvcounts[], const int displs[], struct ompi_datatype_t *recvtype, struct ompi_communicator_t *comm
  72 #define ALLREDUCE_BASE_ARGS           const void *sendbuf, void *recvbuf, int count, struct ompi_datatype_t *datatype, struct ompi_op_t *op, struct ompi_communicator_t *comm
  73 #define ALLTOALL_BASE_ARGS            const void *sendbuf, int sendcount, struct ompi_datatype_t *sendtype, void *recvbuf, int recvcount, struct ompi_datatype_t *recvtype, struct ompi_communicator_t *comm
  74 #define ALLTOALLV_BASE_ARGS           const void *sendbuf, const int sendcounts[], const int sdispls[], struct ompi_datatype_t *sendtype, void *recvbuf, const int recvcounts[], const int rdispls[], struct ompi_datatype_t *recvtype, struct ompi_communicator_t *comm
  75 #define ALLTOALLW_BASE_ARGS           const void *sendbuf, const int sendcounts[], const int sdispls[], struct ompi_datatype_t * const sendtypes[], void *recvbuf, const int recvcounts[], const int rdispls[], struct ompi_datatype_t * const recvtypes[], struct ompi_communicator_t *comm
  76 #define BARRIER_BASE_ARGS             struct ompi_communicator_t *comm
  77 #define BCAST_BASE_ARGS               void *buffer, int count, struct ompi_datatype_t *datatype, int root, struct ompi_communicator_t *comm
  78 #define EXSCAN_BASE_ARGS              const void *sendbuf, void *recvbuf, int count, struct ompi_datatype_t *datatype, struct ompi_op_t *op, struct ompi_communicator_t *comm
  79 #define GATHER_BASE_ARGS              const void *sendbuf, int sendcount, struct ompi_datatype_t *sendtype, void *recvbuf, int recvcount, struct ompi_datatype_t *recvtype, int root, struct ompi_communicator_t *comm
  80 #define GATHERV_BASE_ARGS             const void *sendbuf, int sendcount, struct ompi_datatype_t *sendtype, void *recvbuf, const int recvcounts[], const int displs[], struct ompi_datatype_t *recvtype, int root, struct ompi_communicator_t *comm
  81 #define REDUCE_BASE_ARGS              const void *sendbuf, void *recvbuf, int count, struct ompi_datatype_t *datatype, struct ompi_op_t *op, int root, struct ompi_communicator_t *comm
  82 #define REDUCESCATTER_BASE_ARGS       const void *sendbuf, void *recvbuf, const int recvcounts[], struct ompi_datatype_t *datatype, struct ompi_op_t *op, struct ompi_communicator_t *comm
  83 #define REDUCESCATTERBLOCK_BASE_ARGS  const void *sendbuf, void *recvbuf, int recvcount, struct ompi_datatype_t *datatype, struct ompi_op_t *op, struct ompi_communicator_t *comm
  84 #define SCAN_BASE_ARGS                const void *sendbuf, void *recvbuf, int count, struct ompi_datatype_t *datatype, struct ompi_op_t *op, struct ompi_communicator_t *comm
  85 #define SCATTER_BASE_ARGS             const void *sendbuf, int sendcount, struct ompi_datatype_t *sendtype, void *recvbuf, int recvcount, struct ompi_datatype_t *recvtype, int root, struct ompi_communicator_t *comm
  86 #define SCATTERV_BASE_ARGS            const void *sendbuf, const int sendcounts[], const int displs[], struct ompi_datatype_t *sendtype, void *recvbuf, int recvcount, struct ompi_datatype_t *recvtype, int root, struct ompi_communicator_t *comm
  87 #define NEIGHBOR_ALLGATHER_BASE_ARGS  const void *sendbuf, int sendcount, struct ompi_datatype_t *sendtype, void *recvbuf, int recvcount, struct ompi_datatype_t *recvtype, struct ompi_communicator_t *comm
  88 #define NEIGHBOR_ALLGATHERV_BASE_ARGS const void *sendbuf, int sendcount, struct ompi_datatype_t *sendtype, void *recvbuf, const int recvcounts[], const int displs[], struct ompi_datatype_t *recvtype, struct ompi_communicator_t *comm
  89 #define NEIGHBOR_ALLTOALL_BASE_ARGS   const void *sendbuf, int sendcount, struct ompi_datatype_t *sendtype, void *recvbuf, int recvcount, struct ompi_datatype_t *recvtype, struct ompi_communicator_t *comm
  90 #define NEIGHBOR_ALLTOALLV_BASE_ARGS  const void *sendbuf, const int sendcounts[], const int sdispls[], struct ompi_datatype_t *sendtype, void *recvbuf, const int recvcounts[], const int rdispls[], struct ompi_datatype_t *recvtype, struct ompi_communicator_t *comm
  91 #define NEIGHBOR_ALLTOALLW_BASE_ARGS  const void *sendbuf, const int sendcounts[], const MPI_Aint sdispls[], struct ompi_datatype_t * const sendtypes[], void *recvbuf, const int recvcounts[], const MPI_Aint rdispls[], struct ompi_datatype_t * const recvtypes[], struct ompi_communicator_t *comm
  92 
  93 #define ALLGATHER_ARGS           ALLGATHER_BASE_ARGS,           mca_coll_base_module_t *module
  94 #define ALLGATHERV_ARGS          ALLGATHERV_BASE_ARGS,          mca_coll_base_module_t *module
  95 #define ALLREDUCE_ARGS           ALLREDUCE_BASE_ARGS,           mca_coll_base_module_t *module
  96 #define ALLTOALL_ARGS            ALLTOALL_BASE_ARGS,            mca_coll_base_module_t *module
  97 #define ALLTOALLV_ARGS           ALLTOALLV_BASE_ARGS,           mca_coll_base_module_t *module
  98 #define ALLTOALLW_ARGS           ALLTOALLW_BASE_ARGS,           mca_coll_base_module_t *module
  99 #define BARRIER_ARGS             BARRIER_BASE_ARGS,             mca_coll_base_module_t *module
 100 #define BCAST_ARGS               BCAST_BASE_ARGS,               mca_coll_base_module_t *module
 101 #define EXSCAN_ARGS              EXSCAN_BASE_ARGS,              mca_coll_base_module_t *module
 102 #define GATHER_ARGS              GATHER_BASE_ARGS,              mca_coll_base_module_t *module
 103 #define GATHERV_ARGS             GATHERV_BASE_ARGS,             mca_coll_base_module_t *module
 104 #define REDUCE_ARGS              REDUCE_BASE_ARGS,              mca_coll_base_module_t *module
 105 #define REDUCESCATTER_ARGS       REDUCESCATTER_BASE_ARGS,       mca_coll_base_module_t *module
 106 #define REDUCESCATTERBLOCK_ARGS  REDUCESCATTERBLOCK_BASE_ARGS,  mca_coll_base_module_t *module
 107 #define SCAN_ARGS                SCAN_BASE_ARGS,                mca_coll_base_module_t *module
 108 #define SCATTER_ARGS             SCATTER_BASE_ARGS,             mca_coll_base_module_t *module
 109 #define SCATTERV_ARGS            SCATTERV_BASE_ARGS,            mca_coll_base_module_t *module
 110 #define NEIGHBOR_ALLGATHER_ARGS  NEIGHBOR_ALLGATHER_BASE_ARGS,  mca_coll_base_module_t *module
 111 #define NEIGHBOR_ALLGATHERV_ARGS NEIGHBOR_ALLGATHERV_BASE_ARGS, mca_coll_base_module_t *module
 112 #define NEIGHBOR_ALLTOALL_ARGS   NEIGHBOR_ALLTOALL_BASE_ARGS,   mca_coll_base_module_t *module
 113 #define NEIGHBOR_ALLTOALLV_ARGS  NEIGHBOR_ALLTOALLV_BASE_ARGS,  mca_coll_base_module_t *module
 114 #define NEIGHBOR_ALLTOALLW_ARGS  NEIGHBOR_ALLTOALLW_BASE_ARGS,  mca_coll_base_module_t *module
 115 
 116 #define IALLGATHER_ARGS           ALLGATHER_BASE_ARGS,           ompi_request_t **request, mca_coll_base_module_t *module
 117 #define IALLGATHERV_ARGS          ALLGATHERV_BASE_ARGS,          ompi_request_t **request, mca_coll_base_module_t *module
 118 #define IALLREDUCE_ARGS           ALLREDUCE_BASE_ARGS,           ompi_request_t **request, mca_coll_base_module_t *module
 119 #define IALLTOALL_ARGS            ALLTOALL_BASE_ARGS,            ompi_request_t **request, mca_coll_base_module_t *module
 120 #define IALLTOALLV_ARGS           ALLTOALLV_BASE_ARGS,           ompi_request_t **request, mca_coll_base_module_t *module
 121 #define IALLTOALLW_ARGS           ALLTOALLW_BASE_ARGS,           ompi_request_t **request, mca_coll_base_module_t *module
 122 #define IBARRIER_ARGS             BARRIER_BASE_ARGS,             ompi_request_t **request, mca_coll_base_module_t *module
 123 #define IBCAST_ARGS               BCAST_BASE_ARGS,               ompi_request_t **request, mca_coll_base_module_t *module
 124 #define IEXSCAN_ARGS              EXSCAN_BASE_ARGS,              ompi_request_t **request, mca_coll_base_module_t *module
 125 #define IGATHER_ARGS              GATHER_BASE_ARGS,              ompi_request_t **request, mca_coll_base_module_t *module
 126 #define IGATHERV_ARGS             GATHERV_BASE_ARGS,             ompi_request_t **request, mca_coll_base_module_t *module
 127 #define IREDUCE_ARGS              REDUCE_BASE_ARGS,              ompi_request_t **request, mca_coll_base_module_t *module
 128 #define IREDUCESCATTER_ARGS       REDUCESCATTER_BASE_ARGS,       ompi_request_t **request, mca_coll_base_module_t *module
 129 #define IREDUCESCATTERBLOCK_ARGS  REDUCESCATTERBLOCK_BASE_ARGS,  ompi_request_t **request, mca_coll_base_module_t *module
 130 #define ISCAN_ARGS                SCAN_BASE_ARGS,                ompi_request_t **request, mca_coll_base_module_t *module
 131 #define ISCATTER_ARGS             SCATTER_BASE_ARGS,             ompi_request_t **request, mca_coll_base_module_t *module
 132 #define ISCATTERV_ARGS            SCATTERV_BASE_ARGS,            ompi_request_t **request, mca_coll_base_module_t *module
 133 #define INEIGHBOR_ALLGATHER_ARGS  NEIGHBOR_ALLGATHER_BASE_ARGS,  ompi_request_t **request, mca_coll_base_module_t *module
 134 #define INEIGHBOR_ALLGATHERV_ARGS NEIGHBOR_ALLGATHERV_BASE_ARGS, ompi_request_t **request, mca_coll_base_module_t *module
 135 #define INEIGHBOR_ALLTOALL_ARGS   NEIGHBOR_ALLTOALL_BASE_ARGS,   ompi_request_t **request, mca_coll_base_module_t *module
 136 #define INEIGHBOR_ALLTOALLV_ARGS  NEIGHBOR_ALLTOALLV_BASE_ARGS,  ompi_request_t **request, mca_coll_base_module_t *module
 137 #define INEIGHBOR_ALLTOALLW_ARGS  NEIGHBOR_ALLTOALLW_BASE_ARGS,  ompi_request_t **request, mca_coll_base_module_t *module
 138 
 139 #define ALLGATHER_INIT_ARGS           ALLGATHER_BASE_ARGS,           ompi_info_t *info, ompi_request_t **request, mca_coll_base_module_t *module
 140 #define ALLGATHERV_INIT_ARGS          ALLGATHERV_BASE_ARGS,          ompi_info_t *info, ompi_request_t **request, mca_coll_base_module_t *module
 141 #define ALLREDUCE_INIT_ARGS           ALLREDUCE_BASE_ARGS,           ompi_info_t *info, ompi_request_t **request, mca_coll_base_module_t *module
 142 #define ALLTOALL_INIT_ARGS            ALLTOALL_BASE_ARGS,            ompi_info_t *info, ompi_request_t **request, mca_coll_base_module_t *module
 143 #define ALLTOALLV_INIT_ARGS           ALLTOALLV_BASE_ARGS,           ompi_info_t *info, ompi_request_t **request, mca_coll_base_module_t *module
 144 #define ALLTOALLW_INIT_ARGS           ALLTOALLW_BASE_ARGS,           ompi_info_t *info, ompi_request_t **request, mca_coll_base_module_t *module
 145 #define BARRIER_INIT_ARGS             BARRIER_BASE_ARGS,             ompi_info_t *info, ompi_request_t **request, mca_coll_base_module_t *module
 146 #define BCAST_INIT_ARGS               BCAST_BASE_ARGS,               ompi_info_t *info, ompi_request_t **request, mca_coll_base_module_t *module
 147 #define EXSCAN_INIT_ARGS              EXSCAN_BASE_ARGS,              ompi_info_t *info, ompi_request_t **request, mca_coll_base_module_t *module
 148 #define GATHER_INIT_ARGS              GATHER_BASE_ARGS,              ompi_info_t *info, ompi_request_t **request, mca_coll_base_module_t *module
 149 #define GATHERV_INIT_ARGS             GATHERV_BASE_ARGS,             ompi_info_t *info, ompi_request_t **request, mca_coll_base_module_t *module
 150 #define REDUCE_INIT_ARGS              REDUCE_BASE_ARGS,              ompi_info_t *info, ompi_request_t **request, mca_coll_base_module_t *module
 151 #define REDUCESCATTER_INIT_ARGS       REDUCESCATTER_BASE_ARGS,       ompi_info_t *info, ompi_request_t **request, mca_coll_base_module_t *module
 152 #define REDUCESCATTERBLOCK_INIT_ARGS  REDUCESCATTERBLOCK_BASE_ARGS,  ompi_info_t *info, ompi_request_t **request, mca_coll_base_module_t *module
 153 #define SCAN_INIT_ARGS                SCAN_BASE_ARGS,                ompi_info_t *info, ompi_request_t **request, mca_coll_base_module_t *module
 154 #define SCATTER_INIT_ARGS             SCATTER_BASE_ARGS,             ompi_info_t *info, ompi_request_t **request, mca_coll_base_module_t *module
 155 #define SCATTERV_INIT_ARGS            SCATTERV_BASE_ARGS,            ompi_info_t *info, ompi_request_t **request, mca_coll_base_module_t *module
 156 #define NEIGHBOR_ALLGATHER_INIT_ARGS  NEIGHBOR_ALLGATHER_BASE_ARGS,  ompi_info_t *info, ompi_request_t **request, mca_coll_base_module_t *module
 157 #define NEIGHBOR_ALLGATHERV_INIT_ARGS NEIGHBOR_ALLGATHERV_BASE_ARGS, ompi_info_t *info, ompi_request_t **request, mca_coll_base_module_t *module
 158 #define NEIGHBOR_ALLTOALL_INIT_ARGS   NEIGHBOR_ALLTOALL_BASE_ARGS,   ompi_info_t *info, ompi_request_t **request, mca_coll_base_module_t *module
 159 #define NEIGHBOR_ALLTOALLV_INIT_ARGS  NEIGHBOR_ALLTOALLV_BASE_ARGS,  ompi_info_t *info, ompi_request_t **request, mca_coll_base_module_t *module
 160 #define NEIGHBOR_ALLTOALLW_INIT_ARGS  NEIGHBOR_ALLTOALLW_BASE_ARGS,  ompi_info_t *info, ompi_request_t **request, mca_coll_base_module_t *module
 161 
 162 #define ALLGATHER_BASE_ARG_NAMES           sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm
 163 #define ALLGATHERV_BASE_ARG_NAMES          sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm
 164 #define ALLREDUCE_BASE_ARG_NAMES           sendbuf, recvbuf, count, datatype, op, comm
 165 #define ALLTOALL_BASE_ARG_NAMES            sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm
 166 #define ALLTOALLV_BASE_ARG_NAMES           sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, comm
 167 #define ALLTOALLW_BASE_ARG_NAMES           sendbuf, sendcounts, sdispls, sendtypes, recvbuf, recvcounts, rdispls, recvtypes, comm
 168 #define BARRIER_BASE_ARG_NAMES             comm
 169 #define BCAST_BASE_ARG_NAMES               buffer, count, datatype, root, comm
 170 #define EXSCAN_BASE_ARG_NAMES              sendbuf, recvbuf, count, datatype, op, comm
 171 #define GATHER_BASE_ARG_NAMES              sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm
 172 #define GATHERV_BASE_ARG_NAMES             sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, comm
 173 #define REDUCE_BASE_ARG_NAMES              sendbuf, recvbuf, count, datatype, op, root, comm
 174 #define REDUCESCATTER_BASE_ARG_NAMES       sendbuf, recvbuf, recvcounts, datatype, op, comm
 175 #define REDUCESCATTERBLOCK_BASE_ARG_NAMES  sendbuf, recvbuf, recvcount, datatype, op, comm
 176 #define SCAN_BASE_ARG_NAMES                sendbuf, recvbuf, count, datatype, op, comm
 177 #define SCATTER_BASE_ARG_NAMES             sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm
 178 #define SCATTERV_BASE_ARG_NAMES            sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, comm
 179 #define NEIGHBOR_ALLGATHER_BASE_ARG_NAMES  sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm
 180 #define NEIGHBOR_ALLGATHERV_BASE_ARG_NAMES sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm
 181 #define NEIGHBOR_ALLTOALL_BASE_ARG_NAMES   sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm
 182 #define NEIGHBOR_ALLTOALLV_BASE_ARG_NAMES  sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, comm
 183 #define NEIGHBOR_ALLTOALLW_BASE_ARG_NAMES  sendbuf, sendcounts, sdispls, sendtypes, recvbuf, recvcounts, rdispls, recvtypes, comm
 184 /* end defined arg lists to simply auto inclusion of user overriding decision functions */
 185 
 186 BEGIN_C_DECLS
 187 
 188 /* All Gather */
 189 int ompi_coll_base_allgather_intra_bruck(ALLGATHER_ARGS);
 190 int ompi_coll_base_allgather_intra_recursivedoubling(ALLGATHER_ARGS);
 191 int ompi_coll_base_allgather_intra_ring(ALLGATHER_ARGS);
 192 int ompi_coll_base_allgather_intra_neighborexchange(ALLGATHER_ARGS);
 193 int ompi_coll_base_allgather_intra_basic_linear(ALLGATHER_ARGS);
 194 int ompi_coll_base_allgather_intra_two_procs(ALLGATHER_ARGS);
 195 
 196 /* All GatherV */
 197 int ompi_coll_base_allgatherv_intra_bruck(ALLGATHERV_ARGS);
 198 int ompi_coll_base_allgatherv_intra_ring(ALLGATHERV_ARGS);
 199 int ompi_coll_base_allgatherv_intra_neighborexchange(ALLGATHERV_ARGS);
 200 int ompi_coll_base_allgatherv_intra_basic_default(ALLGATHERV_ARGS);
 201 int ompi_coll_base_allgatherv_intra_two_procs(ALLGATHERV_ARGS);
 202 
 203 /* All Reduce */
 204 int ompi_coll_base_allreduce_intra_nonoverlapping(ALLREDUCE_ARGS);
 205 int ompi_coll_base_allreduce_intra_recursivedoubling(ALLREDUCE_ARGS);
 206 int ompi_coll_base_allreduce_intra_ring(ALLREDUCE_ARGS);
 207 int ompi_coll_base_allreduce_intra_ring_segmented(ALLREDUCE_ARGS, uint32_t segsize);
 208 int ompi_coll_base_allreduce_intra_basic_linear(ALLREDUCE_ARGS);
 209 int ompi_coll_base_allreduce_intra_redscat_allgather(ALLREDUCE_ARGS);
 210 
 211 /* AlltoAll */
 212 int ompi_coll_base_alltoall_intra_pairwise(ALLTOALL_ARGS);
 213 int ompi_coll_base_alltoall_intra_bruck(ALLTOALL_ARGS);
 214 int ompi_coll_base_alltoall_intra_basic_linear(ALLTOALL_ARGS);
 215 int ompi_coll_base_alltoall_intra_linear_sync(ALLTOALL_ARGS, int max_requests);
 216 int ompi_coll_base_alltoall_intra_two_procs(ALLTOALL_ARGS);
 217 int mca_coll_base_alltoall_intra_basic_inplace(const void *rbuf, int rcount,
 218                                                struct ompi_datatype_t *rdtype,
 219                                                struct ompi_communicator_t *comm,
 220                                                mca_coll_base_module_t *module);  /* special version for INPLACE */
 221 
 222 /* AlltoAllV */
 223 int ompi_coll_base_alltoallv_intra_pairwise(ALLTOALLV_ARGS);
 224 int ompi_coll_base_alltoallv_intra_basic_linear(ALLTOALLV_ARGS);
 225 int mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts, const int *rdisps,
 226                                                 struct ompi_datatype_t *rdtype,
 227                                                 struct ompi_communicator_t *comm,
 228                                                 mca_coll_base_module_t *module);  /* special version for INPLACE */
 229 
 230 /* AlltoAllW */
 231 
 232 /* Barrier */
 233 int ompi_coll_base_barrier_intra_doublering(BARRIER_ARGS);
 234 int ompi_coll_base_barrier_intra_recursivedoubling(BARRIER_ARGS);
 235 int ompi_coll_base_barrier_intra_bruck(BARRIER_ARGS);
 236 int ompi_coll_base_barrier_intra_two_procs(BARRIER_ARGS);
 237 int ompi_coll_base_barrier_intra_tree(BARRIER_ARGS);
 238 int ompi_coll_base_barrier_intra_basic_linear(BARRIER_ARGS);
 239 
 240 /* Bcast */
 241 int ompi_coll_base_bcast_intra_generic(BCAST_ARGS, uint32_t count_by_segment, ompi_coll_tree_t* tree);
 242 int ompi_coll_base_bcast_intra_basic_linear(BCAST_ARGS);
 243 int ompi_coll_base_bcast_intra_chain(BCAST_ARGS, uint32_t segsize, int32_t chains);
 244 int ompi_coll_base_bcast_intra_pipeline(BCAST_ARGS, uint32_t segsize);
 245 int ompi_coll_base_bcast_intra_binomial(BCAST_ARGS, uint32_t segsize);
 246 int ompi_coll_base_bcast_intra_bintree(BCAST_ARGS, uint32_t segsize);
 247 int ompi_coll_base_bcast_intra_split_bintree(BCAST_ARGS, uint32_t segsize);
 248 int ompi_coll_base_bcast_intra_knomial(BCAST_ARGS, uint32_t segsize, int radix);
 249 int ompi_coll_base_bcast_intra_scatter_allgather(BCAST_ARGS, uint32_t segsize);
 250 int ompi_coll_base_bcast_intra_scatter_allgather_ring(BCAST_ARGS, uint32_t segsize);
 251 
 252 /* Exscan */
 253 int ompi_coll_base_exscan_intra_recursivedoubling(EXSCAN_ARGS);
 254 int ompi_coll_base_exscan_intra_linear(EXSCAN_ARGS);
 255 int ompi_coll_base_exscan_intra_recursivedoubling(EXSCAN_ARGS);
 256 
 257 /* Gather */
 258 int ompi_coll_base_gather_intra_basic_linear(GATHER_ARGS);
 259 int ompi_coll_base_gather_intra_binomial(GATHER_ARGS);
 260 int ompi_coll_base_gather_intra_linear_sync(GATHER_ARGS, int first_segment_size);
 261 
 262 /* GatherV */
 263 
 264 /* Reduce */
 265 int ompi_coll_base_reduce_generic(REDUCE_ARGS, ompi_coll_tree_t* tree, int count_by_segment, int max_outstanding_reqs);
 266 int ompi_coll_base_reduce_intra_basic_linear(REDUCE_ARGS);
 267 int ompi_coll_base_reduce_intra_chain(REDUCE_ARGS, uint32_t segsize, int fanout, int max_outstanding_reqs );
 268 int ompi_coll_base_reduce_intra_pipeline(REDUCE_ARGS, uint32_t segsize, int max_outstanding_reqs );
 269 int ompi_coll_base_reduce_intra_binary(REDUCE_ARGS, uint32_t segsize, int max_outstanding_reqs );
 270 int ompi_coll_base_reduce_intra_binomial(REDUCE_ARGS, uint32_t segsize, int max_outstanding_reqs );
 271 int ompi_coll_base_reduce_intra_in_order_binary(REDUCE_ARGS, uint32_t segsize, int max_outstanding_reqs );
 272 int ompi_coll_base_reduce_intra_redscat_gather(REDUCE_ARGS);
 273 
 274 /* Reduce_scatter */
 275 int ompi_coll_base_reduce_scatter_intra_nonoverlapping(REDUCESCATTER_ARGS);
 276 int ompi_coll_base_reduce_scatter_intra_basic_recursivehalving(REDUCESCATTER_ARGS);
 277 int ompi_coll_base_reduce_scatter_intra_ring(REDUCESCATTER_ARGS);
 278 int ompi_coll_base_reduce_scatter_intra_butterfly(REDUCESCATTER_ARGS);
 279 
 280 /* Reduce_scatter_block */
 281 int ompi_coll_base_reduce_scatter_block_basic_linear(REDUCESCATTERBLOCK_ARGS);
 282 int ompi_coll_base_reduce_scatter_block_intra_recursivedoubling(REDUCESCATTERBLOCK_ARGS);
 283 int ompi_coll_base_reduce_scatter_block_intra_recursivehalving(REDUCESCATTERBLOCK_ARGS);
 284 int ompi_coll_base_reduce_scatter_block_intra_butterfly(REDUCESCATTERBLOCK_ARGS);
 285 
 286 /* Scan */
 287 int ompi_coll_base_scan_intra_recursivedoubling(SCAN_ARGS);
 288 int ompi_coll_base_scan_intra_linear(SCAN_ARGS);
 289 int ompi_coll_base_scan_intra_recursivedoubling(SCAN_ARGS);
 290 
 291 /* Scatter */
 292 int ompi_coll_base_scatter_intra_basic_linear(SCATTER_ARGS);
 293 int ompi_coll_base_scatter_intra_binomial(SCATTER_ARGS);
 294 
 295 /* ScatterV */
 296 
 297 /* Reduce_local */
 298 int mca_coll_base_reduce_local(const void *inbuf, void *inoutbuf, int count,
 299                                struct ompi_datatype_t * dtype, struct ompi_op_t * op,
 300                                mca_coll_base_module_t *module);
 301 
 302 END_C_DECLS
 303 
 304 #define COLL_BASE_UPDATE_BINTREE( OMPI_COMM, BASE_MODULE, ROOT )        \
 305 do {                                                                                       \
 306     mca_coll_base_comm_t* coll_comm = (BASE_MODULE)->base_data;                        \
 307     if( !( (coll_comm->cached_bintree)                                                     \
 308            && (coll_comm->cached_bintree_root == (ROOT)) ) ) {                             \
 309         if( coll_comm->cached_bintree ) { /* destroy previous binomial if defined */       \
 310             ompi_coll_base_topo_destroy_tree( &(coll_comm->cached_bintree) );             \
 311         }                                                                                  \
 312         coll_comm->cached_bintree = ompi_coll_base_topo_build_tree(2,(OMPI_COMM),(ROOT)); \
 313         coll_comm->cached_bintree_root = (ROOT);                                           \
 314     }                                                                                      \
 315 } while (0)
 316 
 317 #define COLL_BASE_UPDATE_BMTREE( OMPI_COMM, BASE_MODULE, ROOT ) \
 318 do {                                                                                         \
 319     mca_coll_base_comm_t* coll_comm = (BASE_MODULE)->base_data;                           \
 320     if( !( (coll_comm->cached_bmtree)                                                        \
 321            && (coll_comm->cached_bmtree_root == (ROOT)) ) ) {                                \
 322         if( coll_comm->cached_bmtree ) { /* destroy previous binomial if defined */          \
 323             ompi_coll_base_topo_destroy_tree( &(coll_comm->cached_bmtree) );                \
 324         }                                                                                    \
 325         coll_comm->cached_bmtree = ompi_coll_base_topo_build_bmtree( (OMPI_COMM), (ROOT) ); \
 326         coll_comm->cached_bmtree_root = (ROOT);                                              \
 327     }                                                                                        \
 328 } while (0)
 329 
 330 #define COLL_BASE_UPDATE_IN_ORDER_BMTREE( OMPI_COMM, BASE_MODULE, ROOT ) \
 331 do {                                                                                         \
 332     mca_coll_base_comm_t* coll_comm = (BASE_MODULE)->base_data;                           \
 333     if( !( (coll_comm->cached_in_order_bmtree)                                               \
 334            && (coll_comm->cached_in_order_bmtree_root == (ROOT)) ) ) {                       \
 335         if( coll_comm->cached_in_order_bmtree ) { /* destroy previous binomial if defined */ \
 336             ompi_coll_base_topo_destroy_tree( &(coll_comm->cached_in_order_bmtree) );       \
 337         }                                                                                    \
 338         coll_comm->cached_in_order_bmtree = ompi_coll_base_topo_build_in_order_bmtree( (OMPI_COMM), (ROOT) ); \
 339         coll_comm->cached_in_order_bmtree_root = (ROOT);                                     \
 340     }                                                                                        \
 341 } while (0)
 342 
 343 #define COLL_BASE_UPDATE_KMTREE(OMPI_COMM, BASE_MODULE, ROOT, RADIX)    \
 344 do {                                                                                         \
 345     mca_coll_base_comm_t* coll_comm = (BASE_MODULE)->base_data;                           \
 346     if (!((coll_comm->cached_kmtree)                                                       \
 347            && (coll_comm->cached_kmtree_root == (ROOT))                                     \
 348            && (coll_comm->cached_kmtree_radix == (RADIX))))                                   \
 349     {                                                                                        \
 350         if (coll_comm->cached_kmtree ) { /* destroy previous k-nomial tree if defined */     \
 351             ompi_coll_base_topo_destroy_tree(&(coll_comm->cached_kmtree));                  \
 352         }                                                                                    \
 353         coll_comm->cached_kmtree = ompi_coll_base_topo_build_kmtree((OMPI_COMM), (ROOT), (RADIX)); \
 354         coll_comm->cached_kmtree_root = (ROOT);                                              \
 355         coll_comm->cached_kmtree_radix = (RADIX);                                              \
 356     }                                                                                        \
 357 } while (0)
 358 
 359 #define COLL_BASE_UPDATE_PIPELINE( OMPI_COMM, BASE_MODULE, ROOT )       \
 360 do {                                                                                             \
 361     mca_coll_base_comm_t* coll_comm = (BASE_MODULE)->base_data;                               \
 362     if( !( (coll_comm->cached_pipeline)                                                          \
 363            && (coll_comm->cached_pipeline_root == (ROOT)) ) ) {                                  \
 364         if (coll_comm->cached_pipeline) { /* destroy previous pipeline if defined */             \
 365             ompi_coll_base_topo_destroy_tree( &(coll_comm->cached_pipeline) );                  \
 366         }                                                                                        \
 367         coll_comm->cached_pipeline = ompi_coll_base_topo_build_chain( 1, (OMPI_COMM), (ROOT) ); \
 368         coll_comm->cached_pipeline_root = (ROOT);                                                \
 369     }                                                                                            \
 370 } while (0)
 371 
 372 #define COLL_BASE_UPDATE_CHAIN( OMPI_COMM, BASE_MODULE, ROOT, FANOUT )  \
 373 do {                                                                                             \
 374     mca_coll_base_comm_t* coll_comm = (BASE_MODULE)->base_data;                               \
 375     if( !( (coll_comm->cached_chain)                                                             \
 376            && (coll_comm->cached_chain_root == (ROOT))                                           \
 377            && (coll_comm->cached_chain_fanout == (FANOUT)) ) ) {                                 \
 378         if( coll_comm->cached_chain) { /* destroy previous chain if defined */                   \
 379             ompi_coll_base_topo_destroy_tree( &(coll_comm->cached_chain) );                     \
 380         }                                                                                        \
 381         coll_comm->cached_chain = ompi_coll_base_topo_build_chain((FANOUT), (OMPI_COMM), (ROOT)); \
 382         coll_comm->cached_chain_root = (ROOT);                                                   \
 383         coll_comm->cached_chain_fanout = (FANOUT);                                               \
 384     }                                                                                            \
 385 } while (0)
 386 
 387 #define COLL_BASE_UPDATE_IN_ORDER_BINTREE( OMPI_COMM, BASE_MODULE )     \
 388 do {                                                                           \
 389     mca_coll_base_comm_t* coll_comm = (BASE_MODULE)->base_data;             \
 390     if( !(coll_comm->cached_in_order_bintree) ) {                              \
 391         /* In-order binary tree topology is defined by communicator size */    \
 392         /* Thus, there is no need to destroy anything */                       \
 393         coll_comm->cached_in_order_bintree =                                   \
 394         ompi_coll_base_topo_build_in_order_bintree((OMPI_COMM)); \
 395     }                                                                          \
 396 } while (0)
 397 
 398 /**
 399  * This macro give a generic way to compute the best count of
 400  * the segment (i.e. the number of complete datatypes that
 401  * can fit in the specified SEGSIZE). Beware, when this macro
 402  * is called, the SEGCOUNT should be initialized to the count as
 403  * expected by the collective call.
 404  */
 405 #define COLL_BASE_COMPUTED_SEGCOUNT(SEGSIZE, TYPELNG, SEGCOUNT)        \
 406     if( ((SEGSIZE) >= (TYPELNG)) &&                                     \
 407         ((SEGSIZE) < ((TYPELNG) * (SEGCOUNT))) ) {                      \
 408         size_t residual;                                                \
 409         (SEGCOUNT) = (int)((SEGSIZE) / (TYPELNG));                      \
 410         residual = (SEGSIZE) - (SEGCOUNT) * (TYPELNG);                  \
 411         if( residual > ((TYPELNG) >> 1) )                               \
 412             (SEGCOUNT)++;                                               \
 413     }                                                                   \
 414 
 415 /**
 416  * This macro gives a generic wait to compute the well distributed block counts
 417  * when the count and number of blocks are fixed.
 418  * Macro returns "early-block" count, "late-block" count, and "split-index"
 419  * which is the block at which we switch from "early-block" count to
 420  * the "late-block" count.
 421  * count = split_index * early_block_count +
 422  *         (block_count - split_index) * late_block_count
 423  * We do not perform ANY error checks - make sure that the input values
 424  * make sense (eg. count > num_blocks).
 425  */
 426 #define COLL_BASE_COMPUTE_BLOCKCOUNT( COUNT, NUM_BLOCKS, SPLIT_INDEX,       \
 427                                        EARLY_BLOCK_COUNT, LATE_BLOCK_COUNT ) \
 428     EARLY_BLOCK_COUNT = LATE_BLOCK_COUNT = COUNT / NUM_BLOCKS;               \
 429     SPLIT_INDEX = COUNT % NUM_BLOCKS;                                        \
 430     if (0 != SPLIT_INDEX) {                                                  \
 431         EARLY_BLOCK_COUNT = EARLY_BLOCK_COUNT + 1;                           \
 432     }                                                                        \
 433 
 434 /*
 435  * Data structure for hanging data off the communicator
 436  * i.e. per module instance
 437  */
 438 struct mca_coll_base_comm_t {
 439     opal_object_t super;
 440 
 441     /* standard data for requests and PML usage */
 442 
 443     /* Precreate space for requests
 444      * Note this does not effect basic,
 445      * but if in wrong context can confuse a debugger
 446      * this is controlled by an MCA param
 447      */
 448 
 449     ompi_request_t **mcct_reqs;
 450     int mcct_num_reqs;
 451 
 452     /*
 453      * base topo information caching per communicator
 454      *
 455      * for each communicator we cache the topo information so we can
 456      * reuse without regenerating if we change the root, [or fanout]
 457      * then regenerate and recache this information
 458      */
 459 
 460     /* general tree with n fan out */
 461     ompi_coll_tree_t *cached_ntree;
 462     int cached_ntree_root;
 463     int cached_ntree_fanout;
 464 
 465     /* binary tree */
 466     ompi_coll_tree_t *cached_bintree;
 467     int cached_bintree_root;
 468 
 469     /* binomial tree */
 470     ompi_coll_tree_t *cached_bmtree;
 471     int cached_bmtree_root;
 472 
 473     /* binomial tree */
 474     ompi_coll_tree_t *cached_in_order_bmtree;
 475     int cached_in_order_bmtree_root;
 476 
 477     /* k-nomial tree */
 478     ompi_coll_tree_t *cached_kmtree;
 479     int cached_kmtree_root;
 480     int cached_kmtree_radix;
 481 
 482     /* chained tree (fanout followed by pipelines) */
 483     ompi_coll_tree_t *cached_chain;
 484     int cached_chain_root;
 485     int cached_chain_fanout;
 486 
 487     /* pipeline */
 488     ompi_coll_tree_t *cached_pipeline;
 489     int cached_pipeline_root;
 490 
 491     /* in-order binary tree (root of the in-order binary tree is rank 0) */
 492     ompi_coll_tree_t *cached_in_order_bintree;
 493 };
 494 typedef struct mca_coll_base_comm_t mca_coll_base_comm_t;
 495 OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_coll_base_comm_t);
 496 
 497 /**
 498  * Free all requests in an array. As these requests are usually used during
 499  * collective communications, and as on a succesful collective they are
 500  * expected to be released during the corresponding wait, the array should
 501  * generally be empty. However, this function might be used on error conditions
 502  * where it will allow a correct cleanup.
 503  */
 504 static inline void ompi_coll_base_free_reqs(ompi_request_t **reqs, int count)
 505 {
 506     if (OPAL_UNLIKELY(NULL == reqs)) {
 507         return;
 508     }
 509 
 510     for (int i = 0; i < count; ++i) {
 511         if( MPI_REQUEST_NULL != reqs[i] ) {
 512             ompi_request_free(&reqs[i]);
 513         }
 514     }
 515 }
 516 
 517 /**
 518  * Return the array of requests on the data. If the array was not initialized
 519  * or if it's size was too small, allocate it to fit the requested size.
 520  */
 521 ompi_request_t** ompi_coll_base_comm_get_reqs(mca_coll_base_comm_t* data, int nreqs);
 522 
 523 #endif /* MCA_COLL_BASE_EXPORT_H */

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