Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I determine the number of CPU cores the PC has?

Tags:

sas

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.

like image 955
xiaodai Avatar asked Nov 15 '25 19:11

xiaodai


1 Answers

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.

like image 90
lalli Avatar answered Nov 18 '25 20:11

lalli



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!