diff options
author | Marcel Vollweiler <marcel@codesourcery.com> | 2022-09-08 10:01:33 -0700 |
---|---|---|
committer | Marcel Vollweiler <marcel@codesourcery.com> | 2022-09-08 10:19:37 -0700 |
commit | 9f2fca56593a2b87026b399d26adcdca90705685 (patch) | |
tree | 33fcfac4b0da2fd40ac628d809834461f01d986a /libgomp/testsuite | |
parent | 338a5b0d7da84ef1f6c01dd96abf2c6bc830f403 (diff) | |
download | gcc-9f2fca56593a2b87026b399d26adcdca90705685.zip gcc-9f2fca56593a2b87026b399d26adcdca90705685.tar.gz gcc-9f2fca56593a2b87026b399d26adcdca90705685.tar.bz2 |
OpenMP, libgomp: Environment variable syntax extension
This patch considers the environment variable syntax extension for
device-specific variants of environment variables from OpenMP 5.1 (see
OpenMP 5.1 specification, p. 75 and p. 639). An environment variable (e.g.
OMP_NUM_TEAMS) can have different suffixes:
_DEV (e.g. OMP_NUM_TEAMS_DEV): affects all devices but not the host.
_DEV_<device> (e.g. OMP_NUM_TEAMS_DEV_42): affects only device with
number <device>.
no suffix (e.g. OMP_NUM_TEAMS): affects only the host.
In future OpenMP versions also suffix _ALL will be introduced (see discussion
https://github.com/OpenMP/spec/issues/3179). This is also considered in this
patch:
_ALL (e.g. OMP_NUM_TEAMS_ALL): affects all devices and the host.
The precedence is as follows (descending). For the host:
1. no suffix
2. _ALL
For devices:
1. _DEV_<device>
2. _DEV
3. _ALL
That means, _DEV_<device> is used whenever available. Otherwise _DEV is used if
available, and at last _ALL. If there is no value for any of the variable
variants, default values are used as already implemented before.
This patch concerns parsing (a), storing (b), output (c) and transmission to the
device (d):
(a) The actual number of devices and the numbering are not known when parsing
the environment variables. Thus all environment variables are iterated and
searched for device-specific ones.
(b) Only configured device-specific variables are stored. Thus, a linked list
is used.
(c) The output is done in omp_display_env (see specification p. 468f). Global
ICVs are tagged with [all], see https://github.com/OpenMP/spec/issues/3179.
ICVs which are not global but aren't handled device-specific yet are tagged
with [host]. omp_display_env outputs the initial values of the ICVs. That is
why a dedicated data structure is introduced for the inital values only
(gomp_initial_icv_list).
(d) Device-specific ICVs are transmitted to the device via GOMP_ADDITIONAL_ICVS.
libgomp/ChangeLog:
* config/gcn/icv-device.c (omp_get_default_device): Return device-
specific ICV.
(omp_get_max_teams): Added for GCN devices.
(omp_set_num_teams): Likewise.
(ialias): Likewise.
* config/nvptx/icv-device.c (omp_get_default_device): Return device-
specific ICV.
(omp_get_max_teams): Added for NVPTX devices.
(omp_set_num_teams): Likewise.
(ialias): Likewise.
* env.c (struct gomp_icv_list): New struct to store entries of initial
ICV values.
(struct gomp_offload_icv_list): New struct to store entries of device-
specific ICV values that are copied to the device and back.
(struct gomp_default_icv_values): New struct to store default values of
ICVs according to the OpenMP standard.
(parse_schedule): Generalized for different variants of OMP_SCHEDULE.
(print_env_var_error): Function that prints an error for invalid values
for ICVs.
(parse_unsigned_long_1): Removed getenv. Generalized.
(parse_unsigned_long): Likewise.
(parse_int_1): Likewise.
(parse_int): Likewise.
(parse_int_secure): Likewise.
(parse_unsigned_long_list): Likewise.
(parse_target_offload): Likewise.
(parse_bind_var): Likewise.
(parse_stacksize): Likewise.
(parse_boolean): Likewise.
(parse_wait_policy): Likewise.
(parse_allocator): Likewise.
(omp_display_env): Extended to output different variants of environment
variables.
(print_schedule): New helper function for omp_display_env which prints
the values of run_sched_var.
(print_proc_bind): New helper function for omp_display_env which prints
the values of proc_bind_var.
(enum gomp_parse_type): Collection of types used for parsing environment
variables.
(ENTRY): Preprocess string lengths of environment variables.
(OMP_VAR_CNT): Preprocess table size.
(OMP_HOST_VAR_CNT): Likewise.
(INT_MAX_STR_LEN): Constant for the maximal number of digits of a device
number.
(gomp_get_icv_flag): Returns if a flag for a particular ICV is set.
(gomp_set_icv_flag): Sets a flag for a particular ICV.
(print_device_specific_icvs): New helper function for omp_display_env to
print device specific ICV values.
(get_device_num): New helper function for parse_device_specific.
Extracts the device number from an environment variable name.
(get_icv_member_addr): Gets the memory address for a particular member
of an ICV struct.
(gomp_get_initial_icv_item): Get a list item of gomp_initial_icv_list.
(initialize_icvs): New function to initialize a gomp_initial_icvs
struct.
(add_initial_icv_to_list): Adds an ICV struct to gomp_initial_icv_list.
(startswith): Checks if a string starts with a given prefix.
(initialize_env): Extended to parse the new syntax of environment
variables.
* icv-device.c (omp_get_max_teams): Added.
(ialias): Likewise.
(omp_set_num_teams): Likewise.
* icv.c (omp_set_num_teams): Moved to icv-device.c.
(omp_get_max_teams): Likewise.
(ialias): Likewise.
* libgomp-plugin.h (GOMP_DEVICE_NUM_VAR): Removed.
(GOMP_ADDITIONAL_ICVS): New target-side struct that
holds the designated ICVs of the target device.
* libgomp.h (enum gomp_icvs): Collection of ICVs.
(enum gomp_device_num): Definition of device numbers for _ALL, _DEV, and
no suffix.
(enum gomp_env_suffix): Collection of possible suffixes of environment
variables.
(struct gomp_initial_icvs): Contains all ICVs for which we need to store
initial values.
(struct gomp_default_icv):New struct to hold ICVs for which we need
to store initial values.
(struct gomp_icv_list): Definition of a linked list that is used for
storing ICVs for the devices and also for _DEV, _ALL, and without
suffix.
(struct gomp_offload_icvs): New struct to hold ICVs that are copied to
a device.
(struct gomp_offload_icv_list): Definition of a linked list that holds
device-specific ICVs that are copied to devices.
(gomp_get_initial_icv_item): Get a list item of gomp_initial_icv_list.
(gomp_get_icv_flag): Returns if a flag for a particular ICV is set.
* libgomp.texi: Updated.
* plugin/plugin-gcn.c (GOMP_OFFLOAD_load_image): Extended to read
further ICVs from the offload image.
* plugin/plugin-nvptx.c (GOMP_OFFLOAD_load_image): Likewise.
* target.c (gomp_get_offload_icv_item): Get a list item of
gomp_offload_icv_list.
(get_gomp_offload_icvs): New. Returns the ICV values
depending on the device num and the variable hierarchy.
(gomp_load_image_to_device): Extended to copy further ICVs to a device.
* testsuite/libgomp.c-c++-common/icv-5.c: New test.
* testsuite/libgomp.c-c++-common/icv-6.c: New test.
* testsuite/libgomp.c-c++-common/icv-7.c: New test.
* testsuite/libgomp.c-c++-common/icv-8.c: New test.
* testsuite/libgomp.c-c++-common/omp-display-env-1.c: New test.
* testsuite/libgomp.c-c++-common/omp-display-env-2.c: New test.
Diffstat (limited to 'libgomp/testsuite')
-rw-r--r-- | libgomp/testsuite/libgomp.c-c++-common/icv-5.c | 25 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c-c++-common/icv-6.c | 45 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c-c++-common/icv-7.c | 26 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c-c++-common/icv-8.c | 26 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c-c++-common/omp-display-env-1.c | 119 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c-c++-common/omp-display-env-2.c | 22 |
6 files changed, 263 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c-c++-common/icv-5.c b/libgomp/testsuite/libgomp.c-c++-common/icv-5.c new file mode 100644 index 0000000..431cfc7 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/icv-5.c @@ -0,0 +1,25 @@ +/* { dg-do run } */ +/* { dg-set-target-env-var OMP_NUM_TEAMS_DEV_0 "42" } */ +/* { dg-set-target-env-var OMP_NUM_TEAMS_DEV_1 "43" } */ +/* { dg-set-target-env-var OMP_NUM_TEAMS_DEV_2 "44" } */ +/* { dg-set-target-env-var OMP_NUM_TEAMS_ALL "45" } */ +/* { dg-set-target-env-var OMP_NUM_TEAMS_DEV "46" } */ +/* { dg-set-target-env-var OMP_NUM_TEAMS "47" } */ + +#include <omp.h> +#include <stdlib.h> + +int +main () +{ + if (omp_get_max_teams () != 47) + abort (); + + int num_devices = omp_get_num_devices () > 3 ? 3 : omp_get_num_devices (); + for (int i=0; i < num_devices; i++) + #pragma omp target device (i) + if (omp_get_max_teams () != 42 + i) + abort (); + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/icv-6.c b/libgomp/testsuite/libgomp.c-c++-common/icv-6.c new file mode 100644 index 0000000..7151bd1 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/icv-6.c @@ -0,0 +1,45 @@ +/* { dg-do run } */ +/* { dg-set-target-env-var OMP_NUM_TEAMS_ALL "42" } */ +/* { dg-set-target-env-var OMP_NUM_TEAMS_DEV "43" } */ +/* { dg-set-target-env-var OMP_SCHEDULE_ALL "guided,4" } */ +/* { dg-set-target-env-var OMP_DYNAMIC_ALL "true" } */ +/* { dg-set-target-env-var OMP_TEAMS_THREAD_LIMIT_ALL "44" } */ +/* { dg-set-target-env-var OMP_THREAD_LIMIT_ALL "45" } */ +/* { dg-set-target-env-var OMP_NUM_THREADS_ALL "46,3,2" } */ +/* { dg-set-target-env-var OMP_MAX_ACTIVE_LEVELS_ALL "47" } */ +/* { dg-set-target-env-var OMP_PROC_BIND_ALL "spread" } */ +/* { dg-set-target-env-var OMP_WAIT_POLICY_ALL "active" } */ + +/* This tests the hierarchical usage of ICVs on the device, i.e. if + OMP_NUM_TEAMS_DEV_<device_num> is not configured, then the value of + OMP_NUM_TEAMS_DEV should be used. And if there is no environment variable + without suffix, then the corresponding _ALL variant should be used. */ + +#include <omp.h> +#include <stdlib.h> + +int +main () +{ + enum omp_sched_t kind; + int chunk_size; + omp_get_schedule(&kind, &chunk_size); + + if (omp_get_max_teams () != 42 + || !omp_get_dynamic () + || kind != 3 || chunk_size != 4 + || omp_get_teams_thread_limit () != 44 + || omp_get_thread_limit () != 45 + || omp_get_max_threads () != 46 + || omp_get_proc_bind () != omp_proc_bind_spread + || omp_get_max_active_levels () != 47) + abort (); + + int num_devices = omp_get_num_devices () > 3 ? 3 : omp_get_num_devices (); + for (int i=0; i < num_devices; i++) + #pragma omp target device (i) + if (omp_get_max_teams () != 43) + abort (); + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/icv-7.c b/libgomp/testsuite/libgomp.c-c++-common/icv-7.c new file mode 100644 index 0000000..70a716d --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/icv-7.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-set-target-env-var OMP_NUM_TEAMS_ALL "42" } */ + +/* This tests the hierarchical usage of ICVs on the host and on devices, i.e. if + OMP_NUM_TEAMS_DEV_<device_num>, OMP_NUM_TEAMS_DEV, and + OMP_NUM_TEAMS are not configured, then the value of + OMP_NUM_TEAMS_ALL should be used for the host as well as for the + devices. */ + +#include <omp.h> +#include <stdlib.h> + +int +main () +{ + if (omp_get_max_teams () != 42) + abort (); + + int num_devices = omp_get_num_devices () > 3 ? 3 : omp_get_num_devices (); + for (int i=0; i < num_devices; i++) + #pragma omp target device (i) + if (omp_get_max_teams () != 42) + abort (); + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/icv-8.c b/libgomp/testsuite/libgomp.c-c++-common/icv-8.c new file mode 100644 index 0000000..f25ce45 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/icv-8.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-set-target-env-var OMP_NUM_TEAMS_DEV_1234567890 "42" } */ +/* { dg-set-target-env-var OMP_NUM_TEAMS_DEV_ "43" } */ +/* { dg-set-target-env-var OMP_NUM_TEAMS_DEV_01 "44" } */ +/* { dg-set-target-env-var OMP_NUM_TEAMS_DEV_a "45" } */ +/* { dg-set-target-env-var OMP_NUM_TEAMS_DEV_12345678901 "46" } */ +/* { dg-set-target-env-var OMP_NUM_TEAMS_DEV_-1 "47" } */ +/* { dg-set-target-env-var "OMP_NUM_TEAMS_DEV_ 1" "48" } */ +/* { dg-set-target-env-var "OMP_NUM_TEAMS_DEV_00" "49" } */ + +#include <omp.h> +#include <stdlib.h> + +int +main () +{ + return 0; +} + +/* { dg-output ".*Invalid device number in OMP_NUM_TEAMS_DEV_=43.*" { target native } } */ +/* { dg-output ".*Invalid device number in OMP_NUM_TEAMS_DEV_01=44.*" { target native } } */ +/* { dg-output ".*Invalid device number in OMP_NUM_TEAMS_DEV_a=45.*" { target native } } */ +/* { dg-output ".*Invalid device number in OMP_NUM_TEAMS_DEV_12345678901=46.*" { target native } } */ +/* { dg-output ".*Invalid device number in OMP_NUM_TEAMS_DEV_-1=47.*" { target native } } */ +/* { dg-output ".*Invalid device number in OMP_NUM_TEAMS_DEV_ 1=48.*" { target native } } */ +/* { dg-output ".*Invalid device number in OMP_NUM_TEAMS_DEV_00=49.*" { target native } } */ diff --git a/libgomp/testsuite/libgomp.c-c++-common/omp-display-env-1.c b/libgomp/testsuite/libgomp.c-c++-common/omp-display-env-1.c new file mode 100644 index 0000000..9ea7ade --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/omp-display-env-1.c @@ -0,0 +1,119 @@ +/* { dg-do run } */ +/* { dg-set-target-env-var OMP_THREAD_LIMIT_DEV_24 "42" } */ +/* { dg-set-target-env-var OMP_THREAD_LIMIT_ALL "43" } */ +/* { dg-set-target-env-var OMP_THREAD_LIMIT_DEV "44" } */ +/* { dg-set-target-env-var OMP_THREAD_LIMIT "45" } */ +/* { dg-set-target-env-var OMP_DEFAULT_DEVICE "42" } */ +/* { dg-set-target-env-var OMP_SCHEDULE_DEV_24 "guided,4" } */ +/* { dg-set-target-env-var OMP_SCHEDULE_ALL "dynamic" } */ +/* { dg-set-target-env-var OMP_SCHEDULE_DEV "guided,1" } */ +/* { dg-set-target-env-var OMP_SCHEDULE "guided,2" } */ +/* { dg-set-target-env-var OMP_DYNAMIC_DEV_24 "true" } */ + +/* { dg-set-target-env-var OMP_DYNAMIC_ALL "true" } */ +/* { dg-set-target-env-var OMP_DYNAMIC_DEV "true" } */ +/* { dg-set-target-env-var OMP_DYNAMIC "true" } */ +/* { dg-set-target-env-var OMP_NUM_THREADS "4,3,2" } */ +/* { dg-set-target-env-var OMP_NUM_THREADS_ALL "45,46,47" } */ +/* { dg-set-target-env-var OMP_NUM_THREADS_DEV "42,43,44" } */ +/* { dg-set-target-env-var OMP_NUM_THREADS_DEV_24 "14,13,12" } */ +/* { dg-set-target-env-var OMP_MAX_ACTIVE_LEVELS "42" } */ +/* { dg-set-target-env-var OMP_MAX_ACTIVE_LEVELS_ALL "43" } */ +/* { dg-set-target-env-var OMP_MAX_ACTIVE_LEVELS_DEV "44" } */ + +/* { dg-set-target-env-var OMP_MAX_ACTIVE_LEVELS_DEV_24 "45" } */ +/* { dg-set-target-env-var OMP_NUM_TEAMS "42" } */ +/* { dg-set-target-env-var OMP_NUM_TEAMS_ALL "43" } */ +/* { dg-set-target-env-var OMP_NUM_TEAMS_DEV "44" } */ +/* { dg-set-target-env-var OMP_NUM_TEAMS_DEV_24 "45" } */ +/* { dg-set-target-env-var OMP_PROC_BIND "spread" } */ +/* { dg-set-target-env-var OMP_PROC_BIND_ALL "close" } */ +/* { dg-set-target-env-var OMP_PROC_BIND_DEV "spread,spread" } */ +/* { dg-set-target-env-var OMP_PROC_BIND_DEV_24 "spread,close" } */ +/* { dg-set-target-env-var OMP_STACKSIZE "42" } */ + +/* { dg-set-target-env-var OMP_STACKSIZE_ALL "42 M" } */ +/* { dg-set-target-env-var OMP_STACKSIZE_DEV "43 k" } */ +/* { dg-set-target-env-var OMP_STACKSIZE_DEV_24 "44" } */ +/* { dg-set-target-env-var OMP_WAIT_POLICY "active" } */ +/* { dg-set-target-env-var OMP_WAIT_POLICY_ALL "ACTIVE" } */ +/* { dg-set-target-env-var OMP_WAIT_POLICY_DEV "passive" } */ +/* { dg-set-target-env-var OMP_WAIT_POLICY_DEV_24 "PASSIVE" } */ +/* { dg-set-target-env-var OMP_TEAMS_THREAD_LIMIT "42" } */ +/* { dg-set-target-env-var OMP_TEAMS_THREAD_LIMIT_ALL "43" } */ +/* { dg-set-target-env-var OMP_TEAMS_THREAD_LIMIT_DEV "44" } */ + +/* { dg-set-target-env-var OMP_TEAMS_THREAD_LIMIT_DEV_24 "45" } */ +/* { dg-set-target-env-var OMP_CANCELLATION "true" } */ +/* { dg-set-target-env-var OMP_DISPLAY_AFFINITY "true" } */ +/* { dg-set-target-env-var OMP_TARGET_OFFLOAD "mandatory" } */ +/* { dg-set-target-env-var OMP_MAX_TASK_PRIORITY "20" } */ +/* { dg-set-target-env-var OMP_ALLOCATOR "omp_const_mem_alloc" } */ +/* { dg-set-target-env-var OMP_NESTED "false" } */ + +#include <omp.h> +#include <stdlib.h> + +int +main () +{ + omp_display_env (1); + return 0; +} + +/* { dg-output ".*\\\[host] OMP_DYNAMIC = 'TRUE'.*" { target native } } */ +/* { dg-output ".*\\\[all] OMP_DYNAMIC = 'TRUE'.*" { target native } } */ +/* { dg-output ".*\\\[device] OMP_DYNAMIC = 'TRUE'.*" { target native } } */ +/* { dg-output ".*\\\[24\] OMP_DYNAMIC = 'TRUE'.*" { target native } } */ + +/* { dg-output ".*\\\[host] OMP_NUM_THREADS = '4,3,2'.*" { target native } } */ +/* { dg-output ".*\\\[all\] OMP_NUM_THREADS = '45,46,47'.*" { target native } } */ +/* { dg-output ".*\\\[device\] OMP_NUM_THREADS = '42,43,44'.*" { target native } } */ +/* { dg-output ".*\\\[24\] OMP_NUM_THREADS = '14,13,12'.*" { target native } } */ + +/* { dg-output ".*\\\[host] OMP_SCHEDULE = 'GUIDED,2'.*" { target native } } */ +/* { dg-output ".*\\\[all\] OMP_SCHEDULE = 'DYNAMIC'.*" { target native } } */ +/* { dg-output ".*\\\[device\] OMP_SCHEDULE = 'GUIDED'.*" { target native } } */ +/* { dg-output ".*\\\[24\] OMP_SCHEDULE = 'GUIDED,4'.*" { target native } } */ + +/* { dg-output ".*\\\[host] OMP_PROC_BIND = 'SPREAD'.*" { target native } } */ +/* { dg-output ".*\\\[all\] OMP_PROC_BIND = 'CLOSE'.*" { target native } } */ +/* { dg-output ".*\\\[device\] OMP_PROC_BIND = 'SPREAD,SPREAD'.*" { target native } } */ +/* { dg-output ".*\\\[24\] OMP_PROC_BIND = 'SPREAD,CLOSE'.*" { target native } } */ + +/* { dg-output ".*\\\[host] OMP_STACKSIZE = '43008'.*" { target native } } */ +/* { dg-output ".*\\\[all\] OMP_STACKSIZE = '44040192'.*" { target native } } */ +/* { dg-output ".*\\\[device\] OMP_STACKSIZE = '44032'.*" { target native } } */ +/* { dg-output ".*\\\[24\] OMP_STACKSIZE = '45056'.*" { target native } } */ + +/* { dg-output ".*\\\[host] OMP_WAIT_POLICY = 'ACTIVE'.*" { target native } } */ +/* { dg-output ".*\\\[all\] OMP_WAIT_POLICY = 'ACTIVE'.*" { target native } } */ +/* { dg-output ".*\\\[device\] OMP_WAIT_POLICY = 'PASSIVE'.*" { target native } } */ +/* { dg-output ".*\\\[24\] OMP_WAIT_POLICY = 'PASSIVE'.*" { target native } } */ + +/* { dg-output ".*\\\[host] OMP_THREAD_LIMIT = '45'.*" { target native } } */ +/* { dg-output ".*\\\[all\] OMP_THREAD_LIMIT = '43'.*" { target native } } */ +/* { dg-output ".*\\\[device\] OMP_THREAD_LIMIT = '44'.*" { target native } } */ +/* { dg-output ".*\\\[24\] OMP_THREAD_LIMIT = '42'.*" { target native } } */ + +/* { dg-output ".*\\\[host] OMP_MAX_ACTIVE_LEVELS = '42'.*" { target native } } */ +/* { dg-output ".*\\\[all\] OMP_MAX_ACTIVE_LEVELS = '43'.*" { target native } } */ +/* { dg-output ".*\\\[device\] OMP_MAX_ACTIVE_LEVELS = '44'.*" { target native } } */ +/* { dg-output ".*\\\[24\] OMP_MAX_ACTIVE_LEVELS = '45'.*" { target native } } */ + +/* { dg-output ".*\\\[host] OMP_NUM_TEAMS = '42'.*" { target native } } */ +/* { dg-output ".*\\\[all\] OMP_NUM_TEAMS = '43'.*" { target native } } */ +/* { dg-output ".*\\\[device\] OMP_NUM_TEAMS = '44'.*" { target native } } */ +/* { dg-output ".*\\\[24\] OMP_NUM_TEAMS = '45'.*" { target native } } */ + +/* { dg-output ".*\\\[host] OMP_TEAMS_THREAD_LIMIT = '42'.*" { target native } } */ +/* { dg-output ".*\\\[all\] OMP_TEAMS_THREAD_LIMIT = '43'.*" { target native } } */ +/* { dg-output ".*\\\[device\] OMP_TEAMS_THREAD_LIMIT = '44'.*" { target native } } */ +/* { dg-output ".*\\\[24\] OMP_TEAMS_THREAD_LIMIT = '45'.*" { target native } } */ + +/* { dg-output ".*\\\[all] OMP_CANCELLATION = 'TRUE'.*" { target native } } */ +/* { dg-output ".*\\\[all] OMP_DEFAULT_DEVICE = '42'.*" { target native } } */ +/* { dg-output ".*\\\[all] OMP_MAX_TASK_PRIORITY = '20'.*" { target native } } */ +/* { dg-output ".*\\\[all] OMP_DISPLAY_AFFINITY = 'TRUE'.*" { target native } } */ +/* { dg-output ".*\\\[host] OMP_ALLOCATOR = 'omp_const_mem_alloc'.*" { target native } } */ +/* { dg-output ".*\\\[all] OMP_TARGET_OFFLOAD = 'MANDATORY'.*" { target native } } */ diff --git a/libgomp/testsuite/libgomp.c-c++-common/omp-display-env-2.c b/libgomp/testsuite/libgomp.c-c++-common/omp-display-env-2.c new file mode 100644 index 0000000..e1beef4 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/omp-display-env-2.c @@ -0,0 +1,22 @@ +/* { dg-do run } */ +/* { dg-set-target-env-var OMP_NUM_TEAMS "42" } */ + +/* This test checks if omp_display_env outputs the initial ICV values although + the value was updated. */ + +#include <omp.h> +#include <stdlib.h> + +int +main () +{ + omp_display_env (1); + omp_set_num_teams (24); + if (omp_get_max_teams () != 24) + abort (); + omp_display_env (1); + + return 0; +} + +/* { dg-output ".*\\\[host] OMP_NUM_TEAMS = '42'.*\\\[host] OMP_NUM_TEAMS = '42'" { target native } } */ |