3cc8b0461a
* Moved "check basics" sanity check from openib BTL to common/verbs (which also allows us to have openib ''not'' include <infiniband/driver.h>, which is a Very Good Thing) * Add new ompi_common_verbs_qp_test() function, which tests to see whether a device supports RC and/or UD QPs. The openib BTL now uses this function to ensure that the device supports RC QPs. * Rename ompi_common_verbs_find_ibv_ports() to be ompi_common_verbs_find_ports() -- the "ibv" was redundant. * Re-work ompi_common_verbs_find_ports() to use ompi_common_verbs_qp_test() instead of testing for RC/UD QPs itself * Add bunches of opal_output_verbose() to the find_ports() routine (to help diagnosing connectivity problems -- imaging running with --mca btl_base_verbose 10; you'll see all the find_ports() test results) * Make ompi_common_verbs_qp_test() warn if devices/ports are supplied in the if_include/if_exclude strings that do not exists (quite similar to what the openib BTL does today). * Add ompi_common_verbs_mca_register() function, which registers common verbs MCA params. It will also register MCA param synonyms for thse MCA params to upper-level components (e.g., btl_<upper-level-component>_<the-mca-param>). * common_verbs_warn_nonexistent_if: warn if if_include/if_exclude-specified devices or ports do not exist. This commit was SVN r27332.
66 строки
1.4 KiB
C
66 строки
1.4 KiB
C
/*
|
|
* Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
|
|
*
|
|
* $COPYRIGHT$
|
|
*
|
|
* Additional copyrights may follow
|
|
*
|
|
* $HEADER$
|
|
*/
|
|
|
|
#include "ompi_config.h"
|
|
|
|
#include <stdio.h>
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
#include <sys/types.h>
|
|
#endif
|
|
#ifdef HAVE_SYS_STAT_H
|
|
#include <sys/stat.h>
|
|
#endif
|
|
#ifdef HAVE_UNISTD_H
|
|
#include <unistd.h>
|
|
#endif
|
|
|
|
/* This is crummy, but <infiniband/driver.h> doesn't work on all
|
|
platforms with all compilers. Specifically, trying to include it
|
|
on RHEL4U3 with the PGI 32 bit compiler will cause problems because
|
|
certain 64 bit types are not defined. Per advice from Roland D.,
|
|
just include the one prototype that we need in this case
|
|
(ibv_get_sysfs_path()). */
|
|
#include <infiniband/verbs.h>
|
|
#ifdef HAVE_INFINIBAND_DRIVER_H
|
|
#include <infiniband/driver.h>
|
|
#else
|
|
const char *ibv_get_sysfs_path(void);
|
|
#endif
|
|
|
|
#include "ompi/constants.h"
|
|
|
|
#include "common_verbs.h"
|
|
|
|
/***********************************************************************/
|
|
|
|
bool ompi_common_verbs_check_basics(void)
|
|
{
|
|
#if defined(__linux__)
|
|
int rc;
|
|
char *file;
|
|
struct stat s;
|
|
|
|
/* Check to see if $sysfsdir/class/infiniband/ exists */
|
|
asprintf(&file, "%s/class/infiniband", ibv_get_sysfs_path());
|
|
if (NULL == file) {
|
|
return false;
|
|
}
|
|
rc = stat(file, &s);
|
|
free(file);
|
|
if (0 != rc || !S_ISDIR(s.st_mode)) {
|
|
return false;
|
|
}
|
|
#endif
|
|
|
|
/* It exists and is a directory -- good enough */
|
|
return true;
|
|
}
|
|
|