[all-commits] [llvm/llvm-project] 8ec9aa: [OpenMP] Add experimental nesting mode feature

Terry Wilmarth via All-commits all-commits at lists.llvm.org
Fri Jun 4 14:01:38 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8ec9aa236e325fd4629cfeefac2919302e14d61a
      https://github.com/llvm/llvm-project/commit/8ec9aa236e325fd4629cfeefac2919302e14d61a
  Author: Terry Wilmarth <terry.l.wilmarth at intel.com>
  Date:   2021-06-04 (Fri, 04 Jun 2021)

  Changed paths:
    M openmp/runtime/src/kmp.h
    M openmp/runtime/src/kmp_ftn_entry.h
    M openmp/runtime/src/kmp_global.cpp
    M openmp/runtime/src/kmp_runtime.cpp
    M openmp/runtime/src/kmp_settings.cpp

  Log Message:
  -----------
  [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).

2) 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.

3) 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




More information about the All-commits mailing list