From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id C6D533857010; Mon, 12 Sep 2022 08:49:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C6D533857010 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662972582; bh=jo/5ql3Uci9J1+ZY8u67+GYORkcn3E09UJZ3GxTcwTE=; h=From:To:Subject:Date:From; b=eRyhY6lg5aj3xnApasUsyS6xxnsj1z3Fi1q8VpR4rssHdjEzFGAFfRe6I1Sbt2t8B 8Y3zQ4t6G3oXrcXs2T+NlBA/TJBaiTk/RPyC+/VQd0TnJi4k5ZJTSs3a0iBuR9xXhd tEOdrosvqQU1/39cQBvdwAmDJrxDNZFCOdafn2FU= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-2617] libgomp: Fix up icv-6.c [PR106894] X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/master X-Git-Oldrev: 643ae816f17745a77b62188b6bf169211609a59b X-Git-Newrev: 994ea892bd02dd8a1c04875ad3553c57939c3abf Message-Id: <20220912084942.C6D533857010@sourceware.org> Date: Mon, 12 Sep 2022 08:49:42 +0000 (GMT) List-Id: https://gcc.gnu.org/g:994ea892bd02dd8a1c04875ad3553c57939c3abf commit r13-2617-g994ea892bd02dd8a1c04875ad3553c57939c3abf Author: Jakub Jelinek Date: Mon Sep 12 10:48:19 2022 +0200 libgomp: Fix up icv-6.c [PR106894] The thing is, make check or make check RUNTESTFLAGS="c.exp='icv-6.c' c++.exp='icv-6.c'" in libgomp obj dir work fine, but make -j32 -k check RUNTESTFLAGS="c.exp='icv-6.c' c++.exp='icv-6.c'" fails. The thing is that the testcase as written relies on OMP_NUM_THREADS not being set in environment (as it takes priority over OMP_NUM_THREADS_ALL for the host). So, if either a user has OMP_NUM_THREADS=42 in the environment by himself, or when doing make check with -jN, we trigger: if test $$num_cpus -gt 8 && test -z "$$OMP_NUM_THREADS"; then \ OMP_NUM_THREADS=8; export OMP_NUM_THREADS; \ echo @@@ libgomp OMP_NUM_THREADS adjusted to 8 because of parallel make check and too many CPUs; \ fi; \ in libgomp/testsuite/Makefile.am and so the test fails. 2022-09-12 Jakub Jelinek PR libgomp/106894 * testsuite/libgomp.c-c++-common/icv-6.c: Include string.h. (main): Avoid tests for which corresponding non-_ALL suffixed variable is in the environment, or for OMP_NUM_TEAMS on the device OMP_NUM_TEAMS_DEV_?. Diff: --- libgomp/testsuite/libgomp.c-c++-common/icv-6.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/libgomp/testsuite/libgomp.c-c++-common/icv-6.c b/libgomp/testsuite/libgomp.c-c++-common/icv-6.c index 7151bd1e2b3..e199a185920 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/icv-6.c +++ b/libgomp/testsuite/libgomp.c-c++-common/icv-6.c @@ -17,6 +17,7 @@ #include #include +#include int main () @@ -25,21 +26,28 @@ main () 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) + if ((!getenv ("OMP_NUM_TEAMS") && omp_get_max_teams () != 42) + || (!getenv ("OMP_DYNAMIC") && !omp_get_dynamic ()) + || (!getenv ("OMP_SCHEDULE") && (kind != 3 || chunk_size != 4)) + || (!getenv ("OMP_TEAMS_THREAD_LIMIT") && omp_get_teams_thread_limit () != 44) + || (!getenv ("OMP_THREAD_LIMIT") && omp_get_thread_limit () != 45) + || (!getenv ("OMP_NUM_THREADS") && omp_get_max_threads () != 46) + || (!getenv ("OMP_PROC_BIND") && omp_get_proc_bind () != omp_proc_bind_spread) + || (!getenv ("OMP_MAX_ACTIVE_LEVELS") && 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++) + for (int i = 0; i < num_devices; i++) + { + char name[sizeof ("OMP_NUM_TEAMS_DEV_1")]; + strcpy (name, "OMP_NUM_TEAMS_DEV_1"); + name[sizeof ("OMP_NUM_TEAMS_DEV_1") - 2] = '0' + i; + if (getenv (name)) + continue; #pragma omp target device (i) if (omp_get_max_teams () != 43) abort (); + } return 0; }