Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 31 additions & 8 deletions opal/mca/common/verbs/common_verbs_basics.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif

/* This is crummy, but <infiniband/driver.h> doesn't work on all
platforms with all compilers. Specifically, trying to include it
Expand All @@ -43,25 +46,45 @@ const char *ibv_get_sysfs_path(void);

bool opal_common_verbs_check_basics(void)
{
bool ret = false;
char *file = NULL;
#if defined(__linux__)
int rc;
char *file;
int rc, ndevs = -2; /* for . and .. */
struct stat s;
struct dirent *dp;
DIR *dir = NULL;

/* Check to see if $sysfsdir/class/infiniband/ exists */
asprintf(&file, "%s/class/infiniband", ibv_get_sysfs_path());
if (NULL == file) {
return false;
goto fn_exit;
}

/* okay, let's see if here are actually devices there or
* are we just being faked out */

rc = stat(file, &s);
free(file);
if (0 != rc || !S_ISDIR(s.st_mode)) {
return false;
if (0 != rc) {
goto fn_exit;
}

if (S_ISDIR(s.st_mode)) {
dir = opendir(file);
if (NULL != dir) {
while ((dp = readdir(dir)) != NULL) ndevs++;
closedir(dir);
}
ret = (0 < ndevs) ? true : false;
} else {
ret = false;
}

#endif
fn_exit:
if (NULL != file)
free(file);

/* It exists and is a directory -- good enough */
return true;
return ret;
}

int opal_common_verbs_fork_test(void)
Expand Down
18 changes: 14 additions & 4 deletions orte/mca/oob/ud/oob_ud_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,25 @@ static int mca_oob_ud_component_register (void)
}

static int mca_oob_ud_component_available(void) {
int ret;

opal_output_verbose(5, orte_oob_base_framework.framework_output,
"oob:ud: component_available called");

/* set the module event base - this is where we would spin off a separate
* progress thread if so desired */
mca_oob_ud_module.ev_base = orte_event_base;
/*
* check if we actually have HCAs on this node,
* if not, no way we can use ud.
*/
if (opal_common_verbs_check_basics()) {
/* set the module event base - this is where we would spin off a separate
* progress thread if so desired */
mca_oob_ud_module.ev_base = orte_event_base;
ret = ORTE_SUCCESS;
} else {
ret = ORTE_ERR_NOT_AVAILABLE;
}

return ORTE_SUCCESS;
return ret;
}

static int port_mtus[] = {0, 256, 512, 1024, 2048, 4096};
Expand Down