OMP_PROC_BIND

The OMP_PROC_BIND environment variable controls whether OpenMP threads can be moved between processors.

Read syntax diagramSkip visual syntax diagram
OMP_PROC_BIND syntax

>>-OMP_PROC_BIND=--+-TRUE--+-----------------------------------><
                   '-FALSE-'   

TRUE
Binds the threads to processors.
FALSE
Allows threads to be moved between processors.

The OMP_PROC_BIND and XLSMPOPTS environment variables interact with each other according to the following rules:

Table 1. Thread binding rule summary
OMP_PROC_BINDsettings XLSMPOPTS settings Thread binding results
OMP_PROC_BIND is not set OMP_PROC_BIND is not set Threads are not bound.
OMP_PROC_BIND is set to startproc/stride or procs Threads are bound according to the settings in XLSMPOPTS.
XLSMPOPTS setting is invalid Threads are not bound.
OMP_PROC_BIND=TRUE XLSMPOPTS is not set Threads are bound.
XLSMPOPTS is set to startproc/stride or procs Threads are bound according to the settings in XLSMPOPTS1.
XLSMPOPTS setting is invalid Threads are bound.
OMP_PROC_BIND=FALSE XLSMPOPTS is not set Threads are not bound.
XLSMPOPTS is set (startproc/stride or procs)
XLSMPOPTS setting is invalid
Note:
  1. If procs is set and the number of CPU IDs specified is smaller than the number of threads that are used by the program, the remaining threads are also bound to the listed CPU IDs but not in any particular order. If XLSMPOPTS=startproc is used, the value specified by startproc is smaller than the number of CPUs, and the value that is specified by stride causes a thread to bind to a CPU outside the range of available places, some of the threads are bound and some are not.

The OMP_PROC_BIND environment variable provides a portable way to control whether OpenMP threads can be migrated. The startproc/stride or procs suboption of the XLSMPOPTS environment variable, which is an IBM extension, provides a finer control to bind OpenMP threads to processors. If portability of your application is important, use only the OMP_PROC_BIND environment variable to control thread binding.



Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us