integration of shared memory pool with shared memory ptl
This commit was SVN r1383.
Этот коммит содержится в:
родитель
ab24783107
Коммит
fe7fd36137
@ -41,6 +41,17 @@ int mca_allocator_base_open(void)
|
||||
|
||||
mca_allocator_base_module_t* mca_allocator_component_lookup(const char* name)
|
||||
{
|
||||
/* Traverse the list of available modules; call their init functions. */
|
||||
ompi_list_item_t* item;
|
||||
for (item = ompi_list_get_first(&mca_allocator_base_components);
|
||||
item != ompi_list_get_end(&mca_allocator_base_components);
|
||||
item = ompi_list_get_next(item)) {
|
||||
mca_base_module_list_item_t *mli = (mca_base_module_list_item_t *) item;
|
||||
mca_allocator_base_module_t* component = (mca_allocator_base_module_t *) mli->mli_module;
|
||||
if(strcmp(component->allocator_version.mca_module_name,name) == 0) {
|
||||
return component;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -25,14 +25,14 @@ struct mca_allocator_t* mca_allocator_bucket_module_init(
|
||||
{
|
||||
size_t alloc_size = sizeof(mca_allocator_bucket_t);
|
||||
mca_allocator_bucket_t * retval;
|
||||
mca_allocator_bucket_t * allocator = segment_alloc(&alloc_size);
|
||||
mca_allocator_bucket_t * allocator = malloc(alloc_size);
|
||||
if(NULL == allocator) {
|
||||
return(NULL);
|
||||
}
|
||||
retval = mca_allocator_bucket_init((mca_allocator_t *) allocator, mca_allocator_num_buckets,
|
||||
segment_alloc, segment_free);
|
||||
if(NULL == retval) {
|
||||
segment_free(allocator);
|
||||
free(allocator);
|
||||
return(NULL);
|
||||
}
|
||||
allocator->super.alc_alloc = mca_allocator_bucket_alloc_wrapper;
|
||||
|
@ -33,7 +33,7 @@ mca_allocator_bucket_t * mca_allocator_bucket_init(mca_allocator_t * mem,
|
||||
}
|
||||
/* initialize the array of buckets */
|
||||
size = sizeof(mca_allocator_bucket_bucket_t) * num_buckets;
|
||||
mem_options->buckets = (mca_allocator_bucket_bucket_t*) get_mem_funct(&size);
|
||||
mem_options->buckets = (mca_allocator_bucket_bucket_t*) malloc(size);
|
||||
if(NULL == mem_options->buckets) {
|
||||
return(NULL);
|
||||
}
|
||||
|
@ -38,11 +38,10 @@ int mca_base_init_select_modules(int requested,
|
||||
functions and see if they return happiness). For pml, there will
|
||||
only be one (because there's only one for the whole process), but
|
||||
for ptl and coll, we'll get lists back. */
|
||||
|
||||
if (OMPI_SUCCESS != mca_mpool_base_init(&user_threads)) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
allow_multi_user_threads |= user_threads;
|
||||
allow_multi_user_threads &= user_threads;
|
||||
|
||||
/* JMS: At some point, we'll need to feed it the thread level to
|
||||
ensure to pick one high enough (e.g., if we need CR) */
|
||||
|
@ -24,12 +24,19 @@ struct mca_mpool_sm_component_t {
|
||||
typedef struct mca_mpool_sm_component_t mca_mpool_sm_component_t;
|
||||
|
||||
extern mca_mpool_sm_component_t mca_mpool_sm_module;
|
||||
extern mca_mpool_t mca_mpool_sm;
|
||||
|
||||
/*
|
||||
* Returns base address of shared memory mapping.
|
||||
*/
|
||||
|
||||
void* mca_mpool_sm_base(void);
|
||||
|
||||
|
||||
/**
|
||||
* returns a pointer to an mca_mpool_sm_allocation_t - the allocation
|
||||
* will always be increased by the size of mca_mpool_sm_allocation_t -
|
||||
* the allocated block follows this header
|
||||
* Allocate block of shared memory.
|
||||
*/
|
||||
|
||||
void* mca_mpool_sm_alloc(size_t size, size_t align);
|
||||
|
||||
/**
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "mpool_sm_mmap.h"
|
||||
|
||||
|
||||
|
||||
mca_mpool_sm_component_t mca_mpool_sm_module = {
|
||||
{
|
||||
/* First, the mca_base_module_t struct containing meta information
|
||||
@ -117,8 +118,14 @@ mca_mpool_t* mca_mpool_sm_init(bool *allow_multi_user_threads)
|
||||
ompi_output(0, "mca_mpool_sm_init: unable to initialize allocator");
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
*allow_multi_user_threads = true;
|
||||
return &mca_mpool_sm;
|
||||
}
|
||||
|
||||
|
||||
void* mca_mpool_sm_base()
|
||||
{
|
||||
return (mca_mpool_sm_module.sm_mmap != NULL) ? mca_mpool_sm_module.sm_mmap->map_addr : NULL;
|
||||
}
|
||||
|
||||
|
@ -133,3 +133,4 @@ void* mca_mpool_sm_mmap_alloc(size_t* size)
|
||||
return addr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "util/argv.h"
|
||||
#include "util/output.h"
|
||||
#include "util/sys_info.h"
|
||||
#include "mca/mpool/sm/mpool_sm.h"
|
||||
#include "mca/pml/pml.h"
|
||||
#include "mca/ptl/ptl.h"
|
||||
#include "mca/ptl/base/ptl_base_sendreq.h"
|
||||
@ -151,31 +152,22 @@ mca_ptl_t** mca_ptl_sm_module_init(
|
||||
*allow_multi_user_threads = true;
|
||||
*have_hidden_threads = OMPI_HAVE_THREADS;
|
||||
|
||||
/* allocate a block of shared memory */
|
||||
/*
|
||||
mca_ptl_sm_module.sm_mmap = mca_ptl_sm_mmap_init(mca_ptl_sm_module.sm_min_alloc);
|
||||
if(NULL == mca_ptl_sm_module.sm_mmap)
|
||||
return NULL;
|
||||
*/
|
||||
|
||||
/* initialize free lists */
|
||||
/*
|
||||
ompi_free_list_init(&mca_ptl_sm_module.sm_send_requests,
|
||||
sizeof(mca_ptl_sm_send_request_t),
|
||||
OBJ_CLASS(mca_ptl_sm_send_request_t),
|
||||
mca_ptl_sm_module.sm_free_list_num,
|
||||
mca_ptl_sm_module.sm_free_list_max,
|
||||
mca_ptl_sm_module.sm_free_list_inc,
|
||||
&mca_ptl_sm_module.sm_allocator); *//* use shared-memory allocator */
|
||||
&mca_mpool_sm); /* use shared-memory pool */
|
||||
|
||||
/*
|
||||
ompi_free_list_init(&mca_ptl_sm_module.sm_recv_frags,
|
||||
sizeof(mca_ptl_sm_recv_frag_t),
|
||||
OBJ_CLASS(mca_ptl_sm_recv_frag_t),
|
||||
mca_ptl_sm_module.sm_free_list_num,
|
||||
mca_ptl_sm_module.sm_free_list_max,
|
||||
mca_ptl_sm_module.sm_free_list_inc,
|
||||
&mca_ptl_sm_module.sm_allocator); *//* use default allocator */
|
||||
&mca_mpool_sm); /* use shared-memory pool */
|
||||
|
||||
/* publish shared memory parameters with the MCA framework */
|
||||
if(mca_ptl_sm_module_exchange() != OMPI_SUCCESS)
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user