1
1

- dont create shared memory pool if it won't be used

This commit was SVN r5494.
Этот коммит содержится в:
Tim Woodall 2005-04-22 16:18:41 +00:00
родитель 88ca070e88
Коммит 3c6fb03e9c
5 изменённых файлов: 42 добавлений и 16 удалений

Просмотреть файл

@ -48,6 +48,7 @@ OMPI_DECLSPEC int mca_mpool_base_init(bool enable_progress_threads,
OMPI_DECLSPEC int mca_mpool_base_close(void);
OMPI_DECLSPEC mca_mpool_base_component_t* mca_mpool_base_component_lookup(const char* name);
OMPI_DECLSPEC mca_mpool_base_module_t* mca_mpool_base_module_lookup(const char* name);
OMPI_DECLSPEC mca_mpool_base_module_t* mca_mpool_base_module_init(const char* name);
/*

Просмотреть файл

@ -25,7 +25,8 @@
OBJ_CLASS_INSTANCE(mca_mpool_base_selected_module_t, ompi_list_item_t, NULL, NULL);
static bool mca_mpool_enable_progress_threads = true;
static bool mca_mpool_enable_mpi_threads = true;
/**
* Function for weeding out mpool modules that don't want to run.
@ -36,6 +37,13 @@ OBJ_CLASS_INSTANCE(mca_mpool_base_selected_module_t, ompi_list_item_t, NULL, NUL
* to the caller in a ompi_list_t.
*/
int mca_mpool_base_init(bool enable_progress_threads, bool enable_mpi_threads)
{
mca_mpool_enable_progress_threads = enable_progress_threads;
mca_mpool_enable_mpi_threads = enable_mpi_threads;
return OMPI_SUCCESS;
}
mca_mpool_base_module_t* mca_mpool_base_module_init(const char* name)
{
ompi_list_item_t *item;
mca_base_component_list_item_t *cli;
@ -51,6 +59,8 @@ int mca_mpool_base_init(bool enable_progress_threads, bool enable_mpi_threads)
item = ompi_list_get_next(item)) {
cli = (mca_base_component_list_item_t *) item;
component = (mca_mpool_base_component_t *) cli->cli_component;
if(strcmp(component->mpool_version.mca_component_name,name) != 0)
continue;
ompi_output_verbose(10, mca_mpool_base_output,
"select: initializing %s module %s",
@ -60,8 +70,8 @@ int mca_mpool_base_init(bool enable_progress_threads, bool enable_mpi_threads)
ompi_output_verbose(10, mca_mpool_base_output,
"select: no init function; ignoring module");
} else {
module = component->mpool_init(enable_progress_threads,
enable_mpi_threads);
module = component->mpool_init(mca_mpool_enable_progress_threads,
mca_mpool_enable_mpi_threads);
/* If the module didn't initialize, unload it */
@ -85,10 +95,11 @@ int mca_mpool_base_init(bool enable_progress_threads, bool enable_mpi_threads)
sm->mpool_component = component;
sm->mpool_module = module;
ompi_list_append(&mca_mpool_base_modules, (ompi_list_item_t*) sm);
return module;
}
}
}
return OMPI_SUCCESS;
return NULL;
}

Просмотреть файл

@ -46,7 +46,7 @@ mca_mpool_base_component_t* mca_mpool_base_component_lookup(const char* name)
mca_mpool_base_module_t* mca_mpool_base_module_lookup(const char* name)
{
/* Finalize all the mpool modules and free their list items */
/* does the module already exist? */
ompi_list_item_t *item;
for(item = ompi_list_get_first(&mca_mpool_base_modules);
item != ompi_list_get_end(&mca_mpool_base_modules);
@ -57,6 +57,8 @@ mca_mpool_base_module_t* mca_mpool_base_module_lookup(const char* name)
return sm->mpool_module;
}
}
return NULL;
/* if not create it */
return mca_mpool_base_module_init(name);;
}

Просмотреть файл

@ -32,6 +32,7 @@
#include "mca/ptl/base/ptl_base_header.h"
#include "mca/ptl/base/ptl_base_sendfrag.h"
#include "mca/ptl/base/ptl_base_recvfrag.h"
#include "mca/mpool/base/base.h"
#include "mca/base/mca_base_module_exchange.h"
#include "mca/oob/base/base.h"
#include "mca/common/sm/common_sm_mmap.h"
@ -215,6 +216,24 @@ int mca_ptl_sm_add_procs_same_base_addr(
}
}
}
if( n_local_procs == 0) {
return_code = OMPI_SUCCESS;
goto CLEANUP;
}
/* lookup shared memory pool */
if(NULL == mca_ptl_sm_component.sm_mpool) {
mca_ptl_sm_component.sm_mpool =
mca_mpool_base_module_lookup(mca_ptl_sm_component.sm_mpool_name);
/* Sanity check to ensure that we found it */
if (NULL == mca_ptl_sm_component.sm_mpool) {
return_code = OMPI_ERR_OUT_OF_RESOURCE;
goto CLEANUP;
}
mca_ptl_sm_component.sm_mpool_base =
mca_ptl_sm_component.sm_mpool->mpool_base();
}
/* make sure that my_smp_rank has been defined */
if( 0xFFFFFFFF == mca_ptl_sm_component.my_smp_rank ) {

Просмотреть файл

@ -248,16 +248,9 @@ mca_ptl_base_module_t** mca_ptl_sm_component_init(
*num_ptls = 0;
/* lookup shared memory pool */
mca_ptl_sm_component.sm_mpool =
mca_mpool_base_module_lookup(mca_ptl_sm_component.sm_mpool_name);
/* Sanity check to ensure that we found it */
if (NULL == mca_ptl_sm_component.sm_mpool) {
return NULL;
}
mca_ptl_sm_component.sm_mpool_base =
mca_ptl_sm_component.sm_mpool->mpool_base();
/* lookup/create shared memory pool only when used */
mca_ptl_sm_component.sm_mpool = NULL;
mca_ptl_sm_component.sm_mpool_base = NULL;
/* publish shared memory parameters with the MCA framework */
if (OMPI_SUCCESS != mca_ptl_sm_component_exchange()) {