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

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

DEFINITIONS

This source file includes following definitions.
  1. ompi_coll_tuned_barrier_intra_check_forced_init
  2. ompi_coll_tuned_barrier_intra_do_this

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2015 The University of Tennessee and The University
   4  *                         of Tennessee Research Foundation.  All rights
   5  *                         reserved.
   6  * $COPYRIGHT$
   7  *
   8  * Additional copyrights may follow
   9  *
  10  * $HEADER$
  11  */
  12 
  13 #include "ompi_config.h"
  14 
  15 #include "mpi.h"
  16 #include "opal/util/bit_ops.h"
  17 #include "ompi/constants.h"
  18 #include "ompi/communicator/communicator.h"
  19 #include "ompi/mca/coll/coll.h"
  20 #include "ompi/mca/coll/base/coll_tags.h"
  21 #include "ompi/mca/pml/pml.h"
  22 #include "coll_tuned.h"
  23 #include "ompi/mca/coll/base/coll_base_topo.h"
  24 #include "ompi/mca/coll/base/coll_base_util.h"
  25 
  26 /* barrier algorithm variables */
  27 static int coll_tuned_barrier_forced_algorithm = 0;
  28 
  29 /* valid values for coll_tuned_barrier_forced_algorithm */
  30 static mca_base_var_enum_value_t barrier_algorithms[] = {
  31     {0, "ignore"},
  32     {1, "linear"},
  33     {2, "double_ring"},
  34     {3, "recursive_doubling"},
  35     {4, "bruck"},
  36     {5, "two_proc"},
  37     {6, "tree"},
  38     {0, NULL}
  39 };
  40 
  41 /* The following are used by dynamic and forced rules */
  42 
  43 /* publish details of each algorithm and if its forced/fixed/locked in */
  44 /* as you add methods/algorithms you must update this and the query/map  */
  45 /* routines */
  46 
  47 /* this routine is called by the component only */
  48 /* this makes sure that the mca parameters are set to their initial values */
  49 /* and perms */
  50 /* module does not call this they call the forced_getvalues routine instead */
  51 
  52 int ompi_coll_tuned_barrier_intra_check_forced_init (coll_tuned_force_algorithm_mca_param_indices_t *mca_param_indices)
  53 {
  54     mca_base_var_enum_t *new_enum;
  55     int cnt;
  56 
  57     for( cnt = 0; NULL != barrier_algorithms[cnt].string; cnt++ );
  58     ompi_coll_tuned_forced_max_algorithms[BARRIER] = cnt;
  59 
  60     (void) mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
  61                                            "barrier_algorithm_count",
  62                                            "Number of barrier algorithms available",
  63                                            MCA_BASE_VAR_TYPE_INT, NULL, 0,
  64                                            MCA_BASE_VAR_FLAG_DEFAULT_ONLY,
  65                                            OPAL_INFO_LVL_5,
  66                                            MCA_BASE_VAR_SCOPE_CONSTANT,
  67                                            &ompi_coll_tuned_forced_max_algorithms[BARRIER]);
  68 
  69     /* MPI_T: This variable should eventually be bound to a communicator */
  70     coll_tuned_barrier_forced_algorithm = 0;
  71     (void) mca_base_var_enum_create("coll_tuned_barrier_algorithms", barrier_algorithms, &new_enum);
  72     mca_param_indices->algorithm_param_index =
  73         mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
  74                                         "barrier_algorithm",
  75                                         "Which barrier algorithm is used. Can be locked down to choice of: 0 ignore, 1 linear, 2 double ring, 3: recursive doubling 4: bruck, 5: two proc only, 6: tree",
  76                                         MCA_BASE_VAR_TYPE_INT, new_enum, 0, MCA_BASE_VAR_FLAG_SETTABLE,
  77                                         OPAL_INFO_LVL_5,
  78                                         MCA_BASE_VAR_SCOPE_ALL,
  79                                         &coll_tuned_barrier_forced_algorithm);
  80     OBJ_RELEASE(new_enum);
  81     if (mca_param_indices->algorithm_param_index < 0) {
  82         return mca_param_indices->algorithm_param_index;
  83     }
  84 
  85     return (MPI_SUCCESS);
  86 }
  87 
  88 int ompi_coll_tuned_barrier_intra_do_this (struct ompi_communicator_t *comm,
  89                                            mca_coll_base_module_t *module,
  90                                            int algorithm, int faninout, int segsize)
  91 {
  92     OPAL_OUTPUT((ompi_coll_tuned_stream,
  93                  "coll:tuned:barrier_intra_do_this selected algorithm %d topo fanin/out%d",
  94                  algorithm, faninout));
  95 
  96     switch (algorithm) {
  97     case (0):   return ompi_coll_tuned_barrier_intra_dec_fixed(comm, module);
  98     case (1):   return ompi_coll_base_barrier_intra_basic_linear(comm, module);
  99     case (2):   return ompi_coll_base_barrier_intra_doublering(comm, module);
 100     case (3):   return ompi_coll_base_barrier_intra_recursivedoubling(comm, module);
 101     case (4):   return ompi_coll_base_barrier_intra_bruck(comm, module);
 102     case (5):   return ompi_coll_base_barrier_intra_two_procs(comm, module);
 103     case (6):   return ompi_coll_base_barrier_intra_tree(comm, module);
 104     } /* switch */
 105     OPAL_OUTPUT((ompi_coll_tuned_stream,"coll:tuned:barrier_intra_do_this attempt to select algorithm %d when only 0-%d is valid?",
 106                  algorithm, ompi_coll_tuned_forced_max_algorithms[BARRIER]));
 107     return (MPI_ERR_ARG);
 108 }

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