tech-pkg archive

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

Re: devel/py-joblib patch



On 12/29/23 08:38, Martin Husemann wrote:
On Fri, Dec 29, 2023 at 08:02:44AM -0600, Jason Bacon wrote:
              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)

This sounds pretty expensive, can't it use os.sysconf(NPROCESSORS_CONF) ?

Martin

Probably.  I was just following the other examples in the code, as I'm
no pythonista, but your suggestion sounds like a better approach.

https://github.com/joblib/joblib/issues/1535




Home | Main Index | Thread Index | Old Index