4.2 OMP_AFFINITY_FORMAT – Set the format string used for affinity display

ICV: affinity-format-var
Scope: device
Description:

Sets the format string used when displaying OpenMP thread affinity information. Special values are output using % followed by an optional size specification and then either the single-character field type or its long name enclosed in curly braces; using %% displays a literal percent. The size specification consists of an optional 0. or . followed by a positive integer, specifying the minimal width of the output. With 0. and numerical values, the output is padded with zeros on the left; with ., the output is padded by spaces on the left; otherwise, the output is padded by spaces on the right. If unset, the value is “level %L thread %i affinity %A”.

Supported field types are:

tteam_numvalue returned by omp_get_team_num
Tnum_teamsvalue returned by omp_get_num_teams
Lnesting_levelvalue returned by omp_get_level
nthread_numvalue returned by omp_get_thread_num
Nnum_threadsvalue returned by omp_get_num_threads
aancestor_tnumvalue returned by omp_get_ancestor_thread_num(omp_get_level()-1)
Hhostname of the host that executes the thread
Pprocess_idprocess identifier
inative_thread_idnative thread identifier
Athread_affinitycomma separated list of integer values or ranges, representing the processors on which a process might execute, subject to affinity mechanisms

For instance, after setting

OMP_AFFINITY_FORMAT="%0.2a!%n!%.4L!%N;%.2t;%0.2T;%{team_num};%{num_teams};%A"

with either OMP_DISPLAY_AFFINITY being set or when calling omp_display_affinity with NULL or an empty string, the program might display the following:

00!0!   1!4; 0;01;0;1;0-11
00!3!   1!4; 0;01;0;1;0-11
00!2!   1!4; 0;01;0;1;0-11
00!1!   1!4; 0;01;0;1;0-11
See also:

OMP_DISPLAY_AFFINITY – Display thread affinity information

Reference:

OpenMP specification v5.0, Section 6.14