- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there a means to ascertain the number of processors assigned to a Fortran program from within the source code itself? Apparently other compilers have statements that will allow this to be done, but I havebeen unable to find something similar for the Intel Fortran compiler.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You'll have to clarify what you mean by the question. You can ask how many processors are available easily enough - see the "Platform" sample provided. But processors are not typically "assigned" to a progran. You can specify that a thread is to have an affinity to a particular processor, but that doesn't sound like what you're asking.
What's an example from another compiler of what you want?
What's an example from another compiler of what you want?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
The Compaq Fortran compiler, which I have installed on my Windows PC, has the following inquiry function: NUMBER_OF_PROCESSORS, which, quoting directly from the manual, "returns the total number of processors (peers) available to the program". I'd like to know if the Intel Fortran compiler has something similar.
Terry
The Compaq Fortran compiler, which I have installed on my Windows PC, has the following inquiry function: NUMBER_OF_PROCESSORS, which, quoting directly from the manual, "returns the total number of processors (peers) available to the program". I'd like to know if the Intel Fortran compiler has something similar.
Terry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ah, that's a HPF (High Performance Fortran) intrinsic. The Intel compiler DOES support this, though I find it is not documented. The OpenMP routine OMP_GET_NUM_PROCS is documented and supported. For example:
use omp_lib
print *, omp_get_num_procs()
end
You need to build with /Qopenmp to use this.
Note that unless you have threaded your application, the number of processors is not meaningful.
use omp_lib
print *, omp_get_num_procs()
end
You need to build with /Qopenmp to use this.
Note that unless you have threaded your application, the number of processors is not meaningful.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page