tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

devel/py-joblib patch




Noticed that py-joblib is erroring out trying to detect CPUs.  The patch
below fixes the issue.

# cat patches/patch-joblib_externals_loky_backend_context.py

$NetBSD$

# Add BSD support

--- joblib/externals/loky/backend/context.py.orig       2023-06-29
15:14:21.000000000 +0000
+++ joblib/externals/loky/backend/context.py
@@ -274,6 +274,15 @@ def _count_physical_cores():
             )
             cpu_info = cpu_info.stdout
             cpu_count_physical = int(cpu_info)
+        # Maybe also openbsd, dragonfly, etc?
+        elif sys.platform.startswith('freebsd') or
sys.platform.startswith('netbsd'):
+            cpu_info = subprocess.run(
+                "sysctl -n hw.ncpu".split(),
+                capture_output=True,
+                text=True,
+            )
+            cpu_info = cpu_info.stdout
+            cpu_count_physical = int(cpu_info)
         else:
             raise NotImplementedError(f"unsupported platform:
{sys.platform}")


Home | Main Index | Thread Index | Old Index