Compaq Fortran for Tru64 UNIX Alpha Systems V5.4

otsgetnumthreads  (3f)


Syntax

  interface
     integer function otsgetnumthreads ( )
     !dec$ alias otsgetnumthreads, '_OtsGetNumThreads'
     end function otsgetnumthreads
  end interface
  integer result
  result = otsgetnumthreads ( )

Description

  This function returns the number of threads that are being used in the
  current parallel region (if running within one), or the number of threads
  that have been created so far (if not currently within a parallel region).

  You can use this routine to decide how to partition a parallel loop. For
  example:

              nt = otsgetnumthreads ( )
        c$par parallel do
              do i = a,nt-1
                    work(i) = 0
                    k0 = 1+(i*n)/nt
                    k1 = ((i+1)+n)/nt
                    do j = 1,m
                          do k = k0,k1
                             ! use work(i)
                          enddo
                    enddo
              enddo

See Also

  otssetnumthreads(3f)