Go to main content
Oracle® Developer Studio 12.6: C User's Guide

Exit Print View

Updated: July 2017
 
 

4.3 Environment Variables

Some environment variables related to parallelized C are the following. There are additional environment variables defined by the OpenMP API specification and others that are specific to the Oracle Developer Studio implementation. See the Oracle Developer Studio 12.6: OpenMP API User’s Guide for descriptions of all parallelization related environment variables.

  • OMP_NUM_THREADS

    Set the OMP_NUM_THREADS environment variable to specify the number of threads to use for the program. Refer to the Oracle Developer Studio 12.6: OpenMP API User’s Guide for the default number of threads, if this environment variable is not set.

  • SUNW_MP_THR_IDLE

    Controls the status of idle threads in an OpenMP program that are waiting at a barrier or waiting for new parallel regions to work on. See the Oracle Developer Studio 12.6: OpenMP API User’s Guide for details.

  • SUNW_MP_WARN

    Set this environment variable to TRUE to print warning messages from OpenMP and other parallelization runtime systems. See the Oracle Developer Studio 12.6: OpenMP API User’s Guide for details.

  • OMP_STACKSIZE

    The executing program maintains a main memory stack for the master thread and a distinct stack for each slave thread. Stacks are temporary memory address spaces used to hold arguments and automatic variables during subprogram executions. The OMP_STACKSIZE environment variable can be used to control the size of the stack for a slave thread. Refer to the Oracle Developer Studio 12.6: OpenMP API User’s Guide for the default slave thread stack size, if this environment variable is not set.

    Note that the setting of the OMP_STACKSIZE environment variable has no effect on programs using the Oracle Solaris Pthreads API.

    Stack overflow might occur if the size of a thread's stack is too small, causing silent data corruption or a segmentation fault. See the -xcheck=stkovf compiler option for information about how to detect and diagnose stack overflow.