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; }