Le 20/03/2012 20:30, Jeffrey Squyres a écrit : > On Mar 20, 2012, at 3:29 PM, Brice Goglin wrote: > >> By the way, do you want Port numbers to start at 0 or 1? > > IIRC, IB (and probably RoCE) port numbers start with 1. Shrug. > > So let's report whatever they report. > > The sample output you showed looks perfect to me. > > Is your patch small enough to port back to the v1.3 branch, perchance? Or > should I update OMPI SVN trunk with our next v1.4 release?
Yeah the patch (attached) is very simple and applies to v1.3 without any problem. Note that it also adds port numbers to non-IB/OFED devices. When I switch a ConnectX board to ethernet, I get: PCI 15b3:634a (P#49152 busid=0000:0c:00.0 class=0c06(IB) PCIVendor="Mellanox Technologies" PCIDevice="MT25418 [ConnectX VPI PCIe 2.0 2.5GT/s - IB DDR / 10GigE]") "Mellanox Technologies MT25418 [ConnectX VPI PCIe 2.0 2.5GT/s - IB DDR / 10GigE]" Net L#3 (Address=00:00:00:11:11:11 Port=1) "eth3" Net L#4 (Address=00:00:00:11:11:12 Port=2) "eth4" That looks good to me, as long as starting port numbers to 1 for non-IB/OFED is OK. Brice
Index: src/topology-libpci.c =================================================================== --- src/topology-libpci.c (révision 4414) +++ src/topology-libpci.c (copie de travail) @@ -136,6 +136,22 @@ } fclose(fd); } + snprintf(path, sizeof(path), "%s/dev_id", osdevpath); + fd = fopen(path, "r"); + if (fd) { + char hexid[16]; + if (fgets(hexid, sizeof(hexid), fd)) { + char *eoid; + unsigned long port; + port = strtoul(hexid, &eoid, 0); + if (eoid != hexid) { + char portstr[16]; + snprintf(portstr, sizeof(portstr), "%ld", port+1); + hwloc_obj_add_info(obj, "Port", portstr); + } + } + fclose(fd); + } } static void hwloc_linux_lookup_net_class(struct hwloc_topology *topology, struct hwloc_obj *pcidev, const char *pcidevpath)