root/ompi/mpi/tool/pvar_get_info.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_T_pvar_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_pvar_get_info = PMPI_T_pvar_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_pvar_get_info(int pvar_index, char *name, int *name_len,
  26                         int *verbosity, int *var_class, MPI_Datatype *datatype,
  27                         MPI_T_enum *enumtype, char *desc, int *desc_len, int *bind,
  28                         int *readonly, int *continuous, int *atomic)
  29 {
  30     const mca_base_pvar_t *pvar;
  31     int ret;
  32 
  33     if (!mpit_is_initialized ()) {
  34         return MPI_T_ERR_NOT_INITIALIZED;
  35     }
  36 
  37     ompi_mpit_lock ();
  38 
  39     do {
  40         /* Find the performance variable. mca_base_pvar_get() handles the
  41            bounds checking. */
  42         ret = mca_base_pvar_get (pvar_index, &pvar);
  43         if (OMPI_SUCCESS != ret) {
  44             break;
  45         }
  46 
  47         /* Check the variable binding is something sane */
  48         if (pvar->bind > MPI_T_BIND_MPI_INFO || pvar->bind < MPI_T_BIND_NO_OBJECT) {
  49             /* This variable specified an invalid binding (not an MPI object). */
  50             ret = MPI_T_ERR_INVALID_INDEX;
  51             break;
  52         }
  53 
  54         /* Copy name an description */
  55         mpit_copy_string (name, name_len, pvar->name);
  56         mpit_copy_string (desc, desc_len, pvar->description);
  57 
  58         if (verbosity) {
  59             *verbosity = pvar->verbosity;
  60         }
  61 
  62         if (var_class) {
  63             *var_class = pvar->var_class;
  64         }
  65 
  66         ret = ompit_var_type_to_datatype (pvar->type, datatype);
  67         if (OMPI_SUCCESS != ret) {
  68             break;
  69         }
  70 
  71         if (NULL != enumtype) {
  72             *enumtype = pvar->enumerator ? (MPI_T_enum) pvar->enumerator : MPI_T_ENUM_NULL;
  73         }
  74 
  75         if (NULL != bind) {
  76             *bind = pvar->bind;
  77         }
  78 
  79         if (NULL != readonly) {
  80             *readonly = mca_base_pvar_is_readonly (pvar);
  81         }
  82 
  83         if (NULL != continuous) {
  84             *continuous = mca_base_pvar_is_continuous (pvar);
  85         }
  86 
  87         if (NULL != atomic) {
  88             *atomic = mca_base_pvar_is_atomic (pvar);
  89         }
  90     } while (0);
  91 
  92     ompi_mpit_unlock ();
  93 
  94     return ret;
  95 }

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