/sys$common/syshlp/helplib.hlb FORTRAN, Intrinsic Procedures, NWORKERS *Conan The Librarian (sorry for the slow response - running on an old VAX) |
The intrinsic function NWORKERS requires no arguments and returns an INTEGER*4 value that represents the total number of processes executing an application. NWORKERS will be most useful in parallel applications for determining the size of the iteration segments to be executed by the parallel processes. For example: CPAR$ DO_PARALLEL (N+NWORKERS( )-1) / NWORKERS( ) DO I = 1, N ... ENDDO In this example, the size of each iteration segment to be executed in the parallel processes would be the total number of iterations in the parallel DO loop divided by the number of available processes. (Specifying "(N+NWORKERS( )-1)" guarantees that you can never get an illegal segment value of 0.) By using NWORKERS as a variable in the calculation to establish iteration segment size, the segment size adjusts automatically when the application is run on systems with varying numbers of available processors.
|