From 1e162da7c7de85cabf4cc56b685de5495c7fd6ee Mon Sep 17 00:00:00 2001 From: Weikuan Yu Date: Fri, 30 Jul 2004 17:14:20 +0000 Subject: [PATCH] Commit the code to test at OSU. This commit was SVN r1824. --- src/mca/ptl/elan/.ompi_ignore | 0 src/mca/ptl/elan/src/ptl_elan.c | 34 ++++++++++++++++------------ src/mca/ptl/elan/src/ptl_elan.h | 2 +- src/mca/ptl/elan/src/ptl_elan_frag.c | 2 +- src/mca/ptl/elan/src/ptl_elan_frag.h | 2 +- src/mca/ptl/elan/src/ptl_elan_priv.c | 27 +++++++++++----------- 6 files changed, 36 insertions(+), 31 deletions(-) delete mode 100644 src/mca/ptl/elan/.ompi_ignore diff --git a/src/mca/ptl/elan/.ompi_ignore b/src/mca/ptl/elan/.ompi_ignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/mca/ptl/elan/src/ptl_elan.c b/src/mca/ptl/elan/src/ptl_elan.c index e9fce7449e..70508990dd 100644 --- a/src/mca/ptl/elan/src/ptl_elan.c +++ b/src/mca/ptl/elan/src/ptl_elan.c @@ -42,7 +42,7 @@ mca_ptl_elan_t mca_ptl_elan = { mca_ptl_elan_get, mca_ptl_elan_matched, mca_ptl_elan_req_init, - mca_ptl_elan_req_fini, + mca_ptl_elan_req_fini } }; @@ -164,27 +164,25 @@ int mca_ptl_elan_req_init (struct mca_ptl_t *ptl, struct mca_pml_base_send_request_t *request) { - int rc = OMPI_SUCCESS; mca_ptl_elan_send_frag_t *sd; mca_ptl_elan_send_request_t * elan_req; START_FUNC(); - /*OBJ_CONSTRUCT (request, mca_pml_base_send_request_t);*/ sd = mca_ptl_elan_alloc_send_desc(ptl, request); if (NULL == sd) { ompi_output(0, "[%s:%d] Unable to allocate an elan send descriptors \n", __FILE__, __LINE__); - rc = OMPI_ERR_OUT_OF_RESOURCE; + return OMPI_ERR_OUT_OF_RESOURCE; } else { /* XXX: Hope PML never writes into the fragment */ - (mca_ptl_elan_send_request_t *request)->req_frag = sd; + ((mca_ptl_elan_send_request_t *)request)->req_frag = sd; } sd->desc->desc_status = MCA_PTL_ELAN_DESC_CACHED; END_FUNC(); - return rc; + return OMPI_SUCCESS; } void @@ -193,10 +191,12 @@ mca_ptl_elan_req_fini (struct mca_ptl_t *ptl, { /* XXX: Lock to be added */ ompi_ptl_elan_queue_ctrl_t *queue; - queue = (struct mca_ptl_elan_t * ptl)->queue; + mca_ptl_elan_send_frag_t *desc; + + queue = ((struct mca_ptl_elan_t * )ptl)->queue; /* return the fragment and update the status */ - desc = (mca_ptl_elan_send_request_t *) request->req_frag; + desc = ((mca_ptl_elan_send_request_t *) request)->req_frag; OMPI_FREE_LIST_RETURN (&queue->tx_desc_free, (ompi_list_item_t *) desc); desc->desc->desc_status = MCA_PTL_ELAN_DESC_LOCAL; return; @@ -243,19 +243,20 @@ mca_ptl_elan_isend (struct mca_ptl_t *ptl, START_FUNC(); - if (offset == 0) /* The first fragment uses a cached desc */ + if (offset == 0) { /* The first fragment uses a cached desc */ sd = ((mca_ptl_elan_send_request_t*)sendreq)->req_frag; } else { /* Get a frag desc and allocate a send desc */ ompi_free_list_t * frag_list; + ompi_list_item_t * item; frag_list = &mca_ptl_elan_module.elan_send_frags_free; /* More sendfrag then descritpors, no need to block */ ompi_mutex_lock(&frag_list->fl_lock); - item = ompi_list_remove_first (&((flist)->super)); - ompi_mutex_unlock(&flist->fl_lock); + item = ompi_list_remove_first (&((frag_list)->super)); + ompi_mutex_unlock(&frag_list->fl_lock); OMPI_PTL_ELAN_CHECK_UNEX (item, NULL, OMPI_ERROR, 0); sd = mca_ptl_elan_alloc_send_desc(ptl, sendreq); @@ -329,7 +330,7 @@ mca_ptl_elan_matched (mca_ptl_t * ptl, request = frag->frag_request; /* Process the fragment */ - set = fetchNset (&(mca_ptl_elan_recv_frag_t *)frag->frag_progressed, 1); + set = fetchNset (&((mca_ptl_elan_recv_frag_t *)frag)->frag_progressed, 1); if (!set) { @@ -339,7 +340,7 @@ mca_ptl_elan_matched (mca_ptl_t * ptl, * But in ELAN cases, we save the data into an unex buffer * if the recv descriptor is not posted (for too long) (TODO). * We then need to copy from unex_buffer to application buffer */ - if(header->hdr_frag_length > 0) { + if(header->hdr_frag.hdr_frag_length > 0) { struct iovec iov; ompi_proc_t *proc; @@ -377,8 +378,11 @@ mca_ptl_elan_matched (mca_ptl_t * ptl, */ } - frag->frag_base.frag_owner->ptl_recv_progress - (frag->frag_base.frag_owner, request, frag->frag_base.frag_size); + frag->frag_base.frag_owner->ptl_recv_progress ( + frag->frag_base.frag_owner, + request, + frag->frag_base.frag_size, + frag->frag_base.frag_size); /* FIXME: * To support the required ACK, do not return diff --git a/src/mca/ptl/elan/src/ptl_elan.h b/src/mca/ptl/elan/src/ptl_elan.h index a74d7a4f71..8c55a2a8d7 100644 --- a/src/mca/ptl/elan/src/ptl_elan.h +++ b/src/mca/ptl/elan/src/ptl_elan.h @@ -167,7 +167,7 @@ mca_ptl_elan_del_procs (struct mca_ptl_t *ptl, * @param request (OUT) Pointer to allocated request. * @return Status indicating if allocation was successful. */ -extern int +extern int mca_ptl_elan_req_init (struct mca_ptl_t *ptl, struct mca_pml_base_send_request_t *req); diff --git a/src/mca/ptl/elan/src/ptl_elan_frag.c b/src/mca/ptl/elan/src/ptl_elan_frag.c index 9b80d2f840..e788a70e9c 100644 --- a/src/mca/ptl/elan/src/ptl_elan_frag.c +++ b/src/mca/ptl/elan/src/ptl_elan_frag.c @@ -124,7 +124,7 @@ mca_ptl_elan_alloc_send_desc (struct mca_ptl_t *ptl_ptr, } } desc = (mca_ptl_elan_send_frag_t *) item; - desc->desc->desc_type = MCA_PTL_ELAN_QDMA_DESC; + desc->desc->desc_type = MCA_PTL_ELAN_DESC_QDMA; } desc->desc->req = (struct mca_pml_base_send_request_t *)sendreq; diff --git a/src/mca/ptl/elan/src/ptl_elan_frag.h b/src/mca/ptl/elan/src/ptl_elan_frag.h index 679d87b8db..402a545965 100644 --- a/src/mca/ptl/elan/src/ptl_elan_frag.h +++ b/src/mca/ptl/elan/src/ptl_elan_frag.h @@ -33,7 +33,7 @@ typedef struct mca_ptl_elan_send_frag_t mca_ptl_elan_send_frag_t; * ELAN received fragment derived type. */ struct mca_ptl_elan_recv_frag_t { - mca_ptl_base_recv_frag_t frag_base; + mca_ptl_base_recv_frag_t frag_recv; size_t frag_hdr_cnt; size_t frag_msg_cnt; int frag_progressed; diff --git a/src/mca/ptl/elan/src/ptl_elan_priv.c b/src/mca/ptl/elan/src/ptl_elan_priv.c index a12a56db8e..e50b4fd386 100644 --- a/src/mca/ptl/elan/src/ptl_elan_priv.c +++ b/src/mca/ptl/elan/src/ptl_elan_priv.c @@ -26,6 +26,7 @@ mca_ptl_elan_init_qdma_desc (struct ompi_ptl_elan_qdma_desc_t *desc, int destvp; int size_out; int size_in; + int rc = OMPI_SUCCESS; START_FUNC(); @@ -92,7 +93,7 @@ mca_ptl_elan_init_qdma_desc (struct ompi_ptl_elan_qdma_desc_t *desc, if (rc < 0) { ompi_output (0, "[%s:%d] Unable to pack data\n", __FILE__, __LINE__); - return OMPI_ERROR; + return; } size_out = iov.iov_len; } else { @@ -158,7 +159,7 @@ mca_ptl_elan_start_desc (mca_ptl_elan_send_frag_t * desc, #endif - if (desc->desc->desc_type == MCA_PTL_ELAN_QDMA_DESC) { + if (desc->desc->desc_type == MCA_PTL_ELAN_DESC_QDMA) { struct ompi_ptl_elan_qdma_desc_t *qdma; qdma = (ompi_ptl_elan_qdma_desc_t *)desc->desc; @@ -197,10 +198,10 @@ mca_ptl_elan_data_frag (struct mca_ptl_elan_t *ptl, ompi_list_item_t *item; mca_pml_base_recv_request_t *request; - int rc; + bool matched; + int rc = OMPI_SUCCESS; - rc = OMPI_FREE_LIST_GET (&mca_ptl_elan_module.elan_recv_frags_free, - item, rc); + OMPI_FREE_LIST_GET (&mca_ptl_elan_module.elan_recv_frags_free, item, rc); while (OMPI_SUCCESS != rc) { @@ -208,8 +209,8 @@ mca_ptl_elan_data_frag (struct mca_ptl_elan_t *ptl, ompi_output (0, "[%s:%d] Retry to allocate a recv fragment", __FILE__, __LINE__); - rc = OMPI_FREE_LIST_GET (&mca_ptl_elan_module.elan_recv_frags_free, - item, rc); + OMPI_FREE_LIST_GET (&mca_ptl_elan_module.elan_recv_frags_free, + item, rc); } recv_frag = (mca_ptl_elan_recv_frag_t *) item; @@ -233,8 +234,7 @@ mca_ptl_elan_data_frag (struct mca_ptl_elan_t *ptl, /* Taking the data starting point be default */ recv_frag->frag_recv.frag_base.frag_addr = (char *) header + sizeof (mca_ptl_base_header_t); - recv_frag->frag_recv.frag_base.frag_size = - header->hdr_frag.hdr_frag_length; + recv_frag->frag_recv.frag_base.frag_size = header->hdr_frag.hdr_frag_length; /* match with preposted requests */ matched = mca_ptl_base_recv_frag_match ( @@ -294,7 +294,7 @@ mca_ptl_elan_drain_recv (mca_ptl_elan_module_1_0_0_t * emp) OMPI_LOCK (&queue->rx_lock); #if 1 - rc = (int *) (&rxq->qr_doneWord); + rc = (*(int *) (&rxq->qr_doneWord)); #else rc = elan4_pollevent_word (ctx, &rxq->qr_doneWord, 1); #endif @@ -402,7 +402,7 @@ mca_ptl_elan_update_send (mca_ptl_elan_module_1_0_0_t * emp) desc = (mca_ptl_elan_send_frag_t *) ompi_list_get_first (&queue->tx_desc); #if 1 - rc = (int *) (&desc->desc->main_doneWord); + rc = * ((int *) (&desc->desc->main_doneWord)); #else /* Poll the completion event for 1usec */ rc = elan4_pollevent_word(ctx, &desc->desc->main_doneWord, 1); @@ -414,14 +414,15 @@ mca_ptl_elan_update_send (mca_ptl_elan_module_1_0_0_t * emp) desc = (mca_ptl_elan_send_frag_t *) ompi_list_remove_first (&queue->tx_desc); req = desc->desc->req; - header = (mca_ptl_base_header_t *)&desc->desc->buff[0]; + header = (mca_ptl_base_header_t *)& + ((ompi_ptl_elan_qdma_desc_t *)desc->desc)->buff[0]; if(NULL == req) { /* An ack descriptor */ OMPI_FREE_LIST_RETURN (&queue->tx_desc_free, (ompi_list_item_t *) desc); } else if (0 == (header->hdr_common.hdr_flags & MCA_PTL_FLAGS_ACK_MATCHED) - || mca_pml_base_send_request_matched(request)) { + || mca_pml_base_send_request_matched(req)) { /* XXX: NO_NEED_FOR_MATCH || ALREADY_MATCHED */ if(fetchNset (&desc->frag_progressed, 1) == 0) {