FYI -- here's a patch for Open IB from Roland. Tim/Galen -- can you guys review and commit?

Thanks!

Begin forwarded message:

From: Roland Dreier <rdre...@cisco.com>
Date: December 15, 2005 6:27:22 PM EST
To: Jeff Squyres <jsquy...@open-mpi.org>, de...@open-mpi.org
Subject: [PATCH] Update ompi to new OpenIB libibverbs API

The libibverbs code in OpenIB svn (which will be 1.0-rc5 shortly) has
changed the interface for getting a list of the IB devices that are
available.  The following patch makes Open MPI work with both the old
and new interface.

Sorry for the breakage but we were really forced into this change for
thread-safety and hotplug handling reasons.  I consider the libibverbs
API semi-frozen now -- there should only be additions that don't
affect consumers before the release of libibverbs 1.0 with a stable
API.

Signed-off-by: Roland Dreier <rola...@cisco.com>

--- ompi/mca/btl/openib/btl_openib_component.c  (revision 8520)
+++ ompi/mca/btl/openib/btl_openib_component.c  (working copy)
@@ -304,6 +304,7 @@ mca_btl_base_module_t** mca_btl_openib_c
     num_devs = 0;


+#ifndef OMPI_MCA_BTL_OPENIB_HAVE_DEVICE_LIST
     /* Determine the number of hca's available on the host */
     dev_list = ibv_get_devices();
     if (NULL == dev_list) {
@@ -316,6 +317,9 @@ mca_btl_base_module_t** mca_btl_openib_c

     dlist_for_each_data(dev_list, ib_dev, struct ibv_device)
         num_devs++;
+#else
+    ib_devs = ibv_get_device_list(&num_devs);
+#endif

     if(0 == num_devs) {
         mca_btl_base_error_no_nics("OpenIB", "HCA");
@@ -324,6 +328,7 @@ mca_btl_base_module_t** mca_btl_openib_c
     }


+#ifndef OMPI_MCA_BTL_OPENIB_HAVE_DEVICE_LIST
     /* Allocate space for the ib devices */
ib_devs = (struct ibv_device**) malloc(num_devs * sizeof (struct ibv_dev*));
         if(NULL == ib_devs) {
@@ -336,7 +341,7 @@ mca_btl_base_module_t** mca_btl_openib_c
     i = 0;
     dlist_for_each_data(dev_list, ib_dev, struct ibv_device)
         ib_devs[i++] =  ib_dev;
-
+#endif

     /** We must loop through all the hca id's, get there handles and
for each hca we query the number of ports on the hca and set up
@@ -447,7 +452,11 @@ mca_btl_base_module_t** mca_btl_openib_c
         OBJ_CONSTRUCT(&openib_btl->recv_free_max, ompi_free_list_t);

         if(mca_btl_openib_module_init(openib_btl) != OMPI_SUCCESS) {
+#ifdef OMPI_MCA_BTL_OPENIB_HAVE_DEVICE_LIST
+           ibv_free_device_list(ib_devs);
+#else
             free(ib_devs);
+#endif
             return NULL;
         }

@@ -540,7 +549,11 @@ mca_btl_base_module_t** mca_btl_openib_c
     mca_btl_openib_modex_send();

     *num_btl_modules = mca_btl_openib_component.ib_num_btls;
+#ifdef OMPI_MCA_BTL_OPENIB_HAVE_DEVICE_LIST
+    ibv_free_device_list(ib_devs);
+#else
     free(ib_devs);
+#endif
     return btls;
 }

Index: config/ompi_check_openib.m4
===================================================================
--- config/ompi_check_openib.m4 (revision 8520)
+++ config/ompi_check_openib.m4 (working copy)
@@ -122,6 +122,13 @@ AC_DEFUN([OMPI_CHECK_OPENIB],[
                        [$ompi_check_openib_have_srq],
[Whether install of OpenIB includes shared receive queue support])

+    AC_CHECK_FUNCS([ibv_get_device_list],
+                   [ompi_check_openib_have_device_list=1],
+                   [ompi_check_openib_have_device_list=0])
+ AC_DEFINE_UNQUOTED([OMPI_MCA_]m4_translit([$1], [a-z], [A-Z]) [_HAVE_DEVICE_LIST],
+                       [$ompi_check_openib_have_device_list],
+ [Whether install of OpenIB includes ibv_get_device_list API])
+
     CPPFLAGS="$ompi_check_openib_$1_save_CPPFLAGS"
     LDFLAGS="$ompi_check_openib_$1_save_LDFLAGS"
     LIBS="$ompi_check_openib_$1_save_LIBS"


--
{+} Jeff Squyres
{+} The Open MPI Project
{+} http://www.open-mpi.org/



Reply via email to