From 8bdd334d95bafb2b4291eb61429fac6bf9552610 Mon Sep 17 00:00:00 2001 From: Avneesh Pant Date: Thu, 14 Jan 2010 19:39:35 +0000 Subject: [PATCH] Allow the PSM component to return ERR_NOT_AVAIL so it can be unloaded silently if executed on a node with no QLogic IB hardware. Also minor modifications to have the CM PML allow itself to be unloaded if no MTL components are available. The component selection logic can then continue to use other PMLs. This commit was SVN r22410. --- ompi/mca/mtl/psm/mtl_psm_component.c | 14 +++++++++++++- ompi/mca/pml/cm/pml_cm_component.c | 14 +++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/ompi/mca/mtl/psm/mtl_psm_component.c b/ompi/mca/mtl/psm/mtl_psm_component.c index 5e8650b4d8..1fffbf8ca7 100644 --- a/ompi/mca/mtl/psm/mtl_psm_component.c +++ b/ompi/mca/mtl/psm/mtl_psm_component.c @@ -31,6 +31,10 @@ #include "psm.h" +#include +#include +#include + static int ompi_mtl_psm_component_open(void); static int ompi_mtl_psm_component_close(void); static int ompi_mtl_psm_component_register(void); @@ -152,7 +156,15 @@ ompi_mtl_psm_component_register(void) static int ompi_mtl_psm_component_open(void) { - return OMPI_SUCCESS; + struct stat st; + + /* Component available only if Truescale hardware is present */ + if (0 == stat("/dev/ipath", &st)) { + return OMPI_SUCCESS; + } + else { + return OPAL_ERR_NOT_AVAILABLE; + } } static int diff --git a/ompi/mca/pml/cm/pml_cm_component.c b/ompi/mca/pml/cm/pml_cm_component.c index 99532895f8..3fbec290c3 100644 --- a/ompi/mca/pml/cm/pml_cm_component.c +++ b/ompi/mca/pml/cm/pml_cm_component.c @@ -115,9 +115,17 @@ mca_pml_cm_component_register(void) static int mca_pml_cm_component_open(void) { - /* Avneesh -- might want to check the return code here with - respect to r22391 (i.e., OPAL_ERR_NOT_AVAILABLE issues) */ - return ompi_mtl_base_open(); + int ret; + + ret = ompi_mtl_base_open(); + if (OMPI_SUCCESS == ret) { + /* If no MTL components initialized CM component can be unloaded */ + if (0 == opal_list_get_size(&ompi_mtl_base_components_opened)) { + ret = OPAL_ERR_NOT_AVAILABLE; + } + } + + return ret; }