1
1

change the code to allow for different fragment size on first, and then

on subsequent fragments.

This commit was SVN r2632.
Этот коммит содержится в:
Rich Graham 2004-09-13 15:24:34 +00:00
родитель d2d6379578
Коммит 70231457ce
7 изменённых файлов: 69 добавлений и 18 удалений

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

@ -31,7 +31,8 @@ mca_ptl_sm_t mca_ptl_sm = {
&mca_ptl_sm_component.super,
5, /* number of elements in the send descriptor cache: RLG - this is
garbage, need to fix. */
sizeof(mca_ptl_sm_send_request_t), /* size of shared memory send
sizeof(mca_ptl_sm_send_request_t) -
sizeof(mca_pml_base_send_request_t), /* size of shared memory send
descriptor */
1, /* ptl_exclusivity */
0, /* ptl_latency */

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

@ -46,7 +46,10 @@ struct mca_ptl_sm_component_t {
mca_mpool_base_module_t* sm_mpool; /**< shared memory pool */
void* sm_mpool_base; /**< base address of shared memory pool */
ompi_free_list_t sm_send_requests; /**< free list of sm send requests -- sendreq + sendfrag */
ompi_free_list_t sm_frags; /**< free list of sm recv fragments */
ompi_free_list_t sm_first_frags; /**< free list of sm first
fragments */
ompi_free_list_t sm_second_frags; /**< free list of sm second
and above fragments */
size_t first_fragment_size; /**< first fragment size */
size_t max_fragment_size; /**< maximum (second and
beyone) fragment size */

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

@ -128,7 +128,7 @@ int mca_ptl_sm_component_open(void)
/* initialize objects */
OBJ_CONSTRUCT(&mca_ptl_sm_component.sm_lock, ompi_mutex_t);
OBJ_CONSTRUCT(&mca_ptl_sm_component.sm_send_requests, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_ptl_sm_component.sm_frags, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_ptl_sm_component.sm_first_frags, ompi_free_list_t);
return OMPI_SUCCESS;
}
@ -142,7 +142,7 @@ int mca_ptl_sm_component_close(void)
{
OBJ_DESTRUCT(&mca_ptl_sm_component.sm_lock);
OBJ_DESTRUCT(&mca_ptl_sm_component.sm_send_requests);
OBJ_DESTRUCT(&mca_ptl_sm_component.sm_frags);
OBJ_DESTRUCT(&mca_ptl_sm_component.sm_first_frags);
return OMPI_SUCCESS;
}
@ -175,7 +175,7 @@ mca_ptl_base_module_t** mca_ptl_sm_component_init(
length=sizeof(mca_ptl_sm_frag_t)+mca_ptl_sm_component.fragment_alignment+
mca_ptl_sm_component.first_fragment_size;
ompi_free_list_init(&mca_ptl_sm_component.sm_frags, length,
ompi_free_list_init(&mca_ptl_sm_component.sm_first_frags, length,
OBJ_CLASS(mca_ptl_sm_frag_t),
mca_ptl_sm_component.sm_free_list_num,
mca_ptl_sm_component.sm_free_list_max,

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

@ -8,14 +8,23 @@
#include "ptl_sm_frag.h"
static void mca_ptl_sm_frag_construct(mca_ptl_sm_frag_t* frag);
static void mca_ptl_sm_frag_destruct(mca_ptl_sm_frag_t* frag);
static void mca_ptl_sm_first_frag_construct(mca_ptl_sm_frag_t* frag);
static void mca_ptl_sm_first_frag_destruct(mca_ptl_sm_frag_t* frag);
static void mca_ptl_sm_second_frag_construct(mca_ptl_sm_frag_t* frag);
static void mca_ptl_sm_second_frag_destruct(mca_ptl_sm_frag_t* frag);
OBJ_CLASS_INSTANCE(
mca_ptl_sm_frag_t,
mca_ptl_base_recv_frag_t,
mca_ptl_sm_frag_construct,
mca_ptl_sm_frag_destruct
mca_ptl_sm_first_frag_construct,
mca_ptl_sm_first_frag_destruct
);
OBJ_CLASS_INSTANCE(
mca_ptl_sm_second_frag_t,
mca_ptl_base_recv_frag_t,
mca_ptl_sm_second_frag_construct,
mca_ptl_sm_second_frag_destruct
);
@ -23,7 +32,7 @@ OBJ_CLASS_INSTANCE(
* shared memory recv fragment constructor
*/
static void mca_ptl_sm_frag_construct(mca_ptl_sm_frag_t* frag)
static void mca_ptl_sm_first_frag_construct(mca_ptl_sm_frag_t* frag)
{
char *ptr;
@ -42,7 +51,34 @@ static void mca_ptl_sm_frag_construct(mca_ptl_sm_frag_t* frag)
* shared memory recv fragment destructor
*/
static void mca_ptl_sm_frag_destruct(mca_ptl_sm_frag_t* frag)
static void mca_ptl_sm_first_frag_destruct(mca_ptl_sm_frag_t* frag)
{
}
/*
* shared memory second and above fragments
*/
static void mca_ptl_sm_second_frag_construct(mca_ptl_sm_frag_t* frag)
{
char *ptr;
/* set the buffer length */
frag->buff_length=(size_t)mca_ptl_sm_component.max_fragment_size;
/* set buffer pointer */
ptr=((char *)frag)+sizeof(mca_ptl_sm_frag_t)+
mca_ptl_sm_component.fragment_alignment;
/* align */
ptr=ptr-(((size_t)ptr)%(mca_ptl_sm_component.fragment_alignment));
}
/*
* shared memory second and above fragments
*/
static void mca_ptl_sm_second_frag_destruct(mca_ptl_sm_frag_t* frag)
{
}

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

@ -18,9 +18,13 @@
OBJ_CLASS_DECLARATION(mca_ptl_sm_frag_t);
OBJ_CLASS_DECLARATION(mca_ptl_sm_second_frag_t);
/**
* shared memory received fragment derived type.
* shared memory received fragment derived type - because of
* the way lists are initialized in Open MPI, this is good
* only for the first fragment.
*/
struct mca_ptl_sm_frag_t {
mca_ptl_base_recv_frag_t super; /**< base receive fragment descriptor */
@ -29,5 +33,12 @@ struct mca_ptl_sm_frag_t {
};
typedef struct mca_ptl_sm_frag_t mca_ptl_sm_frag_t;
/**
* shared memory received fragment derived type - because of
* the way lists are initialized in Open MPI, this is good
* only for the second and beyond fragments.
*/
typedef struct mca_ptl_sm_frag_t mca_ptl_sm_second_frag_t;
#endif

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

@ -39,7 +39,8 @@ void mca_ptl_sm_send_request_destruct(mca_ptl_sm_send_request_t* request)
* memory send request is initialized. This will attempt
* to allocate fragment descriptor and payload memory
*/
int mca_ptl_sm_send_request_init(mca_ptl_base_module_request_init_fn_t* request)
int mca_ptl_sm_send_request_init(struct mca_ptl_base_module_t* ptl,
struct mca_pml_base_send_request_t* request)
{
int return_value=OMPI_SUCCESS;

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

@ -32,12 +32,11 @@ struct mca_ptl_sm_send_request_t {
typedef struct mca_ptl_sm_send_request_t mca_ptl_sm_send_request_t;
/**
* int
* mca_ptl_sm_send_request_init(mca_ptl_base_module_request_init_fn_t*
* request)
* initializtion function to be called when a new shared
* memory send request is initialized.
*/
int mca_ptl_sm_send_request_init(mca_ptl_base_module_request_init_fn_t*
request);
int mca_ptl_sm_send_request_init(struct mca_ptl_base_module_t* ptl,
struct mca_pml_base_send_request_t* request);
#endif