HomePhabricator

[OpenMP] Add experimental nesting mode feature

Authored by tlwilmar on May 10 2021, 10:58 AM.

Description

[OpenMP] Add experimental nesting mode feature

Nesting mode is a new experimental feature in the OpenMP
runtime. It allows a user to set up nesting for an application in a
way that corresponds to the hardware topology levels on the machine an
application is being run on. For example, if a machine has 2 sockets,
each with 12 cores, then use of nesting mode could set up an outer
level of nesting that uses 2 threads per parallel region, and an inner
level of nesting that uses 12 threads per parallel region.

Nesting mode is controlled with the KMP_NESTING_MODE environment
variable as follows:

  1. KMP_NESTING_MODE = 0: Nesting mode is off (default); max-active-levels-var

is set to 1 (the default -- nesting is off, nested parallel regions
are serialized).

  1. KMP_NESTING_MODE = 1: Nesting mode is on, and a number of threads

will be assigned for each level discovered in the machine topology;
max-active-levels-var is set to the number of levels discovered.

  1. KMP_NESTING_MODE = n, n>1: [Note: this option is experimental and may change

or be removed in the future.] Nesting mode is on, and a number of
threads will be assigned for each topology level discovered on the
machine, up to k<=n levels (since there may be fewer than n levels
discovered in the topology), and beyond the kth level, nested parallel
regions will be serialized; NOTE: max-active-levels-var is 1 (the default --
nesting is off, and nested parallel regions are serialized until the
user changes max-active-levels-var.

If the user sets OMP_NUM_THREADS or OMP_MAX_ACTIVE_LEVELS, they will
override KMP_NESTING_MODE settings for the associated environment
variables. The detected topology may be limited by an affinity mask
setting on the initial thread, or if the user sets KMP_HW_SUBSET. See
also: KMP_HOT_TEAMS_MAX_LEVEL for controlling use of hot teams for
nested parallel regions. Note that this feature only sets numbers of
threads used at nesting levels. The user should make use of
OMP_PLACES and OMP_PROC_BIND or KMP_AFFINITY for affinitizing those
threads, if desired.

Differential Revision: https://reviews.llvm.org/D102188

Details

Committed
tlwilmarJun 4 2021, 2:01 PM
Differential Revision
D102188: [OpenMP] Add experimental nesting mode
Parents
rG5019b0a56588: [scudo] Fix String DCHECK
Branches
Unknown
Tags
Unknown