From patchwork Mon Sep 29 14:56:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Tannenbaum, Barry M" X-Patchwork-Id: 394486 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id A9E4F14010C for ; Tue, 30 Sep 2014 00:56:25 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:references:in-reply-to :content-type:content-transfer-encoding:mime-version; q=dns; s= default; b=Kln7Gj9LsHrHlxwXTTeYBuoGV7ZJdqG6iTEhCa3EBS2SwJDCuQtao IZbJG/PJSAHAdYEpQuLdp1ct/QOWnukIrSdgTOhoRrK+jzVgb2Dl3N06pq1aOQZ1 tqvYfwpU5nl6kAby6YnUAV6ogRg4v0jorpe2VDdZDo+ZovyfBArk2o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:references:in-reply-to :content-type:content-transfer-encoding:mime-version; s=default; bh=ioNazGOQ3QSnZoKiMXxgsmP7ycM=; b=hvP35cDlFUf6ivPWW7gK4KiqmxBS DMZZGGIXPl9dnL0LqC/Bv/fERkDwm1E5OAQcH5AUIB1c+nCQM0eLWCcb6QNzaKi6 lVjRjlxTvaISXC7Qv1OVbXTduyYFYkwgNyf2fsWgIybpPROaFBckb/So8jYmXP7A PBfCy/Webz4FVZk= Received: (qmail 22591 invoked by alias); 29 Sep 2014 14:56:18 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 22577 invoked by uid 89); 29 Sep 2014 14:56:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=BAYES_00, MIME_BASE64_BLANKS, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mga14.intel.com Received: from mga14.intel.com (HELO mga14.intel.com) (192.55.52.115) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 29 Sep 2014 14:56:15 +0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 29 Sep 2014 07:46:52 -0700 X-ExtLoop1: 1 Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga001.fm.intel.com with ESMTP; 29 Sep 2014 07:56:12 -0700 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.195.1; Mon, 29 Sep 2014 07:56:12 -0700 Received: from fmsmsx107.amr.corp.intel.com ([169.254.9.132]) by FMSMSX112.amr.corp.intel.com ([10.18.116.6]) with mapi id 14.03.0195.001; Mon, 29 Sep 2014 07:56:12 -0700 From: "Tannenbaum, Barry M" To: Thomas Schwinge , "Iyer, Balaji V" , "Zamyatin, Igor" CC: "gcc-patches@gcc.gnu.org" Subject: RE: FW: [PATCH] Cilk Keywords (_Cilk_spawn and _Cilk_sync) for C Date: Mon, 29 Sep 2014 14:56:11 +0000 Message-ID: <6B86B7F2A4026246AA81BA1ABF9756905C50C774@fmsmsx107.amr.corp.intel.com> References: <52012923.6030409@redhat.com> <5204C718.9050402@redhat.com> <5214DD51.9030709@redhat.com> <521641C6.6060807@redhat.com> <87vbof3gji.fsf@kepler.schwinge.homeip.net> <6B86B7F2A4026246AA81BA1ABF9756905C4FF96C@FMSMSX105.amr.corp.intel.com> <8761g6g0je.fsf@kepler.schwinge.homeip.net> <6B86B7F2A4026246AA81BA1ABF9756905C50C72F@fmsmsx107.amr.corp.intel.com> <87vbo67ba6.fsf@schwinge.name> In-Reply-To: <87vbo67ba6.fsf@schwinge.name> MIME-Version: 1.0 Looks good to me. I apologize for spamming you with the extra details. I wasn't clear that this was a patch instead of a bug report. I believe that Igor is the one who controls the GCC submission for Cilk Plus. - Barry -----Original Message----- From: Thomas Schwinge [mailto:thomas@codesourcery.com] Sent: Monday, September 29, 2014 10:27 AM To: Tannenbaum, Barry M; Iyer, Balaji V; Zamyatin, Igor Cc: gcc-patches@gcc.gnu.org Subject: RE: FW: [PATCH] Cilk Keywords (_Cilk_spawn and _Cilk_sync) for C Hi! On Mon, 29 Sep 2014 13:58:31 +0000, "Tannenbaum, Barry M" wrote: > In a nutshell, add the following code to main() before the call to f3(): > > int status = __cilkrts_set_param("nworkers", "2"); > if (0 != status) { > // Failed to set the number of Cilk workers > return status; > } Yeah, that's what I had proposed with the patch at the end of my previous email, . I'm sorry if I didn't make it obvious that more text and the patch were following after the full-quote of the original issue description. > Here's the details: [...] Thanks again for your helpful comments; that's appreciated. Here's again my proposed patch. Note, that the include paths in GCC compiler testing (gcc/testsuite/) are not set up to pick up the include file, so I've manually added a propotype for the __cilkrts_set_param function to the three files. I can change that, if requested. commit ee7138e451d1f3284d6fa0f61fe517c82db94060 Author: Thomas Schwinge Date: Mon Sep 29 12:47:34 2014 +0200 Audit Cilk Plus tests for CILK_NWORKERS=1. gcc/testsuite/ * c-c++-common/cilk-plus/CK/spawning_arg.c (main): Call __cilkrts_set_param to set two workers. * c-c++-common/cilk-plus/CK/steal_check.c (main): Likewise. * g++.dg/cilk-plus/CK/catch_exc.cc (main): Likewise. --- gcc/testsuite/c-c++-common/cilk-plus/CK/spawning_arg.c | 15 +++++++++++++++ gcc/testsuite/c-c++-common/cilk-plus/CK/steal_check.c | 17 ++++++++++++++--- gcc/testsuite/g++.dg/cilk-plus/CK/catch_exc.cc | 14 ++++++++++++++ 3 files changed, 43 insertions(+), 3 deletions(-) Grüße, Thomas diff --git gcc/testsuite/c-c++-common/cilk-plus/CK/spawning_arg.c gcc/testsuite/c-c++-common/cilk-plus/CK/spawning_arg.c index 95e6cab..138b82c 100644 --- gcc/testsuite/c-c++-common/cilk-plus/CK/spawning_arg.c +++ gcc/testsuite/c-c++-common/cilk-plus/CK/spawning_arg.c @@ -2,6 +2,17 @@ /* { dg-options "-fcilkplus" } */ /* { dg-additional-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */ +#ifdef __cplusplus +extern "C" { +#endif + +extern int __cilkrts_set_param (const char *, const char *); + +#ifdef __cplusplus +} +#endif + + void f0(volatile int *steal_flag) { int i = 0; @@ -32,6 +43,10 @@ void f3() int main() { + /* Ensure more than one worker. */ + if (__cilkrts_set_param("nworkers", "2") != 0) + __builtin_abort(); + f3(); return 0; } diff --git gcc/testsuite/c-c++-common/cilk-plus/CK/steal_check.c gcc/testsuite/c-c++-common/cilk-plus/CK/steal_check.c index 6e28765..6b41c7f 100644 --- gcc/testsuite/c-c++-common/cilk-plus/CK/steal_check.c +++ gcc/testsuite/c-c++-common/cilk-plus/CK/steal_check.c @@ -2,8 +2,16 @@ /* { dg-options "-fcilkplus" } */ /* { dg-additional-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */ -// #include -extern void __cilkrts_set_param (char *, char *); +#ifdef __cplusplus +extern "C" { +#endif + +extern int __cilkrts_set_param (const char *, const char *); + +#ifdef __cplusplus +} +#endif + void foo(volatile int *); @@ -11,7 +19,10 @@ void main2(void); int main(void) { - // __cilkrts_set_param ((char *)"nworkers", (char *)"2"); + /* Ensure more than one worker. */ + if (__cilkrts_set_param("nworkers", "2") != 0) + __builtin_abort(); + main2(); return 0; } diff --git gcc/testsuite/g++.dg/cilk-plus/CK/catch_exc.cc gcc/testsuite/g++.dg/cilk-plus/CK/catch_exc.cc index 0633d19..09ddf8b 100644 --- gcc/testsuite/g++.dg/cilk-plus/CK/catch_exc.cc +++ gcc/testsuite/g++.dg/cilk-plus/CK/catch_exc.cc @@ -10,6 +10,16 @@ #endif #include +#ifdef __cplusplus +extern "C" { +#endif + +extern int __cilkrts_set_param (const char *, const char *); + +#ifdef __cplusplus +} +#endif + void func(int volatile* steal_me) { @@ -59,6 +69,10 @@ void my_test() int main() { + /* Ensure more than one worker. */ + if (__cilkrts_set_param("nworkers", "2") != 0) + __builtin_abort(); + my_test(); #if HAVE_IO printf("PASSED\n");