Hi all,
Does anybody know a method to determine number of cores ? I would like, in my program, to run as many threads as cores in the machine.
Thanks in advance.
How to detect number of cores ?
How to detect number of cores ?
Purebasic 6.12 64 bits - Windows 11 Pro 64 bits 23H2
Re: How to detect number of cores ?
Code: Select all
If GetProcessAffinityMask_(GetCurrentProcess_(), @ProcessMask, @SystemMask)
For i=0 To 31
If ProcessMask & (1<<i)
Count+1
EndIf
Next
EndIf
If Count=0: count=1: EndIf
Debug CountThe best preparation for tomorrow is doing your best today.
Re: How to detect number of cores ?
Thanks KJ67.
Another choice : looking for registry : HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor
Another choice : looking for registry : HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor
Purebasic 6.12 64 bits - Windows 11 Pro 64 bits 23H2
