From 418d184c454b98d848a5ca7e316c86a0a1000ecc Mon Sep 17 00:00:00 2001 From: Rich Graham Date: Fri, 28 Jan 2005 20:09:39 +0000 Subject: [PATCH] starting to correct the logic for IB device selection. This commit was SVN r4217. --- src/mca/ptl/ib/src/ptl_ib_component.c | 36 ++++++++++++++------------- src/mca/ptl/ib/src/ptl_ib_priv.c | 15 ----------- 2 files changed, 19 insertions(+), 32 deletions(-) diff --git a/src/mca/ptl/ib/src/ptl_ib_component.c b/src/mca/ptl/ib/src/ptl_ib_component.c index 3fcf335e64..326601b009 100644 --- a/src/mca/ptl/ib/src/ptl_ib_component.c +++ b/src/mca/ptl/ib/src/ptl_ib_component.c @@ -14,6 +14,8 @@ * $HEADER$ */ +#include + /* Open MPI includes */ #include "ompi_config.h" #include "include/constants.h" @@ -164,12 +166,14 @@ mca_ptl_base_module_t** mca_ptl_ib_component_init(int *num_ptl_modules, bool *have_hidden_threads) { mca_ptl_base_module_t **modules; + VAPI_ret_t vapi_ret; int i, ret; - uint32_t num_hcas; mca_ptl_ib_module_t* ib_modules = NULL; - *num_ptl_modules = 0; + /* initialization */ + *num_ptl_modules = 0; + mca_ptl_ib_component.ib_num_hcas=0; *allow_multi_user_threads = true; *have_hidden_threads = OMPI_HAVE_THREADS; @@ -179,12 +183,6 @@ mca_ptl_base_module_t** mca_ptl_ib_component_init(int *num_ptl_modules, ompi_set_using_threads(true); } - if((ret = ompi_event_init()) != OMPI_SUCCESS) { - ompi_output(0, "mca_ptl_ib_component_init: " - "unable to initialize event dispatch thread: %d\n", ret); - return NULL; - } - /* Initialize Receive fragments */ ompi_free_list_init (&(mca_ptl_ib_component.ib_recv_frags), sizeof (mca_ptl_ib_recv_frag_t), @@ -194,17 +192,21 @@ mca_ptl_base_module_t** mca_ptl_ib_component_init(int *num_ptl_modules, mca_ptl_ib_component.ib_free_list_inc, NULL); - ret = mca_ptl_ib_get_num_hcas(&num_hcas); - - if ((0 == num_hcas) || (OMPI_SUCCESS != ret)) { + /* figure out how many HCA's are available for use - don't allocate + * any resrouces at this stage. */ + vapi_ret=EVAPI_list_hcas(0,&(mca_ptl_ib_component.ib_num_hcas), + NULL); + if( HH_EAGAIN != vapi_ret ) { + ompi_output(0, "mca_ptl_ib_component_init: " + "Unexpect return from EVAPI_list_hcas - %s\n", + VAPI_strerror(vapi_ret)); + return NULL; + } + if( 0 == mca_ptl_ib_component.ib_num_hcas ) { + ompi_output(0,"Warniing :: mca_ptl_ib_component_init: " + " No IB devices found \n"); return NULL; } - - /* HACK: To avoid confusion, right now open only - * one IB PTL */ - - /*mca_ptl_ib_component.ib_num_hcas = num_hcas;*/ - mca_ptl_ib_component.ib_num_hcas = 1; /* Number of InfiniBand PTLs is equal to * number of physical HCAs. Is this always the diff --git a/src/mca/ptl/ib/src/ptl_ib_priv.c b/src/mca/ptl/ib/src/ptl_ib_priv.c index b307571fca..f9bd2cd4b3 100644 --- a/src/mca/ptl/ib/src/ptl_ib_priv.c +++ b/src/mca/ptl/ib/src/ptl_ib_priv.c @@ -383,21 +383,6 @@ static int mca_ptl_ib_rc_qp_init(VAPI_hca_hndl_t nic, return OMPI_SUCCESS; } -int mca_ptl_ib_get_num_hcas(uint32_t* num_hcas) -{ - VAPI_ret_t ret; - - /* List all HCAs */ - ret = EVAPI_list_hcas(0, num_hcas, NULL); - - if( (VAPI_OK != ret) && (VAPI_EAGAIN != ret)) { - MCA_PTL_IB_VAPI_RET(ret, "EVAPI_list_hcas"); - return OMPI_ERROR; - } - - return OMPI_SUCCESS; -} - int mca_ptl_ib_register_mem(VAPI_hca_hndl_t nic, VAPI_pd_hndl_t ptag, void* buf, int len, vapi_memhandle_t* memhandle) {