This source file includes following definitions.
- ompi_coll_tuned_reduce_intra_check_forced_init
- ompi_coll_tuned_reduce_intra_do_this
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 #include "ompi_config.h"
  16 
  17 #include "mpi.h"
  18 #include "ompi/constants.h"
  19 #include "ompi/datatype/ompi_datatype.h"
  20 #include "ompi/communicator/communicator.h"
  21 #include "ompi/mca/coll/coll.h"
  22 #include "ompi/mca/coll/base/coll_base_topo.h"
  23 #include "ompi/mca/coll/base/coll_tags.h"
  24 #include "ompi/mca/pml/pml.h"
  25 #include "ompi/op/op.h"
  26 #include "coll_tuned.h"
  27 
  28 
  29 static int coll_tuned_reduce_forced_algorithm = 0;
  30 static int coll_tuned_reduce_segment_size = 0;
  31 static int coll_tuned_reduce_max_requests;
  32 static int coll_tuned_reduce_tree_fanout;
  33 static int coll_tuned_reduce_chain_fanout;
  34 
  35 
  36 static mca_base_var_enum_value_t reduce_algorithms[] = {
  37     {0, "ignore"},
  38     {1, "linear"},
  39     {2, "chain"},
  40     {3, "pipeline"},
  41     {4, "binary"},
  42     {5, "binomial"},
  43     {6, "in-order_binary"},
  44     {7, "rabenseifner"},
  45     {0, NULL}
  46 };
  47 
  48 
  49 
  50 
  51 
  52 
  53 
  54 
  55 
  56 
  57 
  58 
  59 
  60 int ompi_coll_tuned_reduce_intra_check_forced_init (coll_tuned_force_algorithm_mca_param_indices_t *mca_param_indices)
  61 {
  62     mca_base_var_enum_t*new_enum;
  63     int cnt;
  64 
  65     for( cnt = 0; NULL != reduce_algorithms[cnt].string; cnt++ );
  66     ompi_coll_tuned_forced_max_algorithms[REDUCE] = cnt;
  67 
  68     (void) mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
  69                                            "reduce_algorithm_count",
  70                                            "Number of reduce algorithms available",
  71                                            MCA_BASE_VAR_TYPE_INT, NULL, 0,
  72                                            MCA_BASE_VAR_FLAG_DEFAULT_ONLY,
  73                                            OPAL_INFO_LVL_5,
  74                                            MCA_BASE_VAR_SCOPE_CONSTANT,
  75                                            &ompi_coll_tuned_forced_max_algorithms[REDUCE]);
  76 
  77     
  78     coll_tuned_reduce_forced_algorithm = 0;
  79     (void) mca_base_var_enum_create("coll_tuned_reduce_algorithms", reduce_algorithms, &new_enum);
  80     mca_param_indices->algorithm_param_index =
  81         mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
  82                                         "reduce_algorithm",
  83                                         "Which reduce algorithm is used. Can be locked down to choice of: 0 ignore, 1 linear, 2 chain, 3 pipeline, 4 binary, 5 binomial, 6 in-order binary, 7 rabenseifner",
  84                                         MCA_BASE_VAR_TYPE_INT, new_enum, 0, MCA_BASE_VAR_FLAG_SETTABLE,
  85                                         OPAL_INFO_LVL_5,
  86                                         MCA_BASE_VAR_SCOPE_ALL,
  87                                         &coll_tuned_reduce_forced_algorithm);
  88     OBJ_RELEASE(new_enum);
  89     if (mca_param_indices->algorithm_param_index < 0) {
  90         return mca_param_indices->algorithm_param_index;
  91     }
  92 
  93     coll_tuned_reduce_segment_size = 0;
  94     mca_param_indices->segsize_param_index =
  95         mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
  96                                         "reduce_algorithm_segmentsize",
  97                                         "Segment size in bytes used by default for reduce algorithms. Only has meaning if algorithm is forced and supports segmenting. 0 bytes means no segmentation.",
  98                                         MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
  99                                         OPAL_INFO_LVL_5,
 100                                         MCA_BASE_VAR_SCOPE_ALL,
 101                                         &coll_tuned_reduce_segment_size);
 102 
 103     coll_tuned_reduce_tree_fanout = ompi_coll_tuned_init_tree_fanout; 
 104     mca_param_indices->tree_fanout_param_index =
 105         mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
 106                                         "reduce_algorithm_tree_fanout",
 107                                         "Fanout for n-tree used for reduce algorithms. Only has meaning if algorithm is forced and supports n-tree topo based operation.",
 108                                         MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
 109                                         OPAL_INFO_LVL_5,
 110                                         MCA_BASE_VAR_SCOPE_ALL,
 111                                         &coll_tuned_reduce_tree_fanout);
 112 
 113     coll_tuned_reduce_chain_fanout = ompi_coll_tuned_init_chain_fanout; 
 114     mca_param_indices->chain_fanout_param_index =
 115       mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
 116                                       "reduce_algorithm_chain_fanout",
 117                                       "Fanout for chains used for reduce algorithms. Only has meaning if algorithm is forced and supports chain topo based operation.",
 118                                       MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
 119                                       OPAL_INFO_LVL_5,
 120                                       MCA_BASE_VAR_SCOPE_ALL,
 121                                       &coll_tuned_reduce_chain_fanout);
 122 
 123     coll_tuned_reduce_max_requests = 0; 
 124     mca_param_indices->max_requests_param_index =
 125       mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
 126                                       "reduce_algorithm_max_requests",
 127                                       "Maximum number of outstanding send requests on leaf nodes. 0 means no limit.",
 128                                       MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
 129                                       OPAL_INFO_LVL_5,
 130                                       MCA_BASE_VAR_SCOPE_ALL,
 131                                       &coll_tuned_reduce_max_requests);
 132     if (mca_param_indices->max_requests_param_index < 0) {
 133         return mca_param_indices->max_requests_param_index;
 134     }
 135 
 136     if (coll_tuned_reduce_max_requests < 0) {
 137         if( 0 == ompi_comm_rank( MPI_COMM_WORLD ) ) {
 138             opal_output( 0, "Maximum outstanding requests must be positive number or 0.  Initializing to 0 (no limit).\n" );
 139         }
 140         coll_tuned_reduce_max_requests = 0;
 141     }
 142 
 143     return (MPI_SUCCESS);
 144 }
 145 
 146 int ompi_coll_tuned_reduce_intra_do_this(const void *sbuf, void* rbuf, int count,
 147                                          struct ompi_datatype_t *dtype,
 148                                          struct ompi_op_t *op, int root,
 149                                          struct ompi_communicator_t *comm,
 150                                          mca_coll_base_module_t *module,
 151                                          int algorithm, int faninout,
 152                                          int segsize, int max_requests )
 153 {
 154     OPAL_OUTPUT((ompi_coll_tuned_stream,"coll:tuned:reduce_intra_do_this selected algorithm %d topo faninout %d segsize %d",
 155                  algorithm, faninout, segsize));
 156 
 157     switch (algorithm) {
 158     case (0):  return ompi_coll_tuned_reduce_intra_dec_fixed(sbuf, rbuf, count, dtype,
 159                                                              op, root, comm, module);
 160     case (1):  return ompi_coll_base_reduce_intra_basic_linear(sbuf, rbuf, count, dtype,
 161                                                                op, root, comm, module);
 162     case (2):  return ompi_coll_base_reduce_intra_chain(sbuf, rbuf, count, dtype,
 163                                                         op, root, comm, module,
 164                                                         segsize, faninout, max_requests);
 165     case (3):  return ompi_coll_base_reduce_intra_pipeline(sbuf, rbuf, count, dtype,
 166                                                            op, root, comm, module,
 167                                                            segsize, max_requests);
 168     case (4):  return ompi_coll_base_reduce_intra_binary(sbuf, rbuf, count, dtype,
 169                                                          op, root, comm, module,
 170                                                          segsize, max_requests);
 171     case (5):  return ompi_coll_base_reduce_intra_binomial(sbuf, rbuf, count, dtype,
 172                                                            op, root, comm, module,
 173                                                            segsize, max_requests);
 174     case (6):  return ompi_coll_base_reduce_intra_in_order_binary(sbuf, rbuf, count, dtype,
 175                                                                   op, root, comm, module,
 176                                                                   segsize, max_requests);
 177     case (7):  return ompi_coll_base_reduce_intra_redscat_gather(sbuf, rbuf, count, dtype,
 178                                                                   op, root, comm, module);
 179     } 
 180     OPAL_OUTPUT((ompi_coll_tuned_stream,"coll:tuned:reduce_intra_do_this attempt to select algorithm %d when only 0-%d is valid?",
 181                  algorithm, ompi_coll_tuned_forced_max_algorithms[REDUCE]));
 182     return (MPI_ERR_ARG);
 183 }