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

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

DEFINITIONS

This source file includes following definitions.
  1. ompi_coll_tuned_exscan_intra_check_forced_init
  2. ompi_coll_tuned_exscan_intra_do_this

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2018      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 #include "ompi_config.h"
  13 
  14 #include "mpi.h"
  15 #include "ompi/constants.h"
  16 #include "ompi/datatype/ompi_datatype.h"
  17 #include "ompi/communicator/communicator.h"
  18 #include "ompi/mca/coll/coll.h"
  19 #include "ompi/mca/coll/base/coll_base_topo.h"
  20 #include "ompi/mca/coll/base/coll_tags.h"
  21 #include "ompi/mca/pml/pml.h"
  22 #include "ompi/op/op.h"
  23 #include "coll_tuned.h"
  24 
  25 /* exscan algorithm variables */
  26 static int coll_tuned_exscan_forced_algorithm = 0;
  27 
  28 /* valid values for coll_tuned_exscan_forced_algorithm */
  29 static mca_base_var_enum_value_t exscan_algorithms[] = {
  30     {0, "ignore"},
  31     {1, "linear"},
  32     {2, "recursive_doubling"},
  33     {0, NULL}
  34 };
  35 
  36 /**
  37  * The following are used by dynamic and forced rules
  38  *
  39  * publish details of each algorithm and if its forced/fixed/locked in
  40  * as you add methods/algorithms you must update this and the query/map routines
  41  *
  42  * this routine is called by the component only
  43  * this makes sure that the mca parameters are set to their initial values and
  44  * perms module does not call this they call the forced_getvalues routine
  45  * instead.
  46  */
  47 
  48 int ompi_coll_tuned_exscan_intra_check_forced_init (coll_tuned_force_algorithm_mca_param_indices_t *mca_param_indices)
  49 {
  50     mca_base_var_enum_t*new_enum;
  51     int cnt;
  52 
  53     for( cnt = 0; NULL != exscan_algorithms[cnt].string; cnt++ );
  54     ompi_coll_tuned_forced_max_algorithms[EXSCAN] = cnt;
  55 
  56     (void) mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
  57                                            "exscan_algorithm_count",
  58                                            "Number of exscan algorithms available",
  59                                            MCA_BASE_VAR_TYPE_INT, NULL, 0,
  60                                            MCA_BASE_VAR_FLAG_DEFAULT_ONLY,
  61                                            OPAL_INFO_LVL_5,
  62                                            MCA_BASE_VAR_SCOPE_CONSTANT,
  63                                            &ompi_coll_tuned_forced_max_algorithms[EXSCAN]);
  64 
  65     /* MPI_T: This variable should eventually be bound to a communicator */
  66     coll_tuned_exscan_forced_algorithm = 0;
  67     (void) mca_base_var_enum_create("coll_tuned_exscan_algorithms", exscan_algorithms, &new_enum);
  68     mca_param_indices->algorithm_param_index =
  69         mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
  70                                         "exscan_algorithm",
  71                                         "Which exscan algorithm is used. Can be locked down to choice of: 0 ignore, 1 linear, 2 recursive_doubling",
  72                                         MCA_BASE_VAR_TYPE_INT, new_enum, 0, MCA_BASE_VAR_FLAG_SETTABLE,
  73                                         OPAL_INFO_LVL_5,
  74                                         MCA_BASE_VAR_SCOPE_ALL,
  75                                         &coll_tuned_exscan_forced_algorithm);
  76     OBJ_RELEASE(new_enum);
  77     if (mca_param_indices->algorithm_param_index < 0) {
  78         return mca_param_indices->algorithm_param_index;
  79     }
  80 
  81     return (MPI_SUCCESS);
  82 }
  83 
  84 int ompi_coll_tuned_exscan_intra_do_this(const void *sbuf, void* rbuf, int count,
  85                                          struct ompi_datatype_t *dtype,
  86                                          struct ompi_op_t *op,
  87                                          struct ompi_communicator_t *comm,
  88                                          mca_coll_base_module_t *module,
  89                                          int algorithm)
  90 {
  91     OPAL_OUTPUT((ompi_coll_tuned_stream,"coll:tuned:exscan_intra_do_this selected algorithm %d",
  92                  algorithm));
  93 
  94     switch (algorithm) {
  95     case (0):
  96     case (1):  return ompi_coll_base_exscan_intra_linear(sbuf, rbuf, count, dtype,
  97                                                          op, comm, module);
  98     case (2):  return ompi_coll_base_exscan_intra_recursivedoubling(sbuf, rbuf, count, dtype,
  99                                                                     op, comm, module);
 100     } /* switch */
 101     OPAL_OUTPUT((ompi_coll_tuned_stream,"coll:tuned:exscan_intra_do_this attempt to select algorithm %d when only 0-%d is valid?",
 102                  algorithm, ompi_coll_tuned_forced_max_algorithms[EXSCAN]));
 103     return (MPI_ERR_ARG);
 104 }

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