Blame src/mpi_t/cvar_get_info.c

Packit Service c5cf8c
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
Packit Service c5cf8c
/*
Packit Service c5cf8c
 *  (C) 2011 by Argonne National Laboratory.
Packit Service c5cf8c
 *      See COPYRIGHT in top-level directory.
Packit Service c5cf8c
 */
Packit Service c5cf8c
Packit Service c5cf8c
#include "mpiimpl.h"
Packit Service c5cf8c
Packit Service c5cf8c
/* -- Begin Profiling Symbol Block for routine MPI_T_cvar_get_info */
Packit Service c5cf8c
#if defined(HAVE_PRAGMA_WEAK)
Packit Service c5cf8c
#pragma weak MPI_T_cvar_get_info = PMPI_T_cvar_get_info
Packit Service c5cf8c
#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
Packit Service c5cf8c
#pragma _HP_SECONDARY_DEF PMPI_T_cvar_get_info  MPI_T_cvar_get_info
Packit Service c5cf8c
#elif defined(HAVE_PRAGMA_CRI_DUP)
Packit Service c5cf8c
#pragma _CRI duplicate MPI_T_cvar_get_info as PMPI_T_cvar_get_info
Packit Service c5cf8c
#elif defined(HAVE_WEAK_ATTRIBUTE)
Packit Service c5cf8c
int MPI_T_cvar_get_info(int cvar_index, char *name, int *name_len, int *verbosity,
Packit Service c5cf8c
                        MPI_Datatype * datatype, MPI_T_enum * enumtype, char *desc, int *desc_len,
Packit Service c5cf8c
                        int *binding, int *scope)
Packit Service c5cf8c
    __attribute__ ((weak, alias("PMPI_T_cvar_get_info")));
Packit Service c5cf8c
#endif
Packit Service c5cf8c
/* -- End Profiling Symbol Block */
Packit Service c5cf8c
Packit Service c5cf8c
/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
Packit Service c5cf8c
   the MPI routines */
Packit Service c5cf8c
#ifndef MPICH_MPI_FROM_PMPI
Packit Service c5cf8c
#undef MPI_T_cvar_get_info
Packit Service c5cf8c
#define MPI_T_cvar_get_info PMPI_T_cvar_get_info
Packit Service c5cf8c
#endif /* MPICH_MPI_FROM_PMPI */
Packit Service c5cf8c
Packit Service c5cf8c
#undef FUNCNAME
Packit Service c5cf8c
#define FUNCNAME MPI_T_cvar_get_info
Packit Service c5cf8c
#undef FCNAME
Packit Service c5cf8c
#define FCNAME MPL_QUOTE(FUNCNAME)
Packit Service c5cf8c
/*@
Packit Service c5cf8c
MPI_T_cvar_get_info - Get the information about a control variable
Packit Service c5cf8c
Packit Service c5cf8c
Input/Output Parameters:
Packit Service c5cf8c
+ name_len - length of the string and/or buffer for name (integer)
Packit Service c5cf8c
- desc_len - length of the string and/or buffer for desc (integer)
Packit Service c5cf8c
Packit Service c5cf8c
Input Parameters:
Packit Service c5cf8c
. cvar_index - index of the control variable to be queried, value between 0 and num_cvar-1 (integer)
Packit Service c5cf8c
Packit Service c5cf8c
Output Parameters:
Packit Service c5cf8c
+ name - buffer to return the string containing the name of the control variable (string)
Packit Service c5cf8c
. verbosity - verbosity level of this variable (integer)
Packit Service c5cf8c
. datatype - MPI datatype of the information stored in the control variable (handle)
Packit Service c5cf8c
. enumtype - optional descriptor for enumeration information (handle)
Packit Service c5cf8c
. desc - buffer to return the string containing a description of the control variable (string)
Packit Service c5cf8c
. binding - type of MPI object this variable is associated with
Packit Service c5cf8c
- scope - scope of when changes to this variable are possible (integer)
Packit Service c5cf8c
Packit Service c5cf8c
.N ThreadSafe
Packit Service c5cf8c
Packit Service c5cf8c
.N Errors
Packit Service c5cf8c
.N MPI_SUCCESS
Packit Service c5cf8c
.N MPI_T_ERR_NOT_INITIALIZED
Packit Service c5cf8c
.N MPI_T_ERR_INVALID_INDEX
Packit Service c5cf8c
@*/
Packit Service c5cf8c
int MPI_T_cvar_get_info(int cvar_index, char *name, int *name_len,
Packit Service c5cf8c
                        int *verbosity, MPI_Datatype * datatype, MPI_T_enum * enumtype,
Packit Service c5cf8c
                        char *desc, int *desc_len, int *binding, int *scope)
