root/opal/mca/btl/base/btl_base_mca.c

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

DEFINITIONS

This source file includes following definitions.
  1. mca_btl_base_param_register
  2. mca_btl_base_param_verify

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2005 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2005 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2006-2007 Voltaire All rights reserved.
  14  * Copyright (c) 2007      Cisco Systems, Inc.  All rights reserved.
  15  * Copyright (c) 2010      Oracle and/or its affiliates.  All rights reserved.
  16  * Copyright (c) 2013      NVIDIA Corporation.  All rights reserved.
  17  * Copyright (c) 2016-2018 Los Alamos National Security, LLC. All rights
  18  *                         reserved.
  19  *
  20  * $COPYRIGHT$
  21  *
  22  * Additional copyrights may follow
  23  *
  24  * $HEADER$
  25  */
  26 
  27 #include "opal_config.h"
  28 
  29 #include <stdio.h>
  30 
  31 #include "opal/util/output.h"
  32 #include "opal/constants.h"
  33 #include "opal/mca/btl/btl.h"
  34 #include "opal/mca/btl/base/base.h"
  35 
  36 int mca_btl_base_param_register(mca_base_component_t *version,
  37                                 mca_btl_base_module_t *module)
  38 {
  39     /* If this is ever triggered change the uint32_ts in mca_btl_base_module_t to unsigned ints */
  40     assert(sizeof(unsigned int) == sizeof(uint32_t));
  41 
  42     (void) mca_base_component_var_register(version, "exclusivity",
  43                                            "BTL exclusivity (must be >= 0)",
  44                                            MCA_BASE_VAR_TYPE_UNSIGNED_INT, NULL, 0, 0,
  45                                            OPAL_INFO_LVL_7,
  46                                            MCA_BASE_VAR_SCOPE_READONLY,
  47                                            &module->btl_exclusivity);
  48 
  49     (void) mca_base_component_var_register(version, "flags", "BTL bit flags (general flags: send, put, get, in-place, hetero-rdma, "
  50                                            "atomics, fetching-atomics)", MCA_BASE_VAR_TYPE_UNSIGNED_INT,
  51                                            &mca_btl_base_flag_enum->super, 0, 0, OPAL_INFO_LVL_5,
  52                                            MCA_BASE_VAR_SCOPE_READONLY, &module->btl_flags);
  53 
  54     (void) mca_base_component_var_register(version, "atomic_flags", "BTL atomic support flags", MCA_BASE_VAR_TYPE_UNSIGNED_INT,
  55                                            &mca_btl_base_atomic_enum->super, 0, MCA_BASE_VAR_FLAG_DEFAULT_ONLY, OPAL_INFO_LVL_5,
  56                                            MCA_BASE_VAR_SCOPE_CONSTANT, &module->btl_atomic_flags);
  57 
  58     (void) mca_base_component_var_register(version, "rndv_eager_limit", "Size (in bytes, including header) of \"phase 1\" fragment sent for all large messages (must be >= 0 and <= eager_limit)",
  59                                            MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0,
  60                                            OPAL_INFO_LVL_4,
  61                                            MCA_BASE_VAR_SCOPE_READONLY,
  62                                            &module->btl_rndv_eager_limit);
  63 
  64     (void) mca_base_component_var_register(version, "eager_limit", "Maximum size (in bytes, including header) of \"short\" messages (must be >= 1).",
  65                                            MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0,
  66                                            OPAL_INFO_LVL_4,
  67                                            MCA_BASE_VAR_SCOPE_READONLY,
  68                                            &module->btl_eager_limit);
  69 
  70     if ((module->btl_flags & MCA_BTL_FLAGS_GET) && module->btl_get) {
  71         if (0 == module->btl_get_limit) {
  72             module->btl_get_limit = SIZE_MAX;
  73         }
  74 
  75         (void) mca_base_component_var_register(version, "get_limit", "Maximum size (in bytes) for btl get",
  76                                                MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0, OPAL_INFO_LVL_4,
  77                                                MCA_BASE_VAR_SCOPE_READONLY, &module->btl_get_limit);
  78 
  79         /* Allow the user to set the alignment. The BTL should double-check the alignment in its open
  80          * function. */
  81         (void) mca_base_component_var_register(version, "get_alignment", "Alignment required for btl get",
  82                                                MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0, OPAL_INFO_LVL_6,
  83                                                MCA_BASE_VAR_SCOPE_CONSTANT, &module->btl_get_alignment);
  84     }
  85 
  86     if ((module->btl_flags & MCA_BTL_FLAGS_PUT) && module->btl_put) {
  87         if (0 == module->btl_put_limit) {
  88             module->btl_put_limit = SIZE_MAX;
  89         }
  90         (void) mca_base_component_var_register(version, "put_limit", "Maximum size (in bytes) for btl put",
  91                                                MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0, OPAL_INFO_LVL_4,
  92                                                MCA_BASE_VAR_SCOPE_READONLY, &module->btl_put_limit);
  93 
  94         /* Allow the user to set the alignment. The BTL should double-check the alignment in its open
  95          * function. */
  96         (void) mca_base_component_var_register(version, "put_alignment", "Alignment required for btl put",
  97                                                MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0, OPAL_INFO_LVL_6,
  98                                                MCA_BASE_VAR_SCOPE_CONSTANT, &module->btl_put_alignment);
  99     }
 100 
 101 
 102 #if OPAL_CUDA_GDR_SUPPORT
 103     /* If no CUDA RDMA support, zero them out */
 104     if (!(MCA_BTL_FLAGS_CUDA_GET & module->btl_flags)) {
 105         module->btl_cuda_eager_limit = 0;
 106         module->btl_cuda_rdma_limit = SIZE_MAX;
 107     }
 108     (void) mca_base_component_var_register(version, "cuda_eager_limit", "Maximum size (in bytes, including header) of \"GPU short\" messages (must be >= 1).",
 109                                            MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0,
 110                                            OPAL_INFO_LVL_5,
 111                                            MCA_BASE_VAR_SCOPE_READONLY,
 112                                            &module->btl_cuda_eager_limit);
 113     (void) mca_base_component_var_register(version, "cuda_rdma_limit", "Size (in bytes, including header) of GPU buffer when switch to rndv protocol and pipeline.",
 114                                            MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0,
 115                                            OPAL_INFO_LVL_5,
 116                                            MCA_BASE_VAR_SCOPE_READONLY,
 117                                            &module->btl_cuda_rdma_limit);
 118 #endif /* OPAL_CUDA_GDR_SUPPORT */
 119 #if OPAL_CUDA_SUPPORT
 120     module->btl_cuda_max_send_size = 0;
 121     (void) mca_base_component_var_register(version, "cuda_max_send_size", "Maximum size (in bytes) of a single GPU \"phase 2\" fragment of a long message when using the pipeline protocol (must be >= 1) (only valid on smcuda btl)",
 122                                            MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0,
 123                                            OPAL_INFO_LVL_4,
 124                                            MCA_BASE_VAR_SCOPE_READONLY,
 125                                            &module->btl_cuda_max_send_size);
 126 #endif /* OPAL_CUDA_SUPPORT */
 127 
 128     (void) mca_base_component_var_register(version, "max_send_size", "Maximum size (in bytes) of a single \"phase 2\" fragment of a long message when using the pipeline protocol (must be >= 1)",
 129                                            MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0,
 130                                            OPAL_INFO_LVL_4,
 131                                            MCA_BASE_VAR_SCOPE_READONLY,
 132                                            &module->btl_max_send_size);
 133 
 134     if (NULL != module->btl_put) {
 135       (void) mca_base_component_var_register(version, "rdma_pipeline_send_length", "Length of the \"phase 2\" portion of a large message (in bytes) when using the pipeline protocol.  This part of the message will be split into fragments of size max_send_size and sent using send/receive semantics (must be >= 0; only relevant when the PUT flag is set)",
 136                                              MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0,
 137                                              OPAL_INFO_LVL_4,
 138                                              MCA_BASE_VAR_SCOPE_READONLY,
 139                                              &module->btl_rdma_pipeline_send_length);
 140 
 141       (void) mca_base_component_var_register(version, "rdma_pipeline_frag_size", "Maximum size (in bytes) of a single \"phase 3\" fragment from a long message when using the pipeline protocol.  These fragments will be sent using RDMA semantics (must be >= 1; only relevant when the PUT flag is set)",
 142                                              MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0,
 143                                              OPAL_INFO_LVL_4,
 144                                              MCA_BASE_VAR_SCOPE_READONLY,
 145                                              &module->btl_rdma_pipeline_frag_size);
 146 
 147       (void) mca_base_component_var_register(version, "min_rdma_pipeline_size", "Messages smaller than this size (in bytes) will not use the RDMA pipeline protocol.  Instead, they will be split into fragments of max_send_size and sent using send/receive semantics (must be >=0, and is automatically adjusted up to at least (eager_limit+btl_rdma_pipeline_send_length); only relevant when the PUT flag is set)",
 148                                              MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0,
 149                                              OPAL_INFO_LVL_4,
 150                                              MCA_BASE_VAR_SCOPE_READONLY,
 151                                              &module->btl_min_rdma_pipeline_size);
 152 
 153       (void) mca_base_component_var_register(version, "latency", "Approximate latency of interconnect (0 = auto-detect value at run-time [not supported in all BTL modules], >= 1 = latency in microseconds)",
 154                                              MCA_BASE_VAR_TYPE_UNSIGNED_INT, NULL, 0, 0,
 155                                              OPAL_INFO_LVL_5,
 156                                              MCA_BASE_VAR_SCOPE_READONLY,
 157                                              &module->btl_latency);
 158       (void) mca_base_component_var_register(version, "bandwidth", "Approximate maximum bandwidth of interconnect (0 = auto-detect value at run-time [not supported in all BTL modules], >= 1 = bandwidth in Mbps)",
 159                                              MCA_BASE_VAR_TYPE_UNSIGNED_INT, NULL, 0, 0,
 160                                              OPAL_INFO_LVL_5,
 161                                              MCA_BASE_VAR_SCOPE_READONLY,
 162                                              &module->btl_bandwidth);
 163     }
 164 
 165     return mca_btl_base_param_verify(module);
 166 }
 167 
 168 /* Verify btl parameters make sense */
 169 int mca_btl_base_param_verify(mca_btl_base_module_t *module)
 170 {
 171     if (module->btl_min_rdma_pipeline_size <
 172         (module->btl_eager_limit + module->btl_rdma_pipeline_send_length)) {
 173         module->btl_min_rdma_pipeline_size =
 174             module->btl_eager_limit + module->btl_rdma_pipeline_send_length;
 175     }
 176 
 177     if (NULL == module->btl_put) {
 178         module->btl_flags &= ~MCA_BTL_FLAGS_PUT;
 179     }
 180 
 181     if (NULL == module->btl_get) {
 182         module->btl_flags &= ~MCA_BTL_FLAGS_GET;
 183     }
 184 
 185     if (NULL == module->btl_flush) {
 186         module->btl_flags &= ~MCA_BTL_FLAGS_RDMA_FLUSH;
 187     }
 188 
 189     if (0 == module->btl_atomic_flags) {
 190         module->btl_flags &= ~MCA_BTL_FLAGS_ATOMIC_OPS;
 191     }
 192 
 193     if (0 == module->btl_get_limit) {
 194         module->btl_get_limit = SIZE_MAX;
 195     }
 196 
 197     if (0 == module->btl_put_limit) {
 198         module->btl_put_limit = SIZE_MAX;
 199     }
 200 
 201     return OPAL_SUCCESS;
 202 }

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