root/ompi/mca/coll/tuned/coll_tuned_allgatherv_decision.c

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

DEFINITIONS

This source file includes following definitions.
  1. ompi_coll_tuned_allgatherv_intra_check_forced_init
  2. ompi_coll_tuned_allgatherv_intra_do_this

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2017 The University of Tennessee and The University
   4  *                         of Tennessee Research Foundation.  All rights
   5  *                         reserved.
   6  * Copyright (c) 2015      Research Organization for Information Science
   7  *                         and Technology (RIST). All rights reserved.
   8  * $COPYRIGHT$
   9  *
  10  * Additional copyrights may follow
  11  *
  12  * $HEADER$
  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_tags.h"
  23 #include "coll_tuned.h"
  24 #include "ompi/mca/coll/base/coll_base_topo.h"
  25 #include "ompi/mca/coll/base/coll_base_util.h"
  26 
  27 /* allgatherv algorithm variables */
  28 static int coll_tuned_allgatherv_forced_algorithm = 0;
  29 static int coll_tuned_allgatherv_segment_size = 0;
  30 static int coll_tuned_allgatherv_tree_fanout;
  31 static int coll_tuned_allgatherv_chain_fanout;
  32 
  33 /* valid values for coll_tuned_allgatherv_forced_algorithm */
  34 static mca_base_var_enum_value_t allgatherv_algorithms[] = {
  35     {0, "ignore"},
  36     {1, "default"},
  37     {2, "bruck"},
  38     {3, "ring"},
  39     {4, "neighbor"},
  40     {5, "two_proc"},
  41     {0, NULL}
  42 };
  43 
  44 /* The following are used by dynamic and forced rules */
  45 
  46 /* publish details of each algorithm and if its forced/fixed/locked in */
  47 /* as you add methods/algorithms you must update this and the query/map
  48    routines */
  49 
  50 /* this routine is called by the component only */
  51 /* this makes sure that the mca parameters are set to their initial values
  52    and perms */
  53 /* module does not call this they call the forced_getvalues routine instead */
  54 
  55 int
  56 ompi_coll_tuned_allgatherv_intra_check_forced_init(coll_tuned_force_algorithm_mca_param_indices_t *mca_param_indices)
  57 {
  58     mca_base_var_enum_t *new_enum;
  59     int cnt;
  60 
  61     for( cnt = 0; NULL != allgatherv_algorithms[cnt].string; cnt++ );
  62     ompi_coll_tuned_forced_max_algorithms[ALLGATHERV] = cnt;
  63 
  64     (void) mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
  65                                            "allgatherv_algorithm_count",
  66                                            "Number of allgatherv algorithms available",
  67                                            MCA_BASE_VAR_TYPE_INT, NULL, 0,
  68                                            MCA_BASE_VAR_FLAG_DEFAULT_ONLY,
  69                                            OPAL_INFO_LVL_5,
  70                                            MCA_BASE_VAR_SCOPE_CONSTANT,
  71                                            &ompi_coll_tuned_forced_max_algorithms[ALLGATHERV]);
  72 
  73     /* MPI_T: This variable should eventually be bound to a communicator */
  74     coll_tuned_allgatherv_forced_algorithm = 0;
  75     (void) mca_base_var_enum_create("coll_tuned_allgatherv_algorithms", allgatherv_algorithms, &new_enum);
  76     mca_param_indices->algorithm_param_index =
  77         mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
  78                                         "allgatherv_algorithm",
  79                                         "Which allallgatherv algorithm is used. Can be locked down to choice of: 0 ignore, 1 default (allgathervv + bcast), 2 bruck, 3 ring, 4 neighbor exchange, 5: two proc only.",
  80                                         MCA_BASE_VAR_TYPE_INT, new_enum, 0, MCA_BASE_VAR_FLAG_SETTABLE,
  81                                         OPAL_INFO_LVL_5,
  82                                         MCA_BASE_VAR_SCOPE_CONSTANT,
  83                                         &coll_tuned_allgatherv_forced_algorithm);
  84     OBJ_RELEASE(new_enum);
  85     if (mca_param_indices->algorithm_param_index < 0) {
  86         return mca_param_indices->algorithm_param_index;
  87     }
  88 
  89     coll_tuned_allgatherv_segment_size = 0;
  90     mca_param_indices->segsize_param_index =
  91         mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
  92                                         "allgatherv_algorithm_segmentsize",
  93                                         "Segment size in bytes used by default for allgatherv algorithms. Only has meaning if algorithm is forced and supports segmenting. 0 bytes means no segmentation. Currently, available algorithms do not support segmentation.",
  94                                         MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
  95                                         OPAL_INFO_LVL_5,
  96                                         MCA_BASE_VAR_SCOPE_CONSTANT,
  97                                         &coll_tuned_allgatherv_segment_size);
  98 
  99     coll_tuned_allgatherv_tree_fanout = ompi_coll_tuned_init_tree_fanout; /* get system wide default */
 100     mca_param_indices->tree_fanout_param_index =
 101         mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
 102                                         "allgatherv_algorithm_tree_fanout",
 103                                         "Fanout for n-tree used for allgatherv algorithms. Only has meaning if algorithm is forced and supports n-tree topo based operation. Currently, available algorithms do not support n-tree topologies.",
 104                                         MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
 105                                         OPAL_INFO_LVL_5,
 106                                         MCA_BASE_VAR_SCOPE_CONSTANT,
 107                                         &coll_tuned_allgatherv_tree_fanout);
 108 
 109     coll_tuned_allgatherv_chain_fanout = ompi_coll_tuned_init_chain_fanout; /* get system wide default */
 110     mca_param_indices->chain_fanout_param_index =
 111       mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
 112                                       "allgatherv_algorithm_chain_fanout",
 113                                       "Fanout for chains used for allgatherv algorithms. Only has meaning if algorithm is forced and supports chain topo based operation. Currently, available algorithms do not support chain topologies.",
 114                                       MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
 115                                       OPAL_INFO_LVL_5,
 116                                       MCA_BASE_VAR_SCOPE_CONSTANT,
 117                                       &coll_tuned_allgatherv_chain_fanout);
 118 
 119     return (MPI_SUCCESS);
 120 }
 121 
 122 int ompi_coll_tuned_allgatherv_intra_do_this(const void *sbuf, int scount,
 123                                              struct ompi_datatype_t *sdtype,
 124                                              void *rbuf, const int *rcounts,
 125                                              const int *rdispls,
 126                                              struct ompi_datatype_t *rdtype,
 127                                              struct ompi_communicator_t *comm,
 128                                              mca_coll_base_module_t *module,
 129                                              int algorithm, int faninout,
 130                                              int segsize)
 131 {
 132     OPAL_OUTPUT((ompi_coll_tuned_stream,
 133                  "coll:tuned:allgatherv_intra_do_this selected algorithm %d topo faninout %d segsize %d",
 134                  algorithm, faninout, segsize));
 135 
 136     switch (algorithm) {
 137     case (0):
 138         return ompi_coll_tuned_allgatherv_intra_dec_fixed(sbuf, scount, sdtype,
 139                                                           rbuf, rcounts, rdispls, rdtype,
 140                                                           comm, module);
 141     case (1):
 142         return ompi_coll_base_allgatherv_intra_basic_default(sbuf, scount, sdtype,
 143                                                              rbuf, rcounts, rdispls, rdtype,
 144                                                              comm, module);
 145     case (2):
 146         return ompi_coll_base_allgatherv_intra_bruck(sbuf, scount, sdtype,
 147                                                      rbuf, rcounts, rdispls, rdtype,
 148                                                      comm, module);
 149     case (3):
 150         return ompi_coll_base_allgatherv_intra_ring(sbuf, scount, sdtype,
 151                                                     rbuf, rcounts, rdispls, rdtype,
 152                                                     comm, module);
 153     case (4):
 154         return ompi_coll_base_allgatherv_intra_neighborexchange(sbuf, scount, sdtype,
 155                                                                 rbuf, rcounts, rdispls, rdtype,
 156                                                                 comm, module);
 157     case (5):
 158         return ompi_coll_base_allgatherv_intra_two_procs(sbuf, scount, sdtype,
 159                                                          rbuf, rcounts, rdispls, rdtype,
 160                                                          comm, module);
 161     } /* switch */
 162     OPAL_OUTPUT((ompi_coll_tuned_stream,
 163                  "coll:tuned:allgatherv_intra_do_this attempt to select algorithm %d when only 0-%d is valid?",
 164                  algorithm, ompi_coll_tuned_forced_max_algorithms[ALLGATHERV]));
 165     return (MPI_ERR_ARG);
 166 }

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