seanmonstar / num_cpus

Get the number of CPUs in Rust
Apache License 2.0
575 stars 89 forks source link

returns 48 cores for 96 core windows machine #81

Open jonathanstrong opened 5 years ago

jonathanstrong commented 5 years ago

on an aws windows instance, num_cpus::get() returned 48 for a machine with 96 logical cores. I expected the result would be 96, not 48, the number of physical cores.

num_cpus v1.10.1 rustc: 1.38.0-nightly 2019-07-18

CPU readout from windows task manager:

    Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz

    Base speed: 2.50 GHz
    Sockets:    2
    Cores:  48
    Logical processors: 96
    Virtualization: Enabled
    L1 cache:   3.0 MB
    L2 cache:   48.0 MB
    L3 cache:   2.0 MB

Thanks for your hard work on the library!

(edit: adds num_cpus version)

seanmonstar commented 5 years ago

Huh, I just checked the MSDN docs about GetSystemInfo and dwNumberOfProcessors, and noticed this:

The number of logical processors in the current group.

It seems the group can only have up to 64 (and thus you're seeing 48)? Since you seem to have access to a windows box with a lot of cores, would you be able to help with the fix?

jonathanstrong commented 5 years ago

I'd love to help out, unfortunately:

However - next time I am working on one of these instances I'll try to poke around, if it's still relevant. Thanks!

sectorzero commented 4 years ago

I have implemented this feature. I will send a PR soon.