root/oshmem/mca/scoll/scoll.h

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

INCLUDED FROM


   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2013      Mellanox Technologies, Inc.
   4  *                         All rights reserved.
   5  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
   6  *                         reserved.
   7  * $COPYRIGHT$
   8  *
   9  * Additional copyrights may follow
  10  *
  11  * $HEADER$
  12  */
  13 
  14 /**
  15  * @file
  16  *
  17  * Collective Communication Interface
  18  *
  19  */
  20 
  21 #ifndef OSHMEM_MCA_SCOLL_H
  22 #define OSHMEM_MCA_SCOLL_H
  23 
  24 #include "oshmem_config.h"
  25 #include "oshmem/types.h"
  26 #include "oshmem/constants.h"
  27 
  28 #include "opal/util/output.h"
  29 #include "mpi.h"
  30 #include "oshmem/mca/mca.h"
  31 #include "opal/mca/base/base.h"
  32 
  33 BEGIN_C_DECLS
  34 
  35 /* ******************************************************************** */
  36 
  37 struct oshmem_group_t;
  38 struct oshmem_op_t;
  39 
  40 /* ******************************************************************** */
  41 
  42 typedef int (*mca_scoll_base_component_init_fn_t)(bool enable_progress_threads,
  43                                                   bool enable_threads);
  44 
  45 typedef struct mca_scoll_base_module_1_0_0_t* (*mca_scoll_base_component_query_fn_t)(struct oshmem_group_t *group,
  46                                                                                      int *priority);
  47 
  48 /* ******************************************************************** */
  49 
  50 /**
  51  * Collective component interface
  52  *
  53  * Component interface for the collective framework.  A public
  54  * instance of this structure, called
  55  * mca_scoll_[component_name]_component, must exist in any collective
  56  * component.
  57  */
  58 struct mca_scoll_base_component_1_0_0_t {
  59     /** Base component description */
  60     mca_base_component_t scoll_version;
  61     /** Base component data block */
  62     mca_base_component_data_t scoll_data;
  63 
  64     /** Component initialization function */
  65     mca_scoll_base_component_init_fn_t scoll_init;
  66     mca_scoll_base_component_query_fn_t scoll_query;
  67 };
  68 typedef struct mca_scoll_base_component_1_0_0_t mca_scoll_base_component_1_0_0_t;
  69 
  70 /** Per guidence in mca.h, use the unversioned struct name if you just
  71  want to always keep up with the most recent version of the
  72  interace. */
  73 typedef struct mca_scoll_base_component_1_0_0_t mca_scoll_base_component_t;
  74 
  75 /**
  76  * Collective module interface
  77  *
  78  * Module interface to the Collective framework.  Modules are
  79  * reference counted based on the number of functions from the module
  80  * used on the commuicator.  There is at most one module per component
  81  * on a given communicator, and there can be many component modules on
  82  * a given communicator.
  83  *
  84  * @note The collective framework and the
  85  * communicator functionality only stores a pointer to the module
  86  * function, so the component is free to create a structure that
  87  * inherits from this one for use as the module structure.
  88  */
  89 typedef int
  90 (*mca_scoll_base_module_enable_1_0_0_fn_t)(struct mca_scoll_base_module_1_0_0_t* module,
  91                                            struct oshmem_group_t *comm);
  92 
  93 #define SCOLL_DEFAULT_ALG   (-1)
  94 
  95 #define SCOLL_ALG_BARRIER_CENTRAL_COUNTER       0
  96 #define SCOLL_ALG_BARRIER_TOURNAMENT            1
  97 #define SCOLL_ALG_BARRIER_RECURSIVE_DOUBLING    2
  98 #define SCOLL_ALG_BARRIER_DISSEMINATION         3
  99 #define SCOLL_ALG_BARRIER_BASIC                 4
 100 #define SCOLL_ALG_BARRIER_ADAPTIVE              5
 101 
 102 #define SCOLL_ALG_BROADCAST_CENTRAL_COUNTER     0
 103 #define SCOLL_ALG_BROADCAST_BINOMIAL            1
 104 
 105 #define SCOLL_ALG_COLLECT_CENTRAL_COUNTER       0
 106 #define SCOLL_ALG_COLLECT_TOURNAMENT            1
 107 #define SCOLL_ALG_COLLECT_RECURSIVE_DOUBLING    2
 108 #define SCOLL_ALG_COLLECT_RING                  3
 109 
 110 #define SCOLL_ALG_REDUCE_CENTRAL_COUNTER        0
 111 #define SCOLL_ALG_REDUCE_TOURNAMENT             1
 112 #define SCOLL_ALG_REDUCE_RECURSIVE_DOUBLING     2
 113 #define SCOLL_ALG_REDUCE_LEGACY_LINEAR          3   /* Based linear algorithm from OMPI coll:basic */
 114 #define SCOLL_ALG_REDUCE_LEGACY_LOG             4   /* Based log algorithm from OMPI coll:basic */
 115 
 116 typedef int (*mca_scoll_base_module_barrier_fn_t)(struct oshmem_group_t *group,
 117                                                   long *pSync,
 118                                                   int alg);
 119 typedef int (*mca_scoll_base_module_broadcast_fn_t)(struct oshmem_group_t *group,
 120                                                     int PE_root,
 121                                                     void *target,
 122                                                     const void *source,
 123                                                     size_t nlong,
 124                                                     long *pSync,
 125                                                     bool nlong_type,
 126                                                     int alg);
 127 typedef int (*mca_scoll_base_module_collect_fn_t)(struct oshmem_group_t *group,
 128                                                   void *target,
 129                                                   const void *source,
 130                                                   size_t nlong,
 131                                                   long *pSync,
 132                                                   bool nlong_type,
 133                                                   int alg);
 134 typedef int (*mca_scoll_base_module_reduce_fn_t)(struct oshmem_group_t *group,
 135                                                  struct oshmem_op_t *op,
 136                                                  void *target,
 137                                                  const void *source,
 138                                                  size_t nlong,
 139                                                  long *pSync,
 140                                                  void *pWrk,
 141                                                  int alg);
 142 typedef int (*mca_scoll_base_module_alltoall_fn_t)(struct oshmem_group_t *group,
 143                                                   void *target,
 144                                                   const void *source,
 145                                                   ptrdiff_t dst, ptrdiff_t sst,
 146                                                   size_t nelems,
 147                                                   size_t element_size,
 148                                                   long *pSync,
 149                                                   int alg);
 150 
 151 struct mca_scoll_base_module_1_0_0_t {
 152     /** Collective modules all inherit from opal_object */
 153     opal_object_t super;
 154 
 155     /* Collective function pointers */
 156     mca_scoll_base_module_barrier_fn_t scoll_barrier;
 157     mca_scoll_base_module_broadcast_fn_t scoll_broadcast;
 158     mca_scoll_base_module_collect_fn_t scoll_collect;
 159     mca_scoll_base_module_reduce_fn_t scoll_reduce;
 160     mca_scoll_base_module_alltoall_fn_t scoll_alltoall;
 161     mca_scoll_base_module_enable_1_0_0_fn_t scoll_module_enable;
 162 };
 163 typedef struct mca_scoll_base_module_1_0_0_t mca_scoll_base_module_1_0_0_t;
 164 
 165 /** Per guidance in mca.h, use the unversioned struct name if you just
 166  want to always keep up with the most recent version of the
 167  interface. */
 168 typedef struct mca_scoll_base_module_1_0_0_t mca_scoll_base_module_t;
 169 OSHMEM_DECLSPEC OBJ_CLASS_DECLARATION(mca_scoll_base_module_t);
 170 
 171 /* ******************************************************************** */
 172 
 173 /*
 174  * Macro for use in components that are of type coll
 175  */
 176 #define MCA_SCOLL_BASE_VERSION_2_0_0 \
 177     OSHMEM_MCA_BASE_VERSION_2_1_0("scoll", 1, 0, 0)
 178 
 179 /* ******************************************************************** */
 180 /*
 181  * Collectives group cache structure
 182  *
 183  * Collectives group cache structure, used to find functions to
 184  * implement collective algorithms and their associated modules.
 185  */
 186 struct mca_scoll_base_group_scoll_t {
 187     mca_scoll_base_module_barrier_fn_t scoll_barrier;
 188     mca_scoll_base_module_1_0_0_t *scoll_barrier_module;
 189     mca_scoll_base_module_broadcast_fn_t scoll_broadcast;
 190     mca_scoll_base_module_1_0_0_t *scoll_broadcast_module;
 191     mca_scoll_base_module_collect_fn_t scoll_collect;
 192     mca_scoll_base_module_1_0_0_t *scoll_collect_module;
 193     mca_scoll_base_module_reduce_fn_t scoll_reduce;
 194     mca_scoll_base_module_1_0_0_t *scoll_reduce_module;
 195     mca_scoll_base_module_alltoall_fn_t scoll_alltoall;
 196     mca_scoll_base_module_1_0_0_t *scoll_alltoall_module;
 197 };
 198 typedef struct mca_scoll_base_group_scoll_t mca_scoll_base_group_scoll_t;
 199 
 200 #define PREVIOUS_SCOLL_FN(module, __api, group, ...) do { \
 201     group->g_scoll.scoll_ ## __api ## _module = (mca_scoll_base_module_1_0_0_t*) module->previous_ ## __api ## _module; \
 202     rc = module->previous_ ## __api (group, __VA_ARGS__); \
 203     group->g_scoll.scoll_ ## __api ## _module = (mca_scoll_base_module_1_0_0_t*) module; \
 204 } while(0)
 205 
 206 END_C_DECLS
 207 
 208 #endif /* OSHMEM_MCA_SCOLL_H */

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