From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 53D4B3857004 for ; Mon, 12 Sep 2022 08:52:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 53D4B3857004 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662972773; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=bmp8d8qkNb4D1gU1XRtbisSFfiFiYNgwaX7Iebx1FwY=; b=UNeVGz44E8Ot3XlJPE4IAZrRja7bdcdvbQl0TZvm5izDK8WjUhCZZP9Topetuzn1J/VEXR RKnVlNhoKj++C5w2hUrJ6VuDeDzkG6vfMSldXUIEAixp21lHj4mnKFHP9hZCUNdsqT5q1U smyzdvE8qxlFSFm28ZF1Qikctb3L50o= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-533-b5wWuzzNOAq3cYwzPJYZ0Q-1; Mon, 12 Sep 2022 04:52:50 -0400 X-MC-Unique: b5wWuzzNOAq3cYwzPJYZ0Q-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 79CD180418F; Mon, 12 Sep 2022 08:52:50 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 27EEB17584; Mon, 12 Sep 2022 08:52:50 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 28C8qlMr166933 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 12 Sep 2022 10:52:48 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 28C8qkCK166932; Mon, 12 Sep 2022 10:52:46 +0200 Date: Mon, 12 Sep 2022 10:52:46 +0200 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Cc: Marcel Vollweiler , Tobias Burnus Subject: [committed] libgomp: Fix up icv-6.c [PR106894] Message-ID: Reply-To: Jakub Jelinek MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi! 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. Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk. 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_?. --- libgomp/testsuite/libgomp.c-c++-common/icv-6.c.jj 2022-09-08 20:22:07.903182970 +0200 +++ libgomp/testsuite/libgomp.c-c++-common/icv-6.c 2022-09-09 17:00:36.409255776 +0200 @@ -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; } Jakub