1
1

adding an implementation for mca_ptl_sm_request_alloc and

mca_ptl_sm_request_return.  Fix some bugs found in code review.
Shared Memory implementation reviewed by Tim W. and Ralph C.

This commit was SVN r3222.
Этот коммит содержится в:
Rich Graham 2004-10-19 23:37:30 +00:00
родитель 9ba3ae9c9d
Коммит 52cfe186c2
3 изменённых файлов: 34 добавлений и 4 удалений

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

@ -333,14 +333,38 @@ int mca_ptl_sm_finalize(struct mca_ptl_base_module_t* ptl)
}
int mca_ptl_sm_request_alloc(struct mca_ptl_base_module_t* ptl, struct mca_pml_base_send_request_t** request)
int mca_ptl_sm_request_alloc(struct mca_ptl_base_module_t* ptl, struct mca_pml_base_send_request_t* request)
{
mca_ptl_sm_send_request_t *sm_request;
ompi_list_item_t* item;
int rc;
/* allocate shared memory, first fragment */
OMPI_FREE_LIST_GET(&(mca_ptl_sm.sm_first_frags),item,rc);
if( OMPI_SUCCESS != rc ) {
return rc;
}
/* associate this fragment with the send descriptor */
sm_request=(mca_ptl_sm_send_request_t *)request;
sm_request->req_frag=(mca_ptl_sm_frag_t *)item;
sm_request->req_frag_offset_from_base=(mca_ptl_sm_frag_t *)
((char *)item-mca_ptl_sm_component.sm_offset);
return OMPI_SUCCESS;
}
void mca_ptl_sm_request_return(struct mca_ptl_base_module_t* ptl, struct mca_pml_base_send_request_t* request)
{
mca_ptl_sm_send_request_t *sm_request;
ompi_list_item_t* item;
/* return the fragment descriptor to the free list */
sm_request=(mca_ptl_sm_send_request_t *)request;
item=(ompi_list_item_t *)sm_request->req_frag;
OMPI_FREE_LIST_RETURN(&(mca_ptl_sm.sm_first_frags),item);
}
@ -637,6 +661,7 @@ void mca_ptl_sm_matched(
sm_frag_desc = (mca_ptl_sm_frag_t *)frag;
/* copy, only if there is data to copy */
max_data=0;
if( 0 < sm_frag_desc->super.frag_base.frag_size ) {
header = &((frag)->frag_base.frag_header.hdr_match);

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

@ -196,7 +196,7 @@ extern int mca_ptl_sm_del_procs(
*/
extern int mca_ptl_sm_request_alloc(
struct mca_ptl_base_module_t* ptl,
struct mca_pml_base_send_request_t**
struct mca_pml_base_send_request_t*
);
/**

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

@ -170,6 +170,7 @@ int mca_ptl_sm_component_close(void)
OBJ_DESTRUCT(&mca_ptl_sm.sm_send_requests);
OBJ_DESTRUCT(&mca_ptl_sm.sm_first_frags);
OBJ_DESTRUCT(&mca_ptl_sm.sm_second_frags);
OBJ_DESTRUCT(&mca_ptl_sm.sm_pending_ack_lock);
OBJ_DESTRUCT(&mca_ptl_sm.sm_pending_ack);
return OMPI_SUCCESS;
}
@ -335,6 +336,10 @@ int mca_ptl_sm_component_progress(mca_ptl_tstamp_t tstamp)
header_ptr=(mca_ptl_sm_frag_t *)ompi_fifo_read_from_tail( send_fifo,
mca_ptl_sm_component.sm_offset);
if( OMPI_CB_FREE == header_ptr ) {
/* release thread lock */
if( ompi_using_threads() ) {
ompi_atomic_unlock(&(send_fifo->tail_lock));
}
continue;
}
@ -415,7 +420,7 @@ int mca_ptl_sm_component_progress(mca_ptl_tstamp_t tstamp)
* sending the ack, so that when the ack is recieved,
* manipulated, and put on a new list, it is not also
* on a different list */
item = ompi_list_get_first(&(mca_ptl_sm.sm_pending_ack));
item = ompi_list_remove_first(&(mca_ptl_sm.sm_pending_ack));
while ( item != ompi_list_get_end(&(mca_ptl_sm.sm_pending_ack)) ) {
/* get fragment pointer */
@ -440,7 +445,7 @@ int mca_ptl_sm_component_progress(mca_ptl_tstamp_t tstamp)
}
/* get next fragment to ack */
item = ompi_list_get_first(&(mca_ptl_sm.sm_pending_ack));
item = ompi_list_remove_first(&(mca_ptl_sm.sm_pending_ack));
}