pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
py-joblib: Revert to subprocesses for sysctl
Module Name: pkgsrc-wip
Committed By: Jason W. Bacon <bacon%NetBSD.org@localhost>
Pushed By: outpaddling
Date: Thu Jan 4 08:59:52 2024 -0600
Changeset: 5e70489ea5d153caafb2fdbd21644f27bebd519d
Modified Files:
py-joblib/Makefile
py-joblib/distinfo
py-joblib/patches/patch-joblib_externals_loky_backend_context.py
Log Message:
py-joblib: Revert to subprocesses for sysctl
Python has no portable sysctl interface
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=5e70489ea5d153caafb2fdbd21644f27bebd519d
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
py-joblib/Makefile | 1 -
py-joblib/distinfo | 2 +-
.../patch-joblib_externals_loky_backend_context.py | 51 ++++++++++++----------
3 files changed, 29 insertions(+), 25 deletions(-)
diffs:
diff --git a/py-joblib/Makefile b/py-joblib/Makefile
index 04a9a27cc8..b9b1f1083b 100644
--- a/py-joblib/Makefile
+++ b/py-joblib/Makefile
@@ -12,7 +12,6 @@ LICENSE= modified-bsd
TOOL_DEPENDS+= ${PYPKGPREFIX}-setuptools>=61.2:../../devel/py-setuptools
TOOL_DEPENDS+= ${PYPKGPREFIX}-wheel-[0-9]*:../../devel/py-wheel
-DEPENDS+= ${PYPKGPREFIX}-sysctl-[0-9]*:../../devel/py-sysctl
USE_LANGUAGES= # none
diff --git a/py-joblib/distinfo b/py-joblib/distinfo
index b4b5ee2f57..03fa99094f 100644
--- a/py-joblib/distinfo
+++ b/py-joblib/distinfo
@@ -3,4 +3,4 @@ $NetBSD: distinfo,v 1.17 2023/11/03 10:35:53 adam Exp $
BLAKE2s (joblib-1.3.2.tar.gz) = 6f3ff669b1222cd1bb387d989b636936fc17a8b01c5ea27d98f6ee2405f8aae5
SHA512 (joblib-1.3.2.tar.gz) = 9b5acba1321351cf2ae548161ced18774b8b316aaf883cc8e77bf58898d1913361a3845d64f1f1f87e4e2394eafd92e0a6a8d67947db0c9a95a40e5f579baae6
Size (joblib-1.3.2.tar.gz) = 1987720 bytes
-SHA1 (patch-joblib_externals_loky_backend_context.py) = d4451da69929fe6cbe24cd8300f398c16449a478
+SHA1 (patch-joblib_externals_loky_backend_context.py) = bfda1b3af5951e98e2226622b0072ac12057e4a2
diff --git a/py-joblib/patches/patch-joblib_externals_loky_backend_context.py b/py-joblib/patches/patch-joblib_externals_loky_backend_context.py
index 8f2c3c6f3b..ea30e36ead 100644
--- a/py-joblib/patches/patch-joblib_externals_loky_backend_context.py
+++ b/py-joblib/patches/patch-joblib_externals_loky_backend_context.py
@@ -1,36 +1,41 @@
$NetBSD$
-# Add BSD support, eliminate subprocess on Darwin
+# Add BSD support
--- joblib/externals/loky/backend/context.py.orig 2023-06-29 15:14:21.000000000 +0000
+++ joblib/externals/loky/backend/context.py
-@@ -11,6 +11,7 @@
- #
- import os
- import sys
-+import sysctl
- import math
- import subprocess
- import traceback
-@@ -267,13 +268,14 @@ def _count_physical_cores():
- ]
- cpu_count_physical = sum(map(int, cpu_info))
- elif sys.platform == "darwin":
-- cpu_info = subprocess.run(
-- "sysctl -n hw.physicalcpu".split(),
-- capture_output=True,
-- text=True,
-- )
-- cpu_info = cpu_info.stdout
-- cpu_count_physical = int(cpu_info)
-+ cpu_count_physical = int(sysctl.filter("hw.physicalcpu")[0].value);
+@@ -245,6 +245,8 @@ def _count_physical_cores():
+ return physical_cores_cache, exception
+
+ # Not cached yet, find it
++ # Using subprocesses is inefficient, but python has no portable
++ # sysctl interface at this time
+ try:
+ if sys.platform == "linux":
+ cpu_info = subprocess.run(
+@@ -274,6 +276,25 @@ def _count_physical_cores():
+ )
+ cpu_info = cpu_info.stdout
+ cpu_count_physical = int(cpu_info)
+ elif sys.platform.startswith('freebsd'):
-+ cpu_count_physical = int(sysctl.filter("kern.smp.cores")[0].value);
++ cpu_info = subprocess.run(
++ "sysctl -n kern.smp.cores".split(),
++ capture_output=True,
++ text=True,
++ )
++ cpu_info = cpu_info.stdout
++ cpu_count_physical = int(cpu_info)
+ elif sys.platform.startswith('netbsd'):
+ # FIXME: This reports the number of hyperthreads
+ # We want independent cores to prevent oversubscription
-+ cpu_count_physical = int(sysctl.filter("hw.ncpu")[0].value);
+ # FIXME: Add OpenBSD, Dragonfly (probably the same as FreeBSD)
++ 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