Packit Service c5cf8c
{
Packit Service c5cf8c
    int mpi_errno = MPI_SUCCESS;
Packit Service c5cf8c
    const cvar_table_entry_t *cvar;
Packit Service c5cf8c
Packit Service c5cf8c
    MPIR_FUNC_TERSE_STATE_DECL(MPID_STATE_MPI_T_CVAR_GET_INFO);
Packit Service c5cf8c
    MPIR_ERRTEST_MPIT_INITIALIZED(mpi_errno);
Packit Service c5cf8c
    MPIR_T_THREAD_CS_ENTER();
Packit Service c5cf8c
    MPIR_FUNC_TERSE_ENTER(MPID_STATE_MPI_T_CVAR_GET_INFO);
Packit Service c5cf8c
Packit Service c5cf8c
    /* Validate parameters */
Packit Service c5cf8c
#ifdef HAVE_ERROR_CHECKING
Packit Service c5cf8c
    {
Packit Service c5cf8c
        MPID_BEGIN_ERROR_CHECKS;
Packit Service c5cf8c
        {
Packit Service c5cf8c
            MPIR_ERRTEST_CVAR_INDEX(cvar_index, mpi_errno);
Packit Service c5cf8c
            /* Do not do *_TEST_ARGNULL for pointer arguments, since this is
Packit Service c5cf8c
             * allowed or will be allowed by MPI_T standard.
Packit Service c5cf8c
             */
Packit Service c5cf8c
        }
Packit Service c5cf8c
        MPID_END_ERROR_CHECKS;
Packit Service c5cf8c
    }
Packit Service c5cf8c
#endif /* HAVE_ERROR_CHECKING */
Packit Service c5cf8c
Packit Service c5cf8c
    /* ... body of routine ...  */
Packit Service c5cf8c
Packit Service c5cf8c
    cvar = (cvar_table_entry_t *) utarray_eltptr(cvar_table, cvar_index);
Packit Service c5cf8c
Packit Service c5cf8c
    MPIR_T_strncpy(name, cvar->name, name_len);
Packit Service c5cf8c
    MPIR_T_strncpy(desc, cvar->desc, desc_len);
Packit Service c5cf8c
Packit Service c5cf8c
    if (verbosity != NULL)
Packit Service c5cf8c
        *verbosity = cvar->verbosity;
Packit Service c5cf8c
Packit Service c5cf8c
    if (datatype != NULL)
Packit Service c5cf8c
        *datatype = cvar->datatype;
Packit Service c5cf8c
Packit Service c5cf8c
    if (enumtype != NULL)
Packit Service c5cf8c
        *enumtype = cvar->enumtype;
Packit Service c5cf8c
Packit Service c5cf8c
    if (binding != NULL)
Packit Service c5cf8c
        *binding = cvar->bind;
Packit Service c5cf8c
Packit Service c5cf8c
    if (scope != NULL)
Packit Service c5cf8c
        *scope = cvar->scope;
Packit Service c5cf8c
    /* ... end of body of routine ... */
Packit Service c5cf8c
Packit Service c5cf8c
#ifdef HAVE_ERROR_CHECKING
Packit Service c5cf8c
  fn_exit:
Packit Service c5cf8c
#endif
Packit Service c5cf8c
    MPIR_FUNC_TERSE_EXIT(MPID_STATE_MPI_T_CVAR_GET_INFO);
Packit Service c5cf8c
    MPIR_T_THREAD_CS_EXIT();
Packit Service c5cf8c
    return mpi_errno;
Packit Service c5cf8c
Packit Service c5cf8c
#ifdef HAVE_ERROR_CHECKING
Packit Service c5cf8c
  fn_fail:
Packit Service c5cf8c
    /* --BEGIN ERROR HANDLING-- */
Packit Service c5cf8c
    {
Packit Service c5cf8c
        mpi_errno =
Packit Service c5cf8c
            MPIR_Err_create_code(mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER,
Packit Service c5cf8c
                                 "**mpi_t_cvar_get_info",
Packit Service c5cf8c
                                 "**mpi_t_cvar_get_info %d %p %p %p %p %p %p %p %p %p", cvar_index,
Packit Service c5cf8c
                                 name, name_len, verbosity, datatype, enumtype, desc, desc_len,
Packit Service c5cf8c
                                 binding, scope);
Packit Service c5cf8c
    }
Packit Service c5cf8c
    mpi_errno = MPIR_Err_return_comm(NULL, FCNAME, mpi_errno);
Packit Service c5cf8c
    goto fn_exit;
Packit Service c5cf8c
    /* --END ERROR HANDLING-- */
Packit Service c5cf8c
#endif
Packit Service c5cf8c
}