Page 1 of 1
GetLogicalProcessorCount() not work on W2022 Server 48core
Posted: Wed Jun 25, 2025 3:10 am
by Victorio
Hi,
I am testing my app on Windows Server 2022 with 48 cores. Function GetLogicalProcessorCount() show only 32 ? Why ?
AI say, that it is because limitation DWORD to 32bit, but I am not sure if this is true.
Also not work good set CPU :
Code: Select all
FUNCTION SmpSetCPU(nCpuMask) // nastavenie na zadanÅ™ CPU
LOCAL rc
rc := DllCall("Xpprt1.dll",DLL_CDECL, "_sysSetCPU", nCpuMask)
RETURN rc
Re: GetLogicalProcessorCount() not work on W2022 Server 48core
Posted: Thu Jun 26, 2025 4:00 am
by Wolfgang Ciriack
Re: GetLogicalProcessorCount() not work on W2022 Server 48core
Posted: Thu Jun 26, 2025 8:07 am
by Victorio
Yes, I read this, but I am not understand :
SetLogicalProcessor( RandomInt(GetLogicalProcessorCount()) )
I am testing it, maximal CPU can set to 32, no more, byt I have on server 48 CPUs.
If GetLogicalProcessorCount (by RandomInt) return number of CPU, and on Server is 48CPUs, I mean this also crash on number bigger than 32 ?
On this forum I saw Jimmy has some solution for 64bit harbour, I am not test how can I use this solution.
I need switch application to a specific CPU from 0 to 47, because on one CPU No more than one process, or more precisely a separate exe application launched via Runshell, may be running on one CPU.
Is some solution maybe external utility to set how CPU will be use to run exe module ?
I found command/parameter :
C:\Windows\system32>start /affinity 1 notepad.exe
Is possible run my external application/exe file with Runshell for any from 48 CPU ?
C:\Windows\system32>start /affinity 140737488355328 notepad.exe
where 140737488355328 mean binary 100000000000000000000000000000000000000000000000000 48bit number ???
Re: GetLogicalProcessorCount() not work on W2022 Server 48core
Posted: Thu Jun 26, 2025 9:18 am
by Tom
Windows itself can't address a higher number of processors. There is no processor #33. It's number one on cluster two. There are API functions to get the number of processor groups and select one of them, but within a group, the maximum number of processors is 32, no matter how much logical processors are available. Imagine there are two buildings with parking lots, each has 32 of them. There is no way to get your car from parking lot #1 of buidling #2 if you are inside building #1.