root/ompi/mca/coll/hcoll/coll_hcoll.h

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

INCLUDED FROM


   1 /**
   2   Copyright (c) 2011      Mellanox Technologies. All rights reserved.
   3   Copyright (c) 2015      Research Organization for Information Science
   4                           and Technology (RIST). All rights reserved.
   5   $COPYRIGHT$
   6 
   7   Additional copyrights may follow
   8 
   9   $HEADER$
  10  */
  11 
  12 #ifndef MCA_COLL_FCA_H
  13 #define MCA_COLL_FCA_H
  14 
  15 #include "ompi_config.h"
  16 
  17 #include "mpi.h"
  18 #include "ompi/mca/mca.h"
  19 #include "opal/memoryhooks/memory.h"
  20 #include "opal/mca/memory/base/base.h"
  21 #include "ompi/mca/coll/coll.h"
  22 #include "ompi/request/request.h"
  23 #include "ompi/mca/pml/pml.h"
  24 #include "ompi/mca/coll/base/coll_tags.h"
  25 #include "ompi/communicator/communicator.h"
  26 #include "ompi/attribute/attribute.h"
  27 #include "ompi/op/op.h"
  28 
  29 #include "orte/runtime/orte_globals.h"
  30 
  31 #include "hcoll/api/hcoll_api.h"
  32 #include "hcoll/api/hcoll_constants.h"
  33 
  34 
  35 #include "coll_hcoll_debug.h"
  36 #ifndef HCOLL_VERSION
  37 #define HCOLL_VERSION(major, minor) (((major)<<HCOLL_MAJOR_BIT)|((minor)<<HCOLL_MINOR_BIT))
  38 #endif
  39 BEGIN_C_DECLS
  40 
  41 
  42 /**
  43  * Globally exported structure
  44  */
  45 
  46 typedef struct mca_coll_hcoll_ops_t {
  47     int (*hcoll_init) (void);
  48     int (*hcoll_finalize) (void);
  49     void * (*create_hcoll_context)(void *);
  50     int (*hcoll_barrier)(void *);
  51 } mca_coll_hcoll_ops_t;
  52 
  53 typedef struct {
  54     opal_free_list_item_t super;
  55     dte_data_representation_t type;
  56 } mca_coll_hcoll_dtype_t;
  57 OBJ_CLASS_DECLARATION(mca_coll_hcoll_dtype_t);
  58 
  59 extern mca_coll_hcoll_dtype_t zero_dte_mapping;
  60 struct mca_coll_hcoll_component_t {
  61     /** Base coll component */
  62     mca_coll_base_component_2_0_0_t super;
  63 
  64     /** MCA parameter: Priority of this component */
  65     int hcoll_priority;
  66 
  67     /** MCA parameter: Verbose level of this component */
  68     int hcoll_verbose;
  69 
  70     /** MCA parameter: Enable FCA */
  71     int   hcoll_enable;
  72 
  73     /** r/o MCA parameter: libhcoll compiletime version */
  74     char* compiletime_version;
  75 
  76     /** r/o MCA parameter: libhcoll runtime version */
  77     const char* runtime_version;
  78 
  79     /** MCA parameter: Minimal number of processes in the communicator
  80         for the corresponding hcoll context to be created */
  81     int hcoll_np;
  82 
  83     /** Whether or not hcoll_init was ever called */
  84     bool libhcoll_initialized;
  85 
  86     bool using_mem_hooks;
  87 
  88     /** MCA parameter: ON/OFF user defined datatype through HCOLL */
  89     int   hcoll_datatype_fallback;
  90 
  91 #if HCOLL_API >= HCOLL_VERSION(3,2)
  92     /* hcoll init options */
  93     hcoll_init_opts_t *init_opts;
  94 #endif
  95 
  96     /* FCA global stuff */
  97     mca_coll_hcoll_ops_t hcoll_ops;
  98     opal_free_list_t requests;
  99     opal_free_list_t dtypes;
 100     int derived_types_support_enabled;
 101 };
 102 typedef struct mca_coll_hcoll_component_t mca_coll_hcoll_component_t;
 103 
 104 OMPI_MODULE_DECLSPEC extern mca_coll_hcoll_component_t mca_coll_hcoll_component;
 105 
 106 
 107 
 108 
 109 /**
 110  * FCA enabled communicator
 111  */
 112 struct mca_coll_hcoll_module_t {
 113     mca_coll_base_module_t super;
 114 
 115     ompi_communicator_t            *comm;
 116     int                 rank;
 117     void *hcoll_context;
 118     /* Saved handlers - for fallback */
 119     mca_coll_base_module_reduce_fn_t previous_reduce;
 120     mca_coll_base_module_t *previous_reduce_module;
 121     mca_coll_base_module_allreduce_fn_t previous_allreduce;
 122     mca_coll_base_module_t *previous_allreduce_module;
 123     mca_coll_base_module_bcast_fn_t previous_bcast;
 124     mca_coll_base_module_t *previous_bcast_module;
 125     mca_coll_base_module_barrier_fn_t previous_barrier;
 126     mca_coll_base_module_t *previous_barrier_module;
 127     mca_coll_base_module_allgather_fn_t previous_allgather;
 128     mca_coll_base_module_t *previous_allgather_module;
 129     mca_coll_base_module_allgatherv_fn_t previous_allgatherv;
 130     mca_coll_base_module_t *previous_allgatherv_module;
 131     mca_coll_base_module_alltoall_fn_t previous_alltoall;
 132     mca_coll_base_module_t *previous_alltoall_module;
 133     mca_coll_base_module_alltoallv_fn_t previous_alltoallv;
 134     mca_coll_base_module_t *previous_alltoallv_module;
 135     mca_coll_base_module_alltoallw_fn_t previous_alltoallw;
 136     mca_coll_base_module_t *previous_alltoallw_module;
 137     mca_coll_base_module_gather_fn_t previous_gather;
 138     mca_coll_base_module_t *previous_gather_module;
 139     mca_coll_base_module_gatherv_fn_t previous_gatherv;
 140     mca_coll_base_module_t *previous_gatherv_module;
 141     mca_coll_base_module_scatterv_fn_t previous_scatterv;
 142     mca_coll_base_module_t *previous_scatterv_module;
 143     mca_coll_base_module_reduce_scatter_fn_t previous_reduce_scatter;
 144     mca_coll_base_module_t *previous_reduce_scatter_module;
 145     mca_coll_base_module_ibcast_fn_t previous_ibcast;
 146     mca_coll_base_module_t *previous_ibcast_module;
 147     mca_coll_base_module_ibarrier_fn_t previous_ibarrier;
 148     mca_coll_base_module_t *previous_ibarrier_module;
 149     mca_coll_base_module_iallgather_fn_t previous_iallgather;
 150     mca_coll_base_module_t *previous_iallgather_module;
 151     mca_coll_base_module_iallgatherv_fn_t previous_iallgatherv;
 152     mca_coll_base_module_t *previous_iallgatherv_module;
 153     mca_coll_base_module_iallreduce_fn_t previous_iallreduce;
 154     mca_coll_base_module_t *previous_iallreduce_module;
 155     mca_coll_base_module_ireduce_fn_t previous_ireduce;
 156     mca_coll_base_module_t *previous_ireduce_module;
 157     mca_coll_base_module_igatherv_fn_t previous_igatherv;
 158     mca_coll_base_module_t *previous_igatherv_module;
 159     mca_coll_base_module_ialltoall_fn_t previous_ialltoall;
 160     mca_coll_base_module_t *previous_ialltoall_module;
 161     mca_coll_base_module_ialltoallv_fn_t previous_ialltoallv;
 162     mca_coll_base_module_t *previous_ialltoallv_module;
 163 };
 164 typedef struct mca_coll_hcoll_module_t mca_coll_hcoll_module_t;
 165 
 166 OBJ_CLASS_DECLARATION(mca_coll_hcoll_module_t);
 167 
 168 
 169 
 170 
 171 /* API functions */
 172 int mca_coll_hcoll_init_query(bool enable_progress_threads, bool enable_mpi_threads);
 173 mca_coll_base_module_t *mca_coll_hcoll_comm_query(struct ompi_communicator_t *comm, int *priority);
 174 int mca_coll_hcoll_get_lib(void);
 175 void hcoll_rte_fns_setup(void);
 176 
 177 
 178 int mca_coll_hcoll_barrier(struct ompi_communicator_t *comm,
 179                          mca_coll_base_module_t *module);
 180 
 181 int mca_coll_hcoll_bcast(void *buff, int count,
 182                         struct ompi_datatype_t *datatype, int root,
 183                         struct ompi_communicator_t *comm,
 184                         mca_coll_base_module_t *module);
 185 
 186 int mca_coll_hcoll_allgather(const void *sbuf, int scount,
 187                             struct ompi_datatype_t *sdtype,
 188                             void *rbuf, int rcount,
 189                             struct ompi_datatype_t *rdtype,
 190                             struct ompi_communicator_t *comm,
 191                             mca_coll_base_module_t *module);
 192 
 193 int mca_coll_hcoll_allgatherv(const void *sbuf, int scount,
 194                             struct ompi_datatype_t *sdtype,
 195                             void *rbuf, const int *rcount,
 196                             const int *displs,
 197                             struct ompi_datatype_t *rdtype,
 198                             struct ompi_communicator_t *comm,
 199                             mca_coll_base_module_t *module);
 200 
 201 int mca_coll_hcoll_gather(const void *sbuf, int scount,
 202                           struct ompi_datatype_t *sdtype,
 203                           void *rbuf, int rcount,
 204                           struct ompi_datatype_t *rdtype,
 205                           int root,
 206                           struct ompi_communicator_t *comm,
 207                           mca_coll_base_module_t *module);
 208 
 209 int mca_coll_hcoll_allreduce(const void *sbuf, void *rbuf, int count,
 210                             struct ompi_datatype_t *dtype,
 211                             struct ompi_op_t *op,
 212                             struct ompi_communicator_t *comm,
 213                             mca_coll_base_module_t *module);
 214 
 215 int mca_coll_hcoll_reduce(const void *sbuf, void *rbuf, int count,
 216                             struct ompi_datatype_t *dtype,
 217                             struct ompi_op_t *op,
 218                             int root,
 219                             struct ompi_communicator_t *comm,
 220                             mca_coll_base_module_t *module);
 221 
 222 int mca_coll_hcoll_alltoall(const void *sbuf, int scount,
 223                            struct ompi_datatype_t *sdtype,
 224                            void* rbuf, int rcount,
 225                            struct ompi_datatype_t *rdtype,
 226                            struct ompi_communicator_t *comm,
 227                            mca_coll_base_module_t *module);
 228 
 229 int mca_coll_hcoll_alltoallv(const void *sbuf, const int *scounts,
 230                             const int *sdisps,
 231                             struct ompi_datatype_t *sdtype,
 232                             void *rbuf, const int *rcounts,
 233                             const int *rdisps,
 234                             struct ompi_datatype_t *rdtype,
 235                             struct ompi_communicator_t *comm,
 236                             mca_coll_base_module_t *module);
 237 
 238 int mca_coll_hcoll_gatherv(const void* sbuf, int scount,
 239                             struct ompi_datatype_t *sdtype,
 240                             void* rbuf, const int *rcounts, const int *displs,
 241                             struct ompi_datatype_t *rdtype,
 242                             int root,
 243                             struct ompi_communicator_t *comm,
 244                             mca_coll_base_module_t *module);
 245 
 246 
 247 int mca_coll_hcoll_scatterv(const void* sbuf, const int *scounts, const int *displs,
 248                             struct ompi_datatype_t *sdtype,
 249                             void* rbuf, int rcount,
 250                             struct ompi_datatype_t *rdtype,
 251                             int root,
 252                             struct ompi_communicator_t *comm,
 253                             mca_coll_base_module_t *module);
 254 
 255 int mca_coll_hcoll_ibarrier(struct ompi_communicator_t *comm,
 256                             ompi_request_t** request,
 257                             mca_coll_base_module_t *module);
 258 
 259 int mca_coll_hcoll_ibcast(void *buff, int count,
 260                             struct ompi_datatype_t *datatype, int root,
 261                             struct ompi_communicator_t *comm,
 262                             ompi_request_t** request,
 263                             mca_coll_base_module_t *module);
 264 
 265 int mca_coll_hcoll_iallgather(const void *sbuf, int scount,
 266                             struct ompi_datatype_t *sdtype,
 267                             void *rbuf, int rcount,
 268                             struct ompi_datatype_t *rdtype,
 269                             struct ompi_communicator_t *comm,
 270                             ompi_request_t** request,
 271                             mca_coll_base_module_t *module);
 272 
 273 int mca_coll_hcoll_iallgatherv(const void *sbuf, int scount,
 274                             struct ompi_datatype_t *sdtype,
 275                             void *rbuf, const int *rcount,
 276                             const int *displs,
 277                             struct ompi_datatype_t *rdtype,
 278                             struct ompi_communicator_t *comm,
 279                             ompi_request_t** request,
 280                             mca_coll_base_module_t *module);
 281 
 282 int mca_coll_hcoll_iallreduce(const void *sbuf, void *rbuf, int count,
 283                             struct ompi_datatype_t *dtype,
 284                             struct ompi_op_t *op,
 285                             struct ompi_communicator_t *comm,
 286                             ompi_request_t** request,
 287                             mca_coll_base_module_t *module);
 288 
 289 int mca_coll_hcoll_ireduce(const void *sbuf, void *rbuf, int count,
 290                             struct ompi_datatype_t *dtype,
 291                             struct ompi_op_t *op,
 292                             int root,
 293                             struct ompi_communicator_t *comm,
 294                             ompi_request_t** request,
 295                             mca_coll_base_module_t *module);
 296 
 297 int mca_coll_hcoll_ialltoall(const void *sbuf, int scount,
 298                             struct ompi_datatype_t *sdtype,
 299                             void* rbuf, int rcount,
 300                             struct ompi_datatype_t *rdtype,
 301                             struct ompi_communicator_t *comm,
 302                             ompi_request_t **req,
 303                             mca_coll_base_module_t *module);
 304 
 305 #if HCOLL_API >= HCOLL_VERSION(3,7)
 306 int mca_coll_hcoll_ialltoallv(const void *sbuf, int *scounts,
 307                             int *sdisps,
 308                             struct ompi_datatype_t *sdtype,
 309                             void *rbuf, int *rcounts,
 310                             int *rdisps,
 311                             struct ompi_datatype_t *rdtype,
 312                             struct ompi_communicator_t *comm,
 313                             ompi_request_t **req,
 314                             mca_coll_base_module_t *module);
 315 #endif
 316 
 317 int mca_coll_hcoll_igatherv(const void* sbuf, int scount,
 318                             struct ompi_datatype_t *sdtype,
 319                             void* rbuf, const int *rcounts, const int *displs,
 320                             struct ompi_datatype_t *rdtype,
 321                             int root,
 322                             struct ompi_communicator_t *comm,
 323                             ompi_request_t ** request,
 324                             mca_coll_base_module_t *module);
 325 
 326 void mca_coll_hcoll_mem_release_cb(void *buf, size_t length, void *cbdata, bool from_alloc);
 327 END_C_DECLS
 328 
 329 #endif

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