From patchwork Tue Oct 12 07:42:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 46118 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 548C33858402 for ; Tue, 12 Oct 2021 07:43:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 548C33858402 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1634024612; bh=PPi4QkXKNGgH7AvWWjdf0YzU9Ul6htMzAR47xaAD1Ao=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=IeMckPz6XRUyrh9EIVk2xOxS40p63pebINHvRP5gdTcWxwBW/u5BmnWLgvXr0uzPE dKn+JYx3vCVsbL1/iSfNvw4g3nh7lMRZfQ2e4FZjXiIIcxva0fTQUmONS0fhl/IiEK mn/WBaHdwIwGEHpZRR7S1E6Ivk/CiYQ7qp9uE580= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 7D4663858C3A for ; Tue, 12 Oct 2021 07:43:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7D4663858C3A Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-548-_YplTpzOOIKLxJSGd5hLNQ-1; Tue, 12 Oct 2021 03:43:00 -0400 X-MC-Unique: _YplTpzOOIKLxJSGd5hLNQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AA01410B3941; Tue, 12 Oct 2021 07:42:58 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.193.109]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F0C7219C79; Tue, 12 Oct 2021 07:42:57 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 19C7gtDN1077345 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 12 Oct 2021 09:42:55 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 19C7gsxG1077344; Tue, 12 Oct 2021 09:42:54 +0200 Date: Tue, 12 Oct 2021 09:42:53 +0200 To: gcc-patches@gcc.gnu.org Subject: [committed] openmp: Add testsuite coverage for omp_{get_max,set_num}_threads and omp_{s,g}et_teams_thread_limit Message-ID: <20211012074253.GY304296@tucnak> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Cc: Tobias Burnus Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi! This adds (C/C++ only) testsuite coverage for these new OpenMP 5.1 APIs. Regtested on x86_64-linux and i686-linux, committed to trunk. 2021-10-12 Jakub Jelinek * testsuite/libgomp.c-c++-common/icv-3.c: New test. * testsuite/libgomp.c-c++-common/icv-4.c: New test. Jakub --- libgomp/testsuite/libgomp.c-c++-common/icv-3.c.jj 2021-10-11 17:16:35.455296745 +0200 +++ libgomp/testsuite/libgomp.c-c++-common/icv-3.c 2021-10-11 17:19:14.358023413 +0200 @@ -0,0 +1,54 @@ +#include +#include + +int +main () +{ + if (getenv ("OMP_NUM_TEAMS") == NULL + && omp_get_max_teams () != 0) + abort (); + omp_set_num_teams (7); + if (omp_get_max_teams () != 7) + abort (); + if (getenv ("OMP_TEAMS_THREAD_LIMIT") == NULL + && omp_get_teams_thread_limit () != 0) + abort (); + omp_set_teams_thread_limit (15); + if (omp_get_teams_thread_limit () != 15) + abort (); + #pragma omp teams + { + if (omp_get_max_teams () != 7 + || omp_get_teams_thread_limit () != 15 + || omp_get_num_teams () < 1 + || omp_get_num_teams () > 7 + || omp_get_team_num () < 0 + || omp_get_team_num () >= omp_get_num_teams () + || omp_get_thread_limit () < 1 + || omp_get_thread_limit () > 15) + abort (); + } + #pragma omp teams num_teams(5) thread_limit (13) + { + if (omp_get_max_teams () != 7 + || omp_get_teams_thread_limit () != 15 + || omp_get_num_teams () != 5 + || omp_get_team_num () < 0 + || omp_get_team_num () >= omp_get_num_teams () + || omp_get_thread_limit () < 1 + || omp_get_thread_limit () > 13) + abort (); + } + #pragma omp teams num_teams(8) thread_limit (16) + { + if (omp_get_max_teams () != 7 + || omp_get_teams_thread_limit () != 15 + || omp_get_num_teams () != 8 + || omp_get_team_num () < 0 + || omp_get_team_num () >= omp_get_num_teams () + || omp_get_thread_limit () < 1 + || omp_get_thread_limit () > 16) + abort (); + } + return 0; +} --- libgomp/testsuite/libgomp.c-c++-common/icv-4.c.jj 2021-10-11 17:17:22.963617081 +0200 +++ libgomp/testsuite/libgomp.c-c++-common/icv-4.c 2021-10-11 17:22:35.797141533 +0200 @@ -0,0 +1,40 @@ +/* { dg-set-target-env-var OMP_NUM_TEAMS "6" } */ +/* { dg-set-target-env-var OMP_TEAMS_THREAD_LIMIT "12" } */ + +#include +#include +#include + +int +main () +{ + if (getenv ("OMP_NUM_TEAMS") != NULL + && strcmp (getenv ("OMP_NUM_TEAMS"), "6") == 0) + { + if (omp_get_max_teams () != 6) + abort (); + } + else + omp_set_num_teams (6); + if (getenv ("OMP_TEAMS_THREAD_LIMIT") == NULL + && strcmp (getenv ("OMP_TEAMS_THREAD_LIMIT"), "12") == 0) + { + if (omp_get_teams_thread_limit () != 12) + abort (); + } + else + omp_set_teams_thread_limit (12); + #pragma omp teams + { + if (omp_get_max_teams () != 6 + || omp_get_teams_thread_limit () != 12 + || omp_get_num_teams () < 1 + || omp_get_num_teams () > 6 + || omp_get_team_num () < 0 + || omp_get_team_num () >= omp_get_num_teams () + || omp_get_thread_limit () < 1 + || omp_get_thread_limit () > 12) + abort (); + } + return 0; +}