tech-pkg archive

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

Re: NetBSD # actual cores



On 1/4/24 23:27, Robert Elz wrote:
     Date:        Thu, 4 Jan 2024 09:13:17 -0600
     From:        Jason Bacon <jtocino%gmx.com@localhost>
     Message-ID:  <b4566134-0f0e-4d76-a98a-79d5741c9f6b%gmx.com@localhost>

   | Is there a way to detect whether hyperthreading is enabled?  If we have
   | that, we can divide hw.ncpu by 2.

No you cannot.   Not on modern processors.   On my system NetBSD
reports 24 cpus, and hyperthreading is enabled - but  that is not
12 cores, there are 16.  8 of the cores support hyperthreading,
the other 8 do not.

If we are going to implement something like this, do it in a
general way which supports current, and likely future, systems.
Not a hack which just seems like it might work.

kre

Yes, we can, for the purpose of py-joblib and many other scenarios.  The
goal is simply to reduce or eliminate oversubscription caused by
hyperthreading.  It doesn't have to be perfect.  In fact, allowing full
use of hyperthreads is not a major problem, it's just suboptimal in most
cases.

Knowing the correct core count would likely be better, but even that
isn't certain.  I've seen programs where using a second hyperthread
improves throughput by 80%, and others where it actually hurts
performance.  A tool like joblib can only guestimate what's best on average.

At any rate, I agree that exposing the correct core count would be best.
 The /2 is just a fallback option.


Home | Main Index | Thread Index | Old Index