From 6f6fdec3fb4cb87c7dc616859c73e32552dc176b Mon Sep 17 00:00:00 2001 From: Tim Woodall Date: Fri, 1 Jul 2005 22:24:58 +0000 Subject: [PATCH] cleanup in progress This commit was SVN r6261. --- src/mca/btl/gm/btl_gm.c | 8 ++++++-- src/mca/btl/gm/btl_gm_component.c | 33 ++++++++++++++++++++++++------- src/mca/btl/gm/btl_gm_proc.c | 2 +- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/mca/btl/gm/btl_gm.c b/src/mca/btl/gm/btl_gm.c index 5f5055c5aa..e069f723a8 100644 --- a/src/mca/btl/gm/btl_gm.c +++ b/src/mca/btl/gm/btl_gm.c @@ -156,7 +156,7 @@ mca_btl_base_descriptor_t* mca_btl_gm_alloc( mca_btl_gm_frag_t* frag; int rc; - if(size <= btl->btl_eager_limit){ + if(size <= btl->btl_eager_limit) { MCA_BTL_GM_FRAG_ALLOC_EAGER(gm_btl, frag, rc); frag->segment.seg_len = size <= btl->btl_eager_limit ? @@ -168,8 +168,12 @@ mca_btl_base_descriptor_t* mca_btl_gm_alloc( size : btl->btl_max_send_size ; } + frag->base.des_src = &frag->segment; + frag->base.des_src_cnt = 1; + frag->base.des_dst = NULL; + frag->base.des_dst_cnt = 0; frag->base.des_flags = 0; - return (mca_btl_base_descriptor_t*)frag; + return &frag->base; } diff --git a/src/mca/btl/gm/btl_gm_component.c b/src/mca/btl/gm/btl_gm_component.c index f32beee7ab..a5fd289458 100644 --- a/src/mca/btl/gm/btl_gm_component.c +++ b/src/mca/btl/gm/btl_gm_component.c @@ -105,6 +105,7 @@ int mca_btl_gm_component_open(void) /* initialize state */ mca_btl_gm_component.gm_num_btls=0; mca_btl_gm_component.gm_btls=NULL; + mca_btl_gm_component.gm_port_name=NULL; /* initialize objects */ OBJ_CONSTRUCT(&mca_btl_gm_component.gm_procs, ompi_list_t); @@ -119,6 +120,14 @@ int mca_btl_gm_component_open(void) mca_btl_gm_param_register_int ("free_list_inc", 32); mca_btl_gm_component.gm_mpool_name = mca_btl_gm_param_register_string("mpool", "gm"); + mca_btl_gm_component.gm_max_ports = + mca_btl_gm_param_register_int("max_ports", 16); + mca_btl_gm_component.gm_max_boards = + mca_btl_gm_param_register_int("max_boards", 4); + mca_btl_gm_component.gm_max_btls = + mca_btl_gm_param_register_int("max_modules", 4); + mca_btl_gm_component.gm_num_high_priority = + mca_btl_gm_param_register_int("num_high_priority", 8); /* register gm module parameters */ mca_btl_gm_module.super.btl_exclusivity = @@ -162,6 +171,7 @@ static int mca_btl_gm_module_init (mca_btl_gm_module_t * btl) { mca_mpool_base_resources_t resources; + size_t num_high_priority; size_t i; int rc; @@ -177,6 +187,13 @@ mca_btl_gm_module_init (mca_btl_gm_module_t * btl) btl->gm_max_send_tokens = btl->gm_num_send_tokens; btl->gm_num_recv_tokens = gm_num_receive_tokens (btl->gm_port); btl->gm_max_recv_tokens = btl->gm_num_recv_tokens; + + /* dont allow high priority to exceed 1/2 of available send tokens */ + + num_high_priority = mca_btl_gm_component.gm_num_high_priority; + if(num_high_priority > (btl->gm_num_send_tokens >> 1)) { + num_high_priority = btl->gm_num_send_tokens >> 1; + } /* initialize memory pool */ resources.gm_port = btl->gm_port; @@ -215,7 +232,7 @@ mca_btl_gm_module_init (mca_btl_gm_module_t * btl) btl->gm_mpool ); /* post receive buffers */ - for(i=0; igm_port = gm_port; @@ -319,7 +336,7 @@ static int mca_btl_gm_discover( void ) } /* everything is OK let's mark it as usable and go to the next one */ - mca_btl_gm_component.gm_btls[mca_btl_gm_component.gm_num_btls++]; + mca_btl_gm_component.gm_btls[mca_btl_gm_component.gm_num_btls++] = btl; if(mca_btl_gm_component.gm_num_btls >= mca_btl_gm_component.gm_max_btls ) { break; } @@ -384,12 +401,13 @@ mca_btl_gm_component_init (int *num_btl_modules, return NULL; } - mca_btl_gm_component.gm_num_btls = mca_btl_gm_discover( ); - /* initialize gm */ if (OMPI_SUCCESS != mca_btl_gm_discover()) { return NULL; } + if (mca_btl_gm_component.gm_num_btls == 0) { + return NULL; + } /* publish GM parameters with the MCA framework */ if (OMPI_SUCCESS != mca_btl_gm_modex_send()) { @@ -440,6 +458,7 @@ int mca_btl_gm_component_progress() hdr = (mca_btl_base_header_t *)gm_ntohp(event->recv.message); reg = &btl->gm_reg[hdr->tag]; reg->cbfunc(&btl->super, hdr->tag, &frag->base, reg->cbdata); + gm_provide_receive_buffer(btl->gm_port, buffer, frag->size, priority); count++; break; } @@ -453,6 +472,7 @@ int mca_btl_gm_component_progress() hdr = (mca_btl_base_header_t*)buffer; reg = &btl->gm_reg[hdr->tag]; reg->cbfunc(&btl->super, hdr->tag, &frag->base, reg->cbdata); + gm_provide_receive_buffer(btl->gm_port, buffer, frag->size, priority); count++; break; } @@ -463,7 +483,6 @@ int mca_btl_gm_component_progress() gm_unknown(btl->gm_port, event); break; } - gm_provide_receive_buffer(btl->gm_port, buffer, frag->size, priority); } return count; } diff --git a/src/mca/btl/gm/btl_gm_proc.c b/src/mca/btl/gm/btl_gm_proc.c index 3319dc87fa..d43afdf7a5 100644 --- a/src/mca/btl/gm/btl_gm_proc.c +++ b/src/mca/btl/gm/btl_gm_proc.c @@ -156,7 +156,7 @@ int mca_btl_gm_proc_insert(mca_btl_gm_proc_t* gm_proc, mca_btl_base_endpoint_t* gm_endpoint) { /* insert into endpoint array */ - if(gm_proc->proc_addr_count >= gm_proc->proc_endpoint_count) + if(gm_proc->proc_addr_count <= gm_proc->proc_endpoint_count) return OMPI_ERR_OUT_OF_RESOURCE; gm_endpoint->endpoint_proc = gm_proc; gm_endpoint->endpoint_addr = gm_proc->proc_addrs[gm_proc->proc_endpoint_count];