From ecc3e00362097429f4b0637aac91d1da272704fe Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Sun, 12 Feb 2006 21:36:07 +0000 Subject: [PATCH] Various cleanups. This commit was SVN r9002. --- ompi/datatype/dt_pack.c | 6 +++--- ompi/mca/btl/mvapi/btl_mvapi_endpoint.c | 28 ++++++++++++------------- ompi/mca/pml/pml.h | 3 +-- opal/threads/condition.h | 6 +++++- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/ompi/datatype/dt_pack.c b/ompi/datatype/dt_pack.c index 06f963349c..9fafca16ec 100644 --- a/ompi/datatype/dt_pack.c +++ b/ompi/datatype/dt_pack.c @@ -784,7 +784,6 @@ ompi_convertor_prepare_for_send( ompi_convertor_t* convertor, convertor->flags |= CONVERTOR_SEND; convertor->memAlloc_fn = NULL; - convertor->memAlloc_userdata = NULL; /* Just to avoid complaint from the compiler */ convertor->fAdvance = ompi_convertor_pack_general; convertor->fAdvance = ompi_convertor_pack_homogeneous_with_memcpy; @@ -793,8 +792,9 @@ ompi_convertor_prepare_for_send( ompi_convertor_t* convertor, if( datatype->flags & DT_FLAG_CONTIGUOUS ) { assert( convertor->flags & DT_FLAG_CONTIGUOUS ); - if( ((datatype->ub - datatype->lb) == (long)datatype->size) - || (1 >= convertor->count) ) /* gaps or no gaps */ + if( ((datatype->ub - datatype->lb) == (long)datatype->size) ) + convertor->fAdvance = ompi_convertor_pack_no_conv_contig; + else if( 1 >= convertor->count ) /* gaps or no gaps */ convertor->fAdvance = ompi_convertor_pack_no_conv_contig; else convertor->fAdvance = ompi_convertor_pack_no_conv_contig_with_gaps; diff --git a/ompi/mca/btl/mvapi/btl_mvapi_endpoint.c b/ompi/mca/btl/mvapi/btl_mvapi_endpoint.c index a7f0fbaf04..fafe36dc4f 100644 --- a/ompi/mca/btl/mvapi/btl_mvapi_endpoint.c +++ b/ompi/mca/btl/mvapi/btl_mvapi_endpoint.c @@ -68,70 +68,68 @@ static inline int mca_btl_mvapi_endpoint_post_send( int ret; if(frag->base.des_flags & MCA_BTL_DES_FLAGS_PRIORITY && frag->size <= mvapi_btl->super.btl_eager_limit){ - - + /* check for a send wqe */ if (OPAL_THREAD_ADD32(&endpoint->sd_wqe_hp,-1) < 0) { - + OPAL_THREAD_ADD32(&endpoint->sd_wqe_hp,1); opal_list_append(&endpoint->pending_frags_hp, (opal_list_item_t *)frag); return OMPI_SUCCESS; - + /* check for a token */ } else if(!mca_btl_mvapi_component.use_srq && OPAL_THREAD_ADD32(&endpoint->sd_tokens_hp,-1) < 0) { - + OPAL_THREAD_ADD32(&endpoint->sd_wqe_hp,1); OPAL_THREAD_ADD32(&endpoint->sd_tokens_hp,1); opal_list_append(&endpoint->pending_frags_hp, (opal_list_item_t *)frag); return OMPI_SUCCESS; - + } else if( mca_btl_mvapi_component.use_srq && OPAL_THREAD_ADD32(&mvapi_btl->sd_tokens_hp,-1) < 0) { - + OPAL_THREAD_ADD32(&endpoint->sd_wqe_hp,1); OPAL_THREAD_ADD32(&mvapi_btl->sd_tokens_hp,1); OPAL_THREAD_LOCK(&mvapi_btl->ib_lock); opal_list_append(&mvapi_btl->pending_frags_hp, (opal_list_item_t *)frag); OPAL_THREAD_UNLOCK(&mvapi_btl->ib_lock); return OMPI_SUCCESS; - + /* queue the request */ } else { frag->hdr->credits = (endpoint->rd_credits_hp > 0) ? endpoint->rd_credits_hp : 0; OPAL_THREAD_ADD32(&endpoint->rd_credits_hp, -frag->hdr->credits); qp_hndl = endpoint->lcl_qp_hndl_hp; } - } else { /* check for a send wqe */ if (OPAL_THREAD_ADD32(&endpoint->sd_wqe_lp,-1) < 0) { - + OPAL_THREAD_ADD32(&endpoint->sd_wqe_lp,1); opal_list_append(&endpoint->pending_frags_lp, (opal_list_item_t *)frag); return OMPI_SUCCESS; - + /* check for a token */ } else if(!mca_btl_mvapi_component.use_srq && OPAL_THREAD_ADD32(&endpoint->sd_tokens_lp,-1) < 0 ) { - + OPAL_THREAD_ADD32(&endpoint->sd_wqe_lp,1); OPAL_THREAD_ADD32(&endpoint->sd_tokens_lp,1); opal_list_append(&endpoint->pending_frags_lp, (opal_list_item_t *)frag); return OMPI_SUCCESS; - + } else if(mca_btl_mvapi_component.use_srq && OPAL_THREAD_ADD32(&mvapi_btl->sd_tokens_lp,-1) < 0) { - + OPAL_THREAD_ADD32(&endpoint->sd_wqe_lp,1); OPAL_THREAD_ADD32(&mvapi_btl->sd_tokens_lp,1); OPAL_THREAD_LOCK(&mvapi_btl->ib_lock); opal_list_append(&mvapi_btl->pending_frags_lp, (opal_list_item_t *)frag); OPAL_THREAD_UNLOCK(&mvapi_btl->ib_lock); return OMPI_SUCCESS; - + /* queue the request */ } else { frag->hdr->credits = (endpoint->rd_credits_lp > 0) ? endpoint->rd_credits_lp : 0; diff --git a/ompi/mca/pml/pml.h b/ompi/mca/pml/pml.h index 870e653d79..a5bc14ba8d 100644 --- a/ompi/mca/pml/pml.h +++ b/ompi/mca/pml/pml.h @@ -81,8 +81,7 @@ struct mca_pml_proc_t { opal_mutex_t proc_lock; /**< lock to protect against concurrent access */ int proc_flags; /**< prefered method of accessing this peer */ }; - - typedef struct mca_pml_proc_t mca_pml_proc_t; +typedef struct mca_pml_proc_t mca_pml_proc_t; typedef enum { MCA_PML_BASE_SEND_STANDARD, diff --git a/opal/threads/condition.h b/opal/threads/condition.h index 5d06bb2d9a..1609c1091e 100644 --- a/opal/threads/condition.h +++ b/opal/threads/condition.h @@ -138,7 +138,11 @@ static inline int opal_condition_broadcast(opal_condition_t *c) c->c_signaled += c->c_waiting; #if OMPI_HAVE_POSIX_THREADS && OMPI_ENABLE_PROGRESS_THREADS if(opal_using_threads()) { - pthread_cond_broadcast(&c->c_cond); + if( 1 == c->c_waiting ) { + pthread_cond_signal(&c->c_cond); + } else { + pthread_cond_broadcast(&c->c_cond); + } } #endif return 0;