changes to i/f
This commit was SVN r1333.
Этот коммит содержится в:
родитель
c7f89c4892
Коммит
928814249d
@ -26,6 +26,19 @@ typedef void* (*mca_allocator_realloc_fn_t)(struct mca_allocator_t*, void*, size
|
|||||||
typedef void(*mca_allocator_free_fn_t)(struct mca_allocator_t*, void *);
|
typedef void(*mca_allocator_free_fn_t)(struct mca_allocator_t*, void *);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* compact/return memory to higher level allocator
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef int (*mca_allocator_return_fn_t)(
|
||||||
|
struct mca_allocator_t* allocator
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* cleanup (free) any resources held by allocator
|
||||||
|
*/
|
||||||
|
|
||||||
typedef int (*mca_allocator_finalize_fn_t)(
|
typedef int (*mca_allocator_finalize_fn_t)(
|
||||||
struct mca_allocator_t* allocator
|
struct mca_allocator_t* allocator
|
||||||
);
|
);
|
||||||
@ -35,6 +48,7 @@ struct mca_allocator_t {
|
|||||||
mca_allocator_alloc_fn_t alc_alloc;
|
mca_allocator_alloc_fn_t alc_alloc;
|
||||||
mca_allocator_realloc_fn_t alc_realloc;
|
mca_allocator_realloc_fn_t alc_realloc;
|
||||||
mca_allocator_free_fn_t alc_free;
|
mca_allocator_free_fn_t alc_free;
|
||||||
|
mca_allocator_return_fn_t alc_return;
|
||||||
mca_allocator_finalize_fn_t alc_finalize;
|
mca_allocator_finalize_fn_t alc_finalize;
|
||||||
};
|
};
|
||||||
typedef struct mca_allocator_t mca_allocator_t;
|
typedef struct mca_allocator_t mca_allocator_t;
|
||||||
|
@ -14,25 +14,22 @@ int mca_allocator_bucket_module_close(void);
|
|||||||
|
|
||||||
void * mca_allocator_bucket_alloc_wrapper(struct mca_allocator_t* allocator,
|
void * mca_allocator_bucket_alloc_wrapper(struct mca_allocator_t* allocator,
|
||||||
size_t size, size_t align);
|
size_t size, size_t align);
|
||||||
|
static int mca_allocator_num_buckets;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct mca_allocator_t* mca_allocator_bucket_module_init(
|
struct mca_allocator_t* mca_allocator_bucket_module_init(
|
||||||
bool *allow_multi_user_threads,
|
bool *allow_multi_user_threads,
|
||||||
mca_allocator_segment_alloc_fn_t segment_alloc,
|
mca_allocator_segment_alloc_fn_t segment_alloc,
|
||||||
mca_allocator_segment_free_fn_t segment_free)
|
mca_allocator_segment_free_fn_t segment_free)
|
||||||
{
|
{
|
||||||
int num_buckets = 30;
|
|
||||||
int id;
|
|
||||||
size_t alloc_size = sizeof(mca_allocator_bucket_t);
|
size_t alloc_size = sizeof(mca_allocator_bucket_t);
|
||||||
mca_allocator_bucket_t * retval;
|
mca_allocator_bucket_t * retval;
|
||||||
mca_allocator_bucket_t * allocator = segment_alloc(&alloc_size);
|
mca_allocator_bucket_t * allocator = segment_alloc(&alloc_size);
|
||||||
if(NULL == allocator) {
|
if(NULL == allocator) {
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
id = mca_base_param_register_int("allocator","bucket","num_buckets",
|
retval = mca_allocator_bucket_init((mca_allocator_t *) allocator, mca_allocator_num_buckets,
|
||||||
NULL,num_buckets);
|
|
||||||
mca_base_param_lookup_int(id,&num_buckets);
|
|
||||||
|
|
||||||
retval = mca_allocator_bucket_init((mca_allocator_t *) allocator, num_buckets,
|
|
||||||
segment_alloc, segment_free);
|
segment_alloc, segment_free);
|
||||||
if(NULL == retval) {
|
if(NULL == retval) {
|
||||||
segment_free(allocator);
|
segment_free(allocator);
|
||||||
@ -48,6 +45,8 @@ struct mca_allocator_t* mca_allocator_bucket_module_init(
|
|||||||
|
|
||||||
int mca_allocator_bucket_module_open(void) {
|
int mca_allocator_bucket_module_open(void) {
|
||||||
|
|
||||||
|
int id = mca_base_param_register_int("allocator","bucket","num_buckets", NULL,30);
|
||||||
|
mca_base_param_lookup_int(id,&mca_allocator_num_buckets);
|
||||||
return(OMPI_SUCCESS);
|
return(OMPI_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user