In Delphi, we need to know the number of CPUs for parallelization. Until now, we have used the GetNativeSystemInfo()
function, which has worked fine, also with servers with hyperthreading.
But now, we have a server (Intel Xeon Gold 6230) with 40 physical processors and 80 logical processors with hyperthreading, and GetNativeSystemInfo()
only shows 40 CPUs.
We made a small test program that uses 3 calls:
GetNativeSystemInfo()
GetLogicalProcessorInformation()
(code from How to detect number of logical and physical processors efficiently?)
And looking into the Registry for number of CPUs:
Computer\HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor
For all of our servers, these 3 calls give the same number of CPUs:
But for the Intel Xeon, only the Registry gives us the 80 CPUs:
Does anybody know why it is not working for the Intel server, or know a way to be sure to get the max number of CPUs?
In GetLogicalProcessorInformation
documentation I found this part:
On systems with more than 64 logical processors, the GetLogicalProcessorInformation function retrieves logical processor information about processors in the processor group to which the calling thread is currently assigned. Use the
GetLogicalProcessorInformationEx
function to retrieve information about processors in all processor groups on the system.
So try using GetLogicalProcessorInformationEx
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With