Fix a few memory leaks, and ensure that coll sm is also registering
the common SM MCA params. This commit was SVN r24497.
Этот коммит содержится в:
родитель
324b90142f
Коммит
ec90a3ba6d
@ -288,6 +288,9 @@ static int mca_btl_sm_component_close(void)
|
||||
/*OBJ_DESTRUCT(&mca_btl_sm_component.sm_frags_eager);*/
|
||||
/*OBJ_DESTRUCT(&mca_btl_sm_component.sm_frags_max);*/
|
||||
|
||||
/* Free resources associated with common sm MCA params */
|
||||
mca_common_sm_param_unregister(&mca_btl_sm_component.super.btl_version);
|
||||
|
||||
/* unmap the shared memory control structure */
|
||||
if(mca_btl_sm_component.sm_seg != NULL) {
|
||||
return_value = mca_common_sm_fini( mca_btl_sm_component.sm_seg );
|
||||
|
@ -41,6 +41,7 @@ const char *mca_coll_sm_component_version_string =
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
static int sm_close(void);
|
||||
static int sm_register(void);
|
||||
|
||||
|
||||
@ -68,7 +69,7 @@ mca_coll_sm_component_t mca_coll_sm_component = {
|
||||
|
||||
/* Component functions */
|
||||
NULL, /* open */
|
||||
NULL, /* close */
|
||||
sm_close,
|
||||
NULL, /* query */
|
||||
sm_register
|
||||
},
|
||||
@ -116,6 +117,20 @@ mca_coll_sm_component_t mca_coll_sm_component = {
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Shut down the component
|
||||
*/
|
||||
static int sm_close(void)
|
||||
{
|
||||
mca_base_component_t *c = &mca_coll_sm_component.super.collm_version;
|
||||
|
||||
/* Common SM MCA params */
|
||||
mca_common_sm_param_unregister(c);
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Register MCA params
|
||||
*/
|
||||
@ -210,5 +225,8 @@ static int sm_register(void)
|
||||
false, true,
|
||||
(int)size, NULL);
|
||||
|
||||
/* Common SM MCA params */
|
||||
mca_common_sm_param_register(c);
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
@ -61,6 +61,7 @@
|
||||
*/
|
||||
|
||||
static bool initialized = false;
|
||||
static int num_times_registered = 0;
|
||||
static int sysv_index = -1;
|
||||
static int posix_index = -1;
|
||||
static int common_sm_index = -1;
|
||||
@ -318,6 +319,14 @@ query_sm_components(void)
|
||||
int
|
||||
mca_common_sm_param_register(mca_base_component_t *c)
|
||||
{
|
||||
if (++num_times_registered > 1) {
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
if (num_times_registered < 1) {
|
||||
/* This should never happen -- programmer error */
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
/* also using sysv_index's value as an initialization flag */
|
||||
if (-1 == sysv_index)
|
||||
{
|
||||
@ -379,12 +388,14 @@ mca_common_sm_param_register(mca_base_component_t *c)
|
||||
false,
|
||||
/* default value */
|
||||
sm_default,
|
||||
&sm_params);
|
||||
NULL);
|
||||
|
||||
/* also register MCA param synonyms for the component */
|
||||
mca_base_param_reg_syn(sysv_index, c, "have_sysv_support", false);
|
||||
mca_base_param_reg_syn(posix_index, c, "have_posix_support", false);
|
||||
mca_base_param_reg_syn(common_sm_index, c, "store", false);
|
||||
|
||||
/* Once the synonyms are registered, look up the value */
|
||||
if (OPAL_SUCCESS != mca_base_param_lookup_string(common_sm_index,
|
||||
&sm_params))
|
||||
{
|
||||
@ -409,6 +420,26 @@ mca_common_sm_param_register(mca_base_component_t *c)
|
||||
"WARNING: could not parse mpi_common_sm request.");
|
||||
}
|
||||
}
|
||||
free(sm_params);
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int mca_common_sm_param_unregister(mca_base_component_t *c)
|
||||
{
|
||||
if (--num_times_registered > 0) {
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
if (num_times_registered < 0) {
|
||||
/* This should never happen -- programmer error */
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
if (NULL != sm_argv) {
|
||||
opal_argv_free(sm_argv);
|
||||
sm_argv = NULL;
|
||||
}
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
@ -628,13 +659,7 @@ mca_common_sm_seg_alloc(struct mca_mpool_base_module_t *mpool,
|
||||
int
|
||||
mca_common_sm_fini(mca_common_sm_module_t *mca_common_sm_module)
|
||||
{
|
||||
if (NULL != sm_argv)
|
||||
{
|
||||
opal_argv_free(sm_argv);
|
||||
sm_argv = NULL;
|
||||
}
|
||||
if (NULL != sm_fini)
|
||||
{
|
||||
if (NULL != sm_fini && NULL != mca_common_sm_module) {
|
||||
return sm_fini(mca_common_sm_module);
|
||||
}
|
||||
return OMPI_ERR_NOT_FOUND;
|
||||
|
@ -90,15 +90,18 @@ typedef struct mca_common_sm_module_t
|
||||
|
||||
OBJ_CLASS_DECLARATION(mca_common_sm_module_t);
|
||||
|
||||
OMPI_DECLSPEC extern int
|
||||
mca_common_sm_param_register(mca_base_component_t *c);
|
||||
|
||||
/**
|
||||
* Register the MCA parameters for common sm.
|
||||
*/
|
||||
OMPI_DECLSPEC extern int
|
||||
OMPI_DECLSPEC int
|
||||
mca_common_sm_param_register(mca_base_component_t *c);
|
||||
|
||||
/**
|
||||
* Free resources associated with registering MCA params for common sm.
|
||||
*/
|
||||
OMPI_DECLSPEC int
|
||||
mca_common_sm_param_unregister(mca_base_component_t *c);
|
||||
|
||||
/**
|
||||
* This routine is used to set up a shared memory segment (whether
|
||||
* it's an mmaped file or a SYSV IPC segment). It is assumed that
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user