How do I determine the number of CPU cores the PC using code? Is there a way to do it in SAS. I want to determine the number of cores and then set how many threads I should run.
In SAS:
%put &sysncpu;
In java one would do:
Runtime runtime = Runtime.getRuntime();
int nrOfProcessors = runtime.availableProcessors();
In C#:
System.Environment.ProcessorCount
But these are just environment variables which are set by the operating system and can probably be modified through programming. I don't know if you can actually get real hardware information.
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