Remove the memory leak.
Keep trace of the allocated array of ptl pointers. This commit was SVN r2069.
Этот коммит содержится в:
родитель
5185e4f006
Коммит
9ad929ecd7
@ -14,17 +14,19 @@
|
|||||||
#include "mca/pml/base/pml_base_recvreq.h"
|
#include "mca/pml/base/pml_base_recvreq.h"
|
||||||
#include "mca/ptl/base/ptl_base_recvfrag.h"
|
#include "mca/ptl/base/ptl_base_recvfrag.h"
|
||||||
|
|
||||||
|
typedef struct mca_ptl_prof mca_ptl_prof_t;
|
||||||
|
typedef struct mca_ptl_prof_module_1_0_0 mca_ptl_prof_module_1_0_0_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PROF PTL module.
|
* PROF PTL module.
|
||||||
*/
|
*/
|
||||||
struct mca_ptl_prof_module_1_0_0 {
|
struct mca_ptl_prof_module_1_0_0 {
|
||||||
mca_ptl_base_component_t super; /**< base PTL module */
|
mca_ptl_base_component_t super; /**< base PTL module */
|
||||||
struct mca_ptl_t** prof_ptls; /**< array of available PTLs */
|
mca_ptl_prof_t** prof_ptls; /**< array of available PTLs */
|
||||||
u_int32_t prof_num_ptls; /**< number of ptls actually used */
|
u_int32_t prof_num_ptls; /**< number of ptls actually used */
|
||||||
u_int32_t prof_max_ptls; /**< maximum number of ptls - available kernel ifs */
|
u_int32_t prof_max_ptls; /**< maximum number of ptls - available kernel ifs */
|
||||||
u_int32_t prof_buf_size; /**< the size of the internal buffer used to profile each PTL */
|
u_int32_t prof_buf_size; /**< the size of the internal buffer used to profile each PTL */
|
||||||
};
|
};
|
||||||
typedef struct mca_ptl_prof_module_1_0_0 mca_ptl_prof_module_1_0_0_t;
|
|
||||||
/**
|
/**
|
||||||
* Profiling module.
|
* Profiling module.
|
||||||
*/
|
*/
|
||||||
@ -35,7 +37,6 @@ struct mca_ptl_prof {
|
|||||||
u_int32_t prof_start_recv_id;
|
u_int32_t prof_start_recv_id;
|
||||||
u_int32_t prof_complete_id;
|
u_int32_t prof_complete_id;
|
||||||
};
|
};
|
||||||
typedef struct mca_ptl_prof mca_ptl_prof_t;
|
|
||||||
OBJ_CLASS_DECLARATION(mca_ptl_prof_t);
|
OBJ_CLASS_DECLARATION(mca_ptl_prof_t);
|
||||||
|
|
||||||
#endif /* PTL_PROF_H_HAS_BEEN_INCLUDED */
|
#endif /* PTL_PROF_H_HAS_BEEN_INCLUDED */
|
||||||
|
@ -24,46 +24,12 @@
|
|||||||
#include "mca/base/mca_base_module_exchange.h"
|
#include "mca/base/mca_base_module_exchange.h"
|
||||||
#include "ptl_prof.h"
|
#include "ptl_prof.h"
|
||||||
|
|
||||||
/**
|
static int mca_ptl_prof_component_open_fn( void );
|
||||||
* This is the moment to grab all existing modules, and then replace their
|
static int mca_ptl_prof_component_close_fn( void );
|
||||||
* functions with my own. In same time the ptl_stack will be initialized
|
|
||||||
* with the pointer to a ptl automatically generate, which will contain
|
|
||||||
* the correct pointers.
|
|
||||||
*/
|
|
||||||
static int ptl_prof_component_control_fn( int param, void* value, size_t size )
|
|
||||||
{
|
|
||||||
/* check in mca_ptl_base_modules_initialized */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We have to create at least one PTL, just to allow the PML to call the control
|
|
||||||
* function associated with this PTL.
|
|
||||||
*/
|
|
||||||
extern mca_ptl_prof_t mca_ptl_prof;
|
|
||||||
static struct mca_ptl_base_module_t** ptl_prof_component_init_fn(
|
static struct mca_ptl_base_module_t** ptl_prof_component_init_fn(
|
||||||
int *num_ptls,
|
int *num_ptls,
|
||||||
bool *allow_multi_user_threads,
|
bool *allow_multi_user_threads, bool *have_hidden_threads );
|
||||||
bool *have_hidden_threads )
|
static int ptl_prof_component_control_fn( int param, void* value, size_t size );
|
||||||
{
|
|
||||||
struct mca_ptl_base_module_t** ptl_array;
|
|
||||||
|
|
||||||
*num_ptls = 1;
|
|
||||||
*allow_multi_user_threads = true;
|
|
||||||
*have_hidden_threads = false;
|
|
||||||
ptl_array = (struct mca_ptl_base_module_t**)malloc( (*num_ptls) * sizeof(struct mca_ptl_base_module_t*) );
|
|
||||||
ptl_array[0] = (struct mca_ptl_base_module_t*)&mca_ptl_prof;
|
|
||||||
return ptl_array;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int mca_ptl_prof_component_open_fn( void )
|
|
||||||
{
|
|
||||||
return OMPI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int mca_ptl_prof_component_close_fn( void )
|
|
||||||
{
|
|
||||||
return OMPI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
mca_ptl_prof_module_1_0_0_t mca_ptl_prof_component = {
|
mca_ptl_prof_module_1_0_0_t mca_ptl_prof_component = {
|
||||||
{
|
{
|
||||||
@ -96,3 +62,50 @@ mca_ptl_prof_module_1_0_0_t mca_ptl_prof_component = {
|
|||||||
NULL,
|
NULL,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the moment to grab all existing modules, and then replace their
|
||||||
|
* functions with my own. In same time the ptl_stack will be initialized
|
||||||
|
* with the pointer to a ptl automatically generate, which will contain
|
||||||
|
* the correct pointers.
|
||||||
|
*/
|
||||||
|
static int ptl_prof_component_control_fn( int param, void* value, size_t size )
|
||||||
|
{
|
||||||
|
/* check in mca_ptl_base_modules_initialized */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We have to create at least one PTL, just to allow the PML to call the control
|
||||||
|
* function associated with this PTL.
|
||||||
|
*/
|
||||||
|
extern mca_ptl_prof_t mca_ptl_prof;
|
||||||
|
static struct mca_ptl_base_module_t** ptl_prof_component_init_fn(
|
||||||
|
int *num_ptls,
|
||||||
|
bool *allow_multi_user_threads,
|
||||||
|
bool *have_hidden_threads )
|
||||||
|
{
|
||||||
|
mca_ptl_prof_t** ptl_array;
|
||||||
|
|
||||||
|
*num_ptls = 1;
|
||||||
|
*allow_multi_user_threads = true;
|
||||||
|
*have_hidden_threads = false;
|
||||||
|
ptl_array = (mca_ptl_prof_t**)malloc( (*num_ptls) * sizeof(mca_ptl_prof_t*) );
|
||||||
|
ptl_array[0] = &mca_ptl_prof;
|
||||||
|
mca_ptl_prof_component.prof_ptls = ptl_array;
|
||||||
|
return (struct mca_ptl_base_module_t**)ptl_array;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mca_ptl_prof_component_open_fn( void )
|
||||||
|
{
|
||||||
|
return OMPI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mca_ptl_prof_component_close_fn( void )
|
||||||
|
{
|
||||||
|
if( NULL != mca_ptl_prof_component.prof_ptls ) {
|
||||||
|
free( mca_ptl_prof_component.prof_ptls );
|
||||||
|
mca_ptl_prof_component.prof_ptls = NULL;
|
||||||
|
}
|
||||||
|
return OMPI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user