root/ompi/mpi/tool/cvar_get_info.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_T_cvar_get_info

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights
   4  *                         reserved.
   5  * Copyright (c) 2014 Cisco Systems, Inc.  All rights reserved.
   6  * Copyright (c) 2017      IBM Corporation. All rights reserved.
   7  * $COPYRIGHT$
   8  *
   9  * Additional copyrights may follow
  10  *
  11  * $HEADER$
  12  */
  13 
  14 #include "ompi/mpi/tool/mpit-internal.h"
  15 
  16 #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
  17 #pragma weak MPI_T_cvar_get_info = PMPI_T_cvar_get_info
  18 #endif
  19 
  20 #if OMPI_PROFILING_DEFINES
  21 #include "ompi/mpi/tool/profile/defines.h"
  22 #endif
  23 
  24 
  25 int MPI_T_cvar_get_info(int cvar_index, char *name, int *name_len, int *verbosity,
  26                         MPI_Datatype *datatype, MPI_T_enum *enumtype, char *desc,
  27                         int *desc_len, int *bind, int *scope)
  28 {
  29     const mca_base_var_t *var;
  30     int rc = MPI_SUCCESS;
  31 
  32     if (!mpit_is_initialized ()) {
  33         return MPI_T_ERR_NOT_INITIALIZED;
  34     }
  35 
  36     ompi_mpit_lock ();
  37 
  38     do {
  39         rc = mca_base_var_get (cvar_index, &var);
  40         if (OPAL_SUCCESS != rc) {
  41             rc = (OPAL_ERR_VALUE_OUT_OF_BOUNDS == rc || OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX :
  42                 MPI_ERR_OTHER;
  43             break;
  44         }
  45 
  46         mpit_copy_string (name, name_len, var->mbv_full_name);
  47         mpit_copy_string (desc, desc_len, var->mbv_description);
  48 
  49         /* find the corresponding mpi type for an mca type */
  50         rc = ompit_var_type_to_datatype (var->mbv_type, datatype);
  51         if (OMPI_SUCCESS != rc) {
  52             break;
  53         }
  54 
  55         if (NULL != enumtype) {
  56             *enumtype = var->mbv_enumerator ? (MPI_T_enum) var->mbv_enumerator : MPI_T_ENUM_NULL;
  57         }
  58 
  59         if (NULL != scope) {
  60             *scope = var->mbv_scope;
  61         }
  62 
  63         /* XXX -- TODO -- All bindings are currently 0. Add support for variable binding. */
  64         if (NULL != bind) {
  65             *bind = var->mbv_bind;
  66         }
  67 
  68         if (NULL != verbosity) {
  69             *verbosity = var->mbv_info_lvl;
  70         }
  71     } while (0);
  72 
  73     ompi_mpit_unlock ();
  74 
  75     return rc;
  76 }

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