It turns out that we can't always include the hwloc OpenFabrics verbs
helper file, even if we find that the system has <infiniband/verbs.h>. The reason is because there are some inline functions in that verbs helper file that invoke ibv_* functions. Some linkers (e.g., Solaris Studio Compilers) will instantiate those static inline functions -- even if we don't use them -- and therefore we need to be able to resolve the ibv_* symbols at link time. But since -libverbs is only specified in places where we use other ibv_* functions (e.g., the OpenFabrics-based BTLs), that means that linking random executables can/will fail (e.g., orterun). So instead, introduce a new #define: OPAL_HWLOC_WANT_VERBS_HELPER. If this macro is set to 1 before including opal/mca/hwloc/hwloc.h, then you'll also get the hwloc OpenFabrics verbs helper header file (*if* hwloc found <infiniband/verbs.h> -- otherwise, it'll #error). This commit was SVN r26417.
Этот коммит содержится в:
родитель
640f0610aa
Коммит
de4bbacd13
@ -60,6 +60,12 @@ const char *ibv_get_sysfs_path(void);
|
|||||||
#include "opal/util/argv.h"
|
#include "opal/util/argv.h"
|
||||||
#include "opal/memoryhooks/memory.h"
|
#include "opal/memoryhooks/memory.h"
|
||||||
#include "opal/mca/base/mca_base_param.h"
|
#include "opal/mca/base/mca_base_param.h"
|
||||||
|
/* Define this before including hwloc.h so that we also get the hwloc
|
||||||
|
verbs helper header file, too. We have to do this level of
|
||||||
|
indirection because the hwloc subsystem is a component -- we don't
|
||||||
|
know its exact path. We have to rely on the framework header files
|
||||||
|
to find the right hwloc verbs helper file for us. */
|
||||||
|
#define OPAL_HWLOC_WANT_VERBS_HELPER 1
|
||||||
#include "opal/mca/hwloc/hwloc.h"
|
#include "opal/mca/hwloc/hwloc.h"
|
||||||
#include "opal/mca/hwloc/base/base.h"
|
#include "opal/mca/hwloc/base/base.h"
|
||||||
#include "opal/mca/installdirs/installdirs.h"
|
#include "opal/mca/installdirs/installdirs.h"
|
||||||
|
@ -19,10 +19,24 @@ BEGIN_C_DECLS
|
|||||||
|
|
||||||
#include "hwloc/include/hwloc.h"
|
#include "hwloc/include/hwloc.h"
|
||||||
|
|
||||||
/* If we have verbs.h, then include the hwloc openfabrics helpers
|
/* If the including file requested it, also include the hwloc verbs
|
||||||
header file */
|
helper file. We can't just always include this file (even if we
|
||||||
|
know we have <infiniband/verbs.h>) because there are some inline
|
||||||
|
functions in that file that invoke ibv_* functions. Some linkers
|
||||||
|
(e.g., Solaris Studio Compilers) will instantiate those static
|
||||||
|
inline functions even if we don't use them, and therefore we need
|
||||||
|
to be able to resolve the ibv_* symbols at link time.
|
||||||
|
|
||||||
|
Since -libverbs is only specified in places where we use other
|
||||||
|
ibv_* functions (e.g., the OpenFabrics-based BTLs), that means that
|
||||||
|
linking random executables can/will fail (e.g., orterun).
|
||||||
|
*/
|
||||||
|
#if defined(OPAL_HWLOC_WANT_VERBS_HELPER) && OPAL_HWLOC_WANT_VERBS_HELPER
|
||||||
# if defined(HAVE_INFINIBAND_VERBS_H)
|
# if defined(HAVE_INFINIBAND_VERBS_H)
|
||||||
# include "hwloc/include/hwloc/openfabrics-verbs.h"
|
# include "hwloc/include/hwloc/openfabrics-verbs.h"
|
||||||
|
# else
|
||||||
|
# error Tried to include hwloc verbs helper file, but hwloc was compiled with no OpenFabrics support
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
END_C_DECLS
|
END_C_DECLS
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user