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

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

DEFINITIONS

This source file includes following definitions.
  1. ompi_coll_tuned_alltoallv_intra_check_forced_init
  2. ompi_coll_tuned_alltoallv_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 "ompi/mca/pml/pml.h"
  24 #include "coll_tuned.h"
  25 #include "ompi/mca/coll/base/coll_base_topo.h"
  26 #include "ompi/mca/coll/base/coll_base_util.h"
  27 
  28 /* alltoallv algorithm variables */
  29 static int coll_tuned_alltoallv_forced_algorithm = 0;
  30 
  31 /* valid values for coll_tuned_alltoallv_forced_algorithm */
  32 static mca_base_var_enum_value_t alltoallv_algorithms[] = {
  33     {0, "ignore"},
  34     {1, "basic_linear"},
  35     {2, "pairwise"},
  36     {0, NULL}
  37 };
  38 
  39 /*
  40  * The following are used by dynamic and forced rules.  Publish
  41  * details of each algorithm and if its forced/fixed/locked in as you add
  42  * methods/algorithms you must update this and the query/map routines.
  43  * This routine is called by the component only.  This makes sure that
  44  * the mca parameters are set to their initial values and perms.
  45  * Module does not call this.  They call the forced_getvalues routine
  46  * instead.
  47  */
  48 int ompi_coll_tuned_alltoallv_intra_check_forced_init(coll_tuned_force_algorithm_mca_param_indices_t
  49                                                       *mca_param_indices)
  50 {
  51     mca_base_var_enum_t *new_enum;
  52     int cnt;
  53 
  54     for( cnt = 0; NULL != alltoallv_algorithms[cnt].string; cnt++ );
  55     ompi_coll_tuned_forced_max_algorithms[ALLTOALLV] = cnt;
  56 
  57     (void) mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
  58                                            "alltoallv_algorithm_count",
  59                                            "Number of alltoallv algorithms available",
  60                                            MCA_BASE_VAR_TYPE_INT, NULL, 0,
  61                                            MCA_BASE_VAR_FLAG_DEFAULT_ONLY,
  62                                            OPAL_INFO_LVL_5,
  63                                            MCA_BASE_VAR_SCOPE_CONSTANT,
  64                                            &ompi_coll_tuned_forced_max_algorithms[ALLTOALLV]);
  65 
  66     /* MPI_T: This variable should eventually be bound to a communicator */
  67     coll_tuned_alltoallv_forced_algorithm = 0;
  68     (void) mca_base_var_enum_create("coll_tuned_alltoallv_algorithms", alltoallv_algorithms, &new_enum);
  69     mca_param_indices->algorithm_param_index =
  70         mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
  71                                         "alltoallv_algorithm",
  72                                         "Which alltoallv algorithm is used. "
  73                                         "Can be locked down to choice of: 0 ignore, "
  74                                         "1 basic linear, 2 pairwise.",
  75                                         MCA_BASE_VAR_TYPE_INT, new_enum, 0, MCA_BASE_VAR_FLAG_SETTABLE,
  76                                         OPAL_INFO_LVL_5,
  77                                         MCA_BASE_VAR_SCOPE_ALL,
  78                                         &coll_tuned_alltoallv_forced_algorithm);
  79 
  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 /* If the user selects dynamic rules and specifies the algorithm to
  89  * use, then this function is called.  */
  90 int ompi_coll_tuned_alltoallv_intra_do_this(const void *sbuf, const int *scounts, const int *sdisps,
  91                                             struct ompi_datatype_t *sdtype,
  92                                             void* rbuf, const int *rcounts, const int *rdisps,
  93                                             struct ompi_datatype_t *rdtype,
  94                                             struct ompi_communicator_t *comm,
  95                                             mca_coll_base_module_t *module,
  96                                             int algorithm)
  97 {
  98     OPAL_OUTPUT((ompi_coll_tuned_stream,
  99                  "coll:tuned:alltoallv_intra_do_this selected algorithm %d ",
 100                  algorithm));
 101 
 102     switch (algorithm) {
 103     case (0):
 104         return ompi_coll_tuned_alltoallv_intra_dec_fixed(sbuf, scounts, sdisps, sdtype,
 105                                                          rbuf, rcounts, rdisps, rdtype,
 106                                                          comm, module);
 107     case (1):
 108         return ompi_coll_base_alltoallv_intra_basic_linear(sbuf, scounts, sdisps, sdtype,
 109                                                            rbuf, rcounts, rdisps, rdtype,
 110                                                            comm, module);
 111     case (2):
 112         return ompi_coll_base_alltoallv_intra_pairwise(sbuf, scounts, sdisps, sdtype,
 113                                                        rbuf, rcounts, rdisps, rdtype,
 114                                                        comm, module);
 115     }  /* switch */
 116     OPAL_OUTPUT((ompi_coll_tuned_stream,
 117                  "coll:tuned:alltoall_intra_do_this attempt to select "
 118                  "algorithm %d when only 0-%d is valid.",
 119                  algorithm, ompi_coll_tuned_forced_max_algorithms[ALLTOALLV]));
 120     return (MPI_ERR_ARG);
 121 }

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