cf377db823
Features: - Support for an override parameter file (openmpi-mca-param-override.conf). Variable values in this file can not be overridden by any file or environment value. - Support for boolean, unsigned, and unsigned long long variables. - Support for true/false values. - Support for enumerations on integer variables. - Support for MPIT scope, verbosity, and binding. - Support for command line source. - Support for setting variable source via the environment using OMPI_MCA_SOURCE_<var name>=source (either command or file:filename) - Cleaner API. - Support for variable groups (equivalent to MPIT categories). Notes: - Variables must be created with a backing store (char **, int *, or bool *) that must live at least as long as the variable. - Creating a variable with the MCA_BASE_VAR_FLAG_SETTABLE enables the use of mca_base_var_set_value() to change the value. - String values are duplicated when the variable is registered. It is up to the caller to free the original value if necessary. The new value will be freed by the mca_base_var system and must not be freed by the user. - Variables with constant scope may not be settable. - Variable groups (and all associated variables) are deregistered when the component is closed or the component repository item is freed. This prevents a segmentation fault from accessing a variable after its component is unloaded. - After some discussion we decided we should remove the automatic registration of component priority variables. Few component actually made use of this feature. - The enumerator interface was updated to be general enough to handle future uses of the interface. - The code to generate ompi_info output has been moved into the MCA variable system. See mca_base_var_dump(). opal: update core and components to mca_base_var system orte: update core and components to mca_base_var system ompi: update core and components to mca_base_var system This commit also modifies the rmaps framework. The following variables were moved from ppr and lama: rmaps_base_pernode, rmaps_base_n_pernode, rmaps_base_n_persocket. Both lama and ppr create synonyms for these variables. This commit was SVN r28236.
208 строки
4.5 KiB
C
208 строки
4.5 KiB
C
/*
|
|
* Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
|
|
* University of Stuttgart. All rights reserved.
|
|
* Copyright (c) 2004-2008 The Trustees of Indiana University.
|
|
* All rights reserved.
|
|
* $COPYRIGHT$
|
|
*
|
|
* Additional copyrights may follow
|
|
*
|
|
* $HEADER$
|
|
*/
|
|
|
|
/**
|
|
* @file
|
|
*
|
|
* memchecker (memory checker) valgrind framework component interface.
|
|
*
|
|
* Intent
|
|
*/
|
|
|
|
#include "opal_config.h"
|
|
|
|
#include "opal/constants.h"
|
|
#include "opal/mca/base/mca_base_var.h"
|
|
#include "opal/mca/memchecker/memchecker.h"
|
|
#include "opal/mca/memchecker/base/base.h"
|
|
#include "memchecker_valgrind.h"
|
|
#include "valgrind/valgrind.h"
|
|
#include "valgrind/memcheck.h"
|
|
|
|
|
|
/*
|
|
* Local functions
|
|
*/
|
|
static int valgrind_module_init(void);
|
|
static int valgrind_module_runindebugger(void);
|
|
static int valgrind_module_isaddressable(void * p, size_t len);
|
|
static int valgrind_module_isdefined(void * p, size_t len);
|
|
static int valgrind_module_mem_noaccess(void * p, size_t len);
|
|
static int valgrind_module_mem_undefined(void * p, size_t len);
|
|
static int valgrind_module_mem_defined(void * p, size_t len);
|
|
static int valgrind_module_mem_defined_if_addressable(void * p, size_t len);
|
|
static int valgrind_module_create_block(void * p, size_t len, char * description);
|
|
static int valgrind_module_discard_block(void * p); /* Here, we need to do some mapping for valgrind */
|
|
static int valgrind_module_leakcheck(void);
|
|
#if 0
|
|
static int valgrind_module_get_vbits(void * p, char * vbits, size_t len);
|
|
static int valgrind_module_set_vbits(void * p, char * vbits, size_t len);
|
|
#endif
|
|
|
|
extern int opal_memchecker_component_priority;
|
|
|
|
/*
|
|
* Valgrind memchecker module
|
|
*/
|
|
static const opal_memchecker_base_module_1_0_0_t loc_module = {
|
|
/* Initialization function */
|
|
valgrind_module_init,
|
|
|
|
/* Module function pointers */
|
|
valgrind_module_runindebugger,
|
|
valgrind_module_isaddressable,
|
|
valgrind_module_isdefined,
|
|
valgrind_module_mem_noaccess,
|
|
valgrind_module_mem_undefined,
|
|
valgrind_module_mem_defined,
|
|
valgrind_module_mem_defined_if_addressable,
|
|
valgrind_module_create_block,
|
|
valgrind_module_discard_block,
|
|
valgrind_module_leakcheck
|
|
};
|
|
|
|
|
|
int opal_memchecker_valgrind_component_query(mca_base_module_t **module, int *priority)
|
|
{
|
|
*priority = opal_memchecker_component_priority;
|
|
|
|
*module = (mca_base_module_t *)&loc_module;
|
|
|
|
return OPAL_SUCCESS;
|
|
}
|
|
|
|
|
|
static int valgrind_module_init(void)
|
|
{
|
|
/* Nothing to do yet, possibly update the amount of memory blocks. */
|
|
|
|
return OPAL_SUCCESS;
|
|
}
|
|
|
|
|
|
static int valgrind_module_runindebugger(void)
|
|
{
|
|
return RUNNING_ON_VALGRIND;
|
|
}
|
|
|
|
|
|
static int valgrind_module_isaddressable(void * p, size_t len)
|
|
{
|
|
if (len > 0) {
|
|
VALGRIND_CHECK_MEM_IS_ADDRESSABLE(p, len);
|
|
}
|
|
|
|
return OPAL_SUCCESS;
|
|
}
|
|
|
|
|
|
static int valgrind_module_isdefined(void * p, size_t len)
|
|
{
|
|
if (len > 0) {
|
|
VALGRIND_CHECK_MEM_IS_DEFINED(p, len);
|
|
}
|
|
|
|
return OPAL_SUCCESS;
|
|
}
|
|
|
|
|
|
static int valgrind_module_mem_noaccess(void * p, size_t len)
|
|
{
|
|
if (len > 0) {
|
|
VALGRIND_MAKE_MEM_NOACCESS(p, len);
|
|
}
|
|
|
|
return OPAL_SUCCESS;
|
|
}
|
|
|
|
|
|
static int valgrind_module_mem_undefined(void * p, size_t len)
|
|
{
|
|
if (len > 0) {
|
|
VALGRIND_MAKE_MEM_UNDEFINED(p, len);
|
|
}
|
|
|
|
return OPAL_SUCCESS;
|
|
}
|
|
|
|
|
|
static int valgrind_module_mem_defined(void * p, size_t len)
|
|
{
|
|
if (len > 0) {
|
|
VALGRIND_MAKE_MEM_DEFINED(p, len);
|
|
}
|
|
|
|
return OPAL_SUCCESS;
|
|
}
|
|
|
|
|
|
static int valgrind_module_mem_defined_if_addressable(void * p, size_t len)
|
|
{
|
|
if (len > 0) {
|
|
VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(p, len);
|
|
}
|
|
|
|
return OPAL_SUCCESS;
|
|
}
|
|
|
|
|
|
static int valgrind_module_create_block(void * p, size_t len, char * description)
|
|
{
|
|
if (len > 0) {
|
|
VALGRIND_CREATE_BLOCK (p, len, description);
|
|
/*
|
|
* Add p to some list atomically
|
|
*/
|
|
}
|
|
return OPAL_SUCCESS;
|
|
}
|
|
|
|
|
|
static int valgrind_module_discard_block(void * p)
|
|
{
|
|
/* Here, we need to do some mapping for valgrind */
|
|
/*
|
|
* If p in list, then get rid of name
|
|
*/
|
|
return OPAL_SUCCESS;
|
|
}
|
|
|
|
|
|
static int valgrind_module_leakcheck(void)
|
|
{
|
|
VALGRIND_DO_LEAK_CHECK;
|
|
return OPAL_SUCCESS;
|
|
}
|
|
|
|
|
|
#if 0
|
|
static int valgrind_module_get_vbits(void * p, char * vbits, size_t len)
|
|
{
|
|
if (len > 0) {
|
|
VALGRIND_GET_VBITS(p, vbits, len);
|
|
}
|
|
|
|
return OPAL_SUCCESS;
|
|
}
|
|
|
|
|
|
static int valgrind_module_set_vbits(void * p, char * vbits, size_t len)
|
|
{
|
|
if (len > 0) {
|
|
VALGRIND_SET_VBITS(p, vbits, len);
|
|
}
|
|
|
|
return OPAL_SUCCESS;
|
|
}
|
|
#endif
|
|
|