Contents


NAME

     available_threads - returns information about current thread
     usage

SYNOPSIS

     SUBROUTINE AVAILABLE_THREADS(TOTAL, USING)

     INTEGER TOTAL, USING

     SUBROUTINE AVAILABLE_THREADS_64(TOTAL, USING)

     INTEGER*8 TOTAL, USING

  F95 INTERFACE
     SUBROUTINE AVAILABLE_THREADS(TOTAL, USING)

     INTEGER :: TOTAL, USING

     SUBROUTINE AVAILABLE_THREADS_64(TOTAL, USING)

     INTEGER(8) :: TOTAL, USING

  C INTERFACE
     #include <sunperf.h>

     void available_threads(int *total, int *using);

     void available_threads_64(long *total, long *using);

PURPOSE

     AVAILABLE_THREADS calls library routine  OMP_GET_MAX_THREADS
     to obtain the maximum value that can be returned by calls to
     OMP_GET_NUM_THREADS.  This value is  stored  in  TOTAL.   If
     OMP_SET_NUM_THREADS   is  used  to  changed  the  number  of
     threads, subsequent calls to AVAILABLE_THREADS, whether cal-
     ling  from  a  serial region or parallel region, will return
     the new value in TOTAL.  Also, in a parallel environment, if
     available_threads is called from a serial region of the mas-
     ter thread, it returns the number of threads  available  for
     execution  (determined  by  function OMP_GET_NUM_THREADS) in
     argument USING.  Else, if it is called from a thread in  the
     team  executing the parallel region it returns a 1 in USING.
     For     more     information     on     OMP_GET_MAX_THREADS,
     OMP_GET_NUM_THREADS,   and   OMP_SET_NUM_THREADS,   see  the
     OpenMP Fortran Application  Program  Interface  document  at
     http://www.openmp.org.

ARGUMENTS

     TOTAL (output)
               Maximum value that can be  returned  by  calls  to
               USING_THREADS

     USING (output)
               If AVAILABLE_THREADS is  called  from  a  parallel
               region, USING = 1.  If AVAILABLE_THREADS is called
               from a serial region, USING contains the number of
               threads available for execution in parallel.