root/ompi/mpi/tool/pvar_handle_alloc.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_T_pvar_handle_alloc

   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_handle_alloc = PMPI_T_pvar_handle_alloc
  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_handle_alloc(MPI_T_pvar_session session, int pvar_index,
  26                             void *obj_handle, MPI_T_pvar_handle *handle, int *count)
  27 {
  28     const mca_base_pvar_t *pvar;
  29     int ret;
  30 
  31     if (!mpit_is_initialized ()) {
  32         return MPI_T_ERR_NOT_INITIALIZED;
  33     }
  34 
  35     ompi_mpit_lock ();
  36 
  37     do {
  38         /* Find the performance variable. mca_base_pvar_get() handles the
  39            bounds checking. */
  40         ret = mca_base_pvar_get (pvar_index, &pvar);
  41         if (OMPI_SUCCESS != ret) {
  42             break;
  43         }
  44 
  45         /* Check the variable binding is something sane */
  46         if (pvar->bind > MPI_T_BIND_MPI_INFO || pvar->bind < MPI_T_BIND_NO_OBJECT) {
  47             /* This variable specified an invalid binding (not an MPI object). */
  48             ret = MPI_T_ERR_INVALID_INDEX;
  49             break;
  50         }
  51 
  52         ret = mca_base_pvar_handle_alloc (session, pvar_index, obj_handle,
  53                                           handle, count);
  54     } while (0);
  55 
  56     ompi_mpit_unlock ();
  57 
  58     return ompit_opal_to_mpit_error(ret);
  59 }

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