How to get Number of Processors

How to get Number of Processors

I was told that in Compaq Visual Fortran, the internal function "Number_of_Processors" is always returned to 1 on Windows even for multi-processor machines. Does anybody know if there are the third party software to get around this?

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Don't know why that intrinsic wouldn't work but it is easy enough to replace:

use kernel32
type (T_SYSTEM_INFO) si
call GetSystemInfo (si)
! number of processors is in si%dwNumberOfProcessors


NUMBER_OF_PROCESSORS is an intrinsic that's part of HPF (High-Performance Fortran), a feature provided by Compaq only on Tru64 UNIX. Our implementation is to return a 1 on all platforms other than Tru64 UNIX, as that's the only platform where we support multiprocessing directly in the compiler.

The documentation is misleading about this and we'll fix it. Sure, we could change the intrinsic to ask the OS how many processors are present, but it's really meant to inquire about HPF parallelism capability.


Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today