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

Exit Print View

Updated: June 2017
 
 

5.3 SUNW_MP_PROCBIND

SUNW_MP_PROCBIND is a legacy, environment variable specific to Oracle for specifying processor binding. This section describes the values you can set for this variable.


Note -  Non-negative integers used as values for SUNW_MP_PROCBIND denote logical hardware thread IDs, which might be different from actual hardware thread IDs. Although hardware thread IDs may be consecutive, gaps can occur. For example, on a 16-core SPARC system, the hardware thread IDs could be 0, 1, 2, 3, 8 9, 10, 11, 512, 513, 514, 515, 520, 521, 522, 523. However, logical processor IDs are consecutive integers that start with 0. If the number of hardware threads available in the system is n, their logical processor IDs are 0, 1, ..., n-1.

    The possible values for SUNW_MP_PROCBIND are:

  • The strings FALSE, TRUE, COMPACT, or SCATTER in uppercase or lowercase. For example:

    % setenv SUNW_MP_PROCBIND "TRUE"
    • FALSE – The OpenMP threads will not be bound to any processors. This is the default setting.

    • TRUE – The OpenMP threads will be bound to hardware threads in a round-robin fashion. The starting hardware thread for the binding is determined by the runtime library with the goal of achieving best performance.

    • COMPACT – The OpenMP threads will be bound to hardware threads that are as close together as possible on the system. COMPACT allows threads to share data caches and thus improve data locality.

    • SCATTER – The OpenMP threads will be bound to hardware threads that are far apart. This setting enables higher memory bandwidth for each of the threads.

  • Non-negative integer – Denotes the starting logical ID of the hardware threads to which OpenMP threads should be bound. OpenMP threads will be bound to hardware threads in a round-robin fashion starting with the hardware thread with the specified logical ID and wrapping around to the hardware thread with logical ID 0 after binding to the hardware thread with logical ID n-1.

    For example:

    % setenv SUNW_MP_PROCBIND "2"
  • A list of two or more non-negative integers – The OpenMP threads will be bound in a round-robin fashion to hardware threads with the specified logical IDs. Hardware threads with logical IDs other than those specified will not be used.

    The following example binds two threads to hardware thread 2, one to hardware thread 4, and one to hardware thread 6 if four threads are used.

    % setenv SUNW_MP_PROCBIND "2 2 4 6"
  • Two non-negative integers separated by a hyphen ("-") – The OpenMP threads will be bound in a round-robin fashion to hardware threads in the range that begins with the first logical ID and ends with the second logical ID. The first integer must be less than or equal to the second integer. Hardware threads with logical IDs other than those in the range will not be used.

    For example:

    % setenv SUNW_MP_PROCBIND "0-6"

If the value specified for SUNW_MP_PROCBIND is invalid, or if an invalid logical ID is given, an error message results and execution of the program will terminate.

If the number of OpenMP threads is greater than the number of hardware threads available, then some hardware threads will have more than one OpenMP thread bound to them. This situation can negatively impact performance.