unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 66573@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#66573] [PATCH v2.1 06/11] gnu: ucx: Update to 1.15.0.
Date: Tue, 24 Oct 2023 11:58:01 +0200	[thread overview]
Message-ID: <d1abd6c1a129845eb9db7606e820208be8f5fcd9.1698141437.git.ludo@gnu.org> (raw)
In-Reply-To: <acd2f365ecc38a3e0500a9ab03dccc97c5ecb586.1698141437.git.ludo@gnu.org>

* gnu/packages/fabric-management.scm (ucx): Update to 1.15.0.
* gnu/packages/patches/ucx-tcp-iface-ioctl.patch: Update for 1.15.0.
---
 gnu/packages/fabric-management.scm            |   4 +-
 .../patches/ucx-tcp-iface-ioctl.patch         | 105 +++++++++++-------
 2 files changed, 64 insertions(+), 45 deletions(-)

diff --git a/gnu/packages/fabric-management.scm b/gnu/packages/fabric-management.scm
index ccdaa0ee0a..f41b4e99ed 100644
--- a/gnu/packages/fabric-management.scm
+++ b/gnu/packages/fabric-management.scm
@@ -185,7 +185,7 @@ (define-public ibutils
 (define-public ucx
   (package
     (name "ucx")
-    (version "1.14.0")
+    (version "1.15.0")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -195,7 +195,7 @@ (define-public ucx
               (patches (search-patches "ucx-tcp-iface-ioctl.patch"))
               (sha256
                (base32
-                "0ki2r768wqm92qv06wxrh3kv2nl2yj4ds9fz0s0b5rr2ycjiw9ir"))))
+                "1mk46vyfp8hsivk88s8gv0nf458jfs59fczpf66wwa3a9yp324jp"))))
     (build-system gnu-build-system)
     (arguments
      (list
diff --git a/gnu/packages/patches/ucx-tcp-iface-ioctl.patch b/gnu/packages/patches/ucx-tcp-iface-ioctl.patch
index c441a0861a..2a0e4ce138 100644
--- a/gnu/packages/patches/ucx-tcp-iface-ioctl.patch
+++ b/gnu/packages/patches/ucx-tcp-iface-ioctl.patch
@@ -3,102 +3,121 @@ TCP network interfaces cannot be obtained via /sys/class/net.  This patch
 provides alternative code that uses the SIOCGIFCONF ioctl to get the
 names of the available TCP network interfaces.
 
+Initially submitted at <https://github.com/openucx/ucx/pull/4462>.
+
 diff --git a/src/uct/tcp/tcp_iface.c b/src/uct/tcp/tcp_iface.c
-index cad4a2709..7c1d2c9de 100644
+index 6a6cd34fa..af32bb2e9 100644
 --- a/src/uct/tcp/tcp_iface.c
 +++ b/src/uct/tcp/tcp_iface.c
-@@ -17,6 +17,8 @@
- #include <sys/poll.h>
+@@ -18,6 +18,8 @@
  #include <netinet/tcp.h>
  #include <dirent.h>
+ #include <float.h>
 +#include <net/if.h>
 +#include <sys/ioctl.h>
  
+ #define UCT_TCP_IFACE_NETDEV_DIR "/sys/class/net"
  
- extern ucs_class_t UCS_CLASS_DECL_NAME(uct_tcp_iface_t);
-@@ -586,6 +588,68 @@ static UCS_CLASS_DEFINE_NEW_FUNC(uct_tcp_iface_t, uct_iface_t, uct_md_h,
+@@ -875,6 +877,85 @@ static UCS_CLASS_DEFINE_NEW_FUNC(uct_tcp_iface_t, uct_iface_t, uct_md_h,
                                   uct_worker_h, const uct_iface_params_t*,
                                   const uct_iface_config_t*);
  
 +/* Fetch information about available network devices through an ioctl.  */
-+static ucs_status_t query_devices_ioctl(uct_md_h md,
-+					uct_tl_device_resource_t **tl_devices_p,
-+					unsigned *num_tl_devices_p)
++static ucs_status_t uct_tcp_query_devices_ioctl(uct_md_h md,
++                                                uct_tl_device_resource_t **devices_p,
++                                                unsigned *num_devices_p)
 +{
 +    int sock, err, i;
-+    uct_tl_device_resource_t *resources, *tmp;
-+    unsigned num_resources;
++    uct_tl_device_resource_t *devices, *tmp;
++    unsigned num_devices;
 +    ucs_status_t status;
 +    struct ifconf conf;
-+    struct ifreq reqs[10];
 +
-+    conf.ifc_len = sizeof reqs;
-+    conf.ifc_req = reqs;
++    conf.ifc_len = 0;
++    conf.ifc_req = NULL;
 +
-+    sock = socket(SOCK_STREAM, AF_INET, 0);
-+    if (sock < 0) {
-+	ucs_error("socket(2) failed: %m");
-+	status = UCS_ERR_IO_ERROR;
-+	goto out;
++    status = ucs_socket_create(AF_INET, SOCK_STREAM, &sock);
++    if (status != UCS_OK) {
++        goto out;
 +    }
 +
 +    err = ioctl(sock, SIOCGIFCONF, &conf);
 +    if (err < 0) {
-+	ucs_error("SIOCGIFCONF ioctl failed: %m");
-+	status = UCS_ERR_IO_ERROR;
-+	goto out;
++        ucs_error("ioctl(SIOCGIFCONF) failed: %m");
++        status = UCS_ERR_IO_ERROR;
++        goto out;
 +    }
 +
-+    resources     = NULL;
-+    num_resources = 0;
-+    for (i = 0; i < conf.ifc_len / sizeof(struct ifreq); i++) {
-+	const char *name = reqs[i].ifr_name;
++    conf.ifc_req = ucs_calloc(1, conf.ifc_len, "ifreq");
++    if (conf.ifc_req == NULL) {
++        ucs_error("memory alocation failed");
++        status = UCS_ERR_NO_MEMORY;
++        goto out;
++    }
++
++    err = ioctl(sock, SIOCGIFCONF, &conf);
++    if (err < 0) {
++        ucs_error("ioctl(SIOCGIFCONF) failed: %m");
++        status = UCS_ERR_IO_ERROR;
++        goto out_free;
++    }
++
++    devices     = NULL;
++    num_devices = 0;
++    for (i = 0; i < (conf.ifc_len / sizeof(struct ifreq)); i++) {
++        const char *name = conf.ifc_req[i].ifr_name;
++	sa_family_t family = conf.ifc_req[i].ifr_addr.sa_family;
 +
-+        if (!ucs_netif_is_active(name, AF_INET)) {
++        if (!ucs_netif_is_active(name, family)) {
 +            continue;
 +        }
 +
-+        tmp = ucs_realloc(resources, sizeof(*resources) * (num_resources + 1),
-+                          "tcp resources");
++        tmp = ucs_realloc(devices, sizeof(*devices) * (num_devices + 1),
++                          "tcp devices");
 +        if (tmp == NULL) {
-+            ucs_free(resources);
++            ucs_free(devices);
 +            status = UCS_ERR_NO_MEMORY;
-+            goto out;
++            goto out_free;
 +        }
-+        resources = tmp;
++        devices = tmp;
 +
-+        ucs_snprintf_zero(resources[i].name, sizeof(resources[i].name),
++        ucs_snprintf_zero(devices[num_devices].name,
++                          sizeof(devices[num_devices].name),
 +                          "%s", name);
-+        resources[i].type = UCT_DEVICE_TYPE_NET;
-+        ++num_resources;
++        devices[num_devices].type = UCT_DEVICE_TYPE_NET;
++        ++num_devices;
 +    }
 +
-+    *num_tl_devices_p = num_resources;
-+    *tl_devices_p     = resources;
-+    status            = UCS_OK;
++    *num_devices_p = num_devices;
++    *devices_p     = devices;
++    status         = UCS_OK;
 +
++out_free:
++    ucs_free(conf.ifc_req);
 +out:
-+    if (sock >= 0) close(sock);
++    if (sock >= 0) {
++        close(sock);
++    }
 +    return status;
 +}
 +
  ucs_status_t uct_tcp_query_devices(uct_md_h md,
                                     uct_tl_device_resource_t **devices_p,
                                     unsigned *num_devices_p)
-@@ -599,9 +663,9 @@ ucs_status_t uct_tcp_query_devices(uct_md_h md,
+@@ -893,9 +974,9 @@ ucs_status_t uct_tcp_query_devices(uct_md_h md,
  
      dir = opendir(UCT_TCP_IFACE_NETDEV_DIR);
      if (dir == NULL) {
 -        ucs_error("opendir(%s) failed: %m", UCT_TCP_IFACE_NETDEV_DIR);
 -        status = UCS_ERR_IO_ERROR;
 -        goto out;
-+	/* When /sys is unavailable, as can be the case in a container,
-+	 * resort to a good old 'ioctl'.  */
-+	return query_devices_ioctl(md, devices_p, num_devices_p);
++        /* When /sys is unavailable, as can be the case in a container,
++         * resort to a good old 'ioctl'.  */
++        return uct_tcp_query_devices_ioctl(md, devices_p, num_devices_p);
      }
  
      devices     = NULL;
-@@ -655,7 +719,6 @@ ucs_status_t uct_tcp_query_devices(uct_md_h md,
+@@ -963,7 +1044,6 @@ ucs_status_t uct_tcp_query_devices(uct_md_h md,
  
  out_closedir:
      closedir(dir);
-- 
2.41.0





  parent reply	other threads:[~2023-10-24  9:59 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16  7:35 [bug#66573] [PATCH 00/11] Update Open MPI and its dependencies Ludovic Courtès
2023-10-16  7:54 ` [bug#66573] [PATCH 01/11] gnu: opensm: Use the right version string for the doc directory Ludovic Courtès
2023-10-16  7:54 ` [bug#66573] [PATCH 02/11] gnu: opensm: Use gexps Ludovic Courtès
2023-10-16  7:54 ` [bug#66573] [PATCH 03/11] gnu: slurm: Add 23.02.6 Ludovic Courtès
2023-10-16  7:54 ` [bug#66573] [PATCH 04/11] gnu: hwloc: Update to 2.9.3 Ludovic Courtès
2023-10-16  7:54 ` [bug#66573] [PATCH 05/11] gnu: opensm: Update to 3.3.24 Ludovic Courtès
2023-10-16  7:54 ` [bug#66573] [PATCH 06/11] gnu: ucx: Update to 1.15.0 Ludovic Courtès
2023-10-16  7:54 ` [bug#66573] [PATCH 07/11] gnu: rdma-core: Update to 48.0 Ludovic Courtès
2023-10-16  7:54 ` [bug#66573] [PATCH 08/11] gnu: libfabric: Update to 1.19.0 Ludovic Courtès
2023-10-16  7:54 ` [bug#66573] [PATCH 09/11] gnu: psm2: Update to 12.0 Ludovic Courtès
2023-10-16  7:54 ` [bug#66573] [PATCH 10/11] gnu: openmpi: Update to 4.1.6 Ludovic Courtès
2023-10-16  7:54 ` [bug#66573] [PATCH 11/11] gnu: intel-mpi-benchmarks: Update to 2021.3 Ludovic Courtès
2023-10-19 19:36 ` [bug#66573] [PATCH v2 01/11] gnu: opensm: Use the right version string for the doc directory Ludovic Courtès
2023-10-19 19:36 ` [bug#66573] [PATCH v2 02/11] gnu: opensm: Use gexps Ludovic Courtès
2023-10-19 19:36 ` [bug#66573] [PATCH v2 03/11] gnu: slurm: Add 23.02.6 Ludovic Courtès
2023-10-19 19:36 ` [bug#66573] [PATCH v2 04/11] gnu: hwloc: Update to 2.9.3 Ludovic Courtès
2023-10-19 19:36 ` [bug#66573] [PATCH v2 05/11] gnu: opensm: Update to 3.3.24 Ludovic Courtès
2023-10-19 19:36 ` [bug#66573] [PATCH v2 06/11] gnu: ucx: Update to 1.15.0 Ludovic Courtès
2023-10-19 19:41   ` Ludovic Courtès
2023-10-19 19:36 ` [bug#66573] [PATCH v2 07/11] gnu: rdma-core: Update to 48.0 Ludovic Courtès
2023-10-19 19:36 ` [bug#66573] [PATCH v2 08/11] gnu: libfabric: Update to 1.19.0 Ludovic Courtès
2023-10-19 19:36 ` [bug#66573] [PATCH v2 09/11] gnu: psm2: Update to 12.0 Ludovic Courtès
2023-10-19 19:36 ` [bug#66573] [PATCH v2 10/11] gnu: openmpi: Update to 4.1.6 Ludovic Courtès
2023-10-19 19:36 ` [bug#66573] [PATCH v2 11/11] gnu: intel-mpi-benchmarks: Update to 2021.3 Ludovic Courtès
2023-10-24  9:57 ` [bug#66573] [PATCH v2.1 01/11] gnu: opensm: Use the right version string for the doc directory Ludovic Courtès
2023-10-24  9:57   ` [bug#66573] [PATCH v2.1 02/11] gnu: opensm: Use gexps Ludovic Courtès
2023-10-24  9:57   ` [bug#66573] [PATCH v2.1 03/11] gnu: slurm: Add 23.02.6 Ludovic Courtès
2023-10-24  9:57   ` [bug#66573] [PATCH v2.1 04/11] gnu: hwloc: Update to 2.9.3 Ludovic Courtès
2023-10-24  9:58   ` [bug#66573] [PATCH v2.1 05/11] gnu: opensm: Update to 3.3.24 Ludovic Courtès
2023-10-24  9:58   ` Ludovic Courtès [this message]
2023-10-24  9:58   ` [bug#66573] [PATCH v2.1 07/11] gnu: rdma-core: Update to 48.0 Ludovic Courtès
2023-10-24  9:58   ` [bug#66573] [PATCH v2.1 08/11] gnu: libfabric: Update to 1.19.0 Ludovic Courtès
2023-10-24  9:58   ` [bug#66573] [PATCH v2.1 09/11] gnu: psm2: Update to 12.0 Ludovic Courtès
2023-10-24  9:58   ` [bug#66573] [PATCH v2.1 10/11] gnu: openmpi: Update to 4.1.6 Ludovic Courtès
2023-10-24  9:58   ` [bug#66573] [PATCH v2.1 11/11] gnu: intel-mpi-benchmarks: Update to 2021.3 Ludovic Courtès
2023-11-15 16:46 ` [bug#66573] [PATCH 00/11] Update Open MPI and its dependencies Ludovic Courtès
2023-11-15 16:57   ` Guillaume Le Vaillant
2023-11-16 12:14     ` Ludovic Courtès
2023-11-16 14:55       ` Guillaume Le Vaillant

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d1abd6c1a129845eb9db7606e820208be8f5fcd9.1698141437.git.ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=66573@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).