[patch,gomp-4_0-branch] openacc parallel reduction part 1

Thomas Schwinge thomas@codesourcery.com
Thu Sep 25 20:06:00 GMT 2014


Hi!

On Tue, 8 Jul 2014 07:28:24 -0700, Cesar Philippidis <cesar_philippidis@mentor.com> wrote:
> On 07/07/2014 02:55 AM, Thomas Schwinge wrote:
> > On Sun, 6 Jul 2014 16:10:56 -0700, Cesar Philippidis <cesar_philippidis@mentor.com> wrote:
> >> This patch is the first step to enabling parallel reductions in openacc.

> --- /dev/null
> +++ b/gcc/testsuite/c-c++-common/goacc/reduction-1.c

> +#pragma acc parallel vector_length (vl)
> +#pragma acc loop reduction (+:result)
> +  for (i = 0; i < n; i++)
> +    result += array[i];
> +#pragma acc end parallel

> [...]

Committed to gomp-4_0-branch in r215617:

commit a6b46623f7543f07c9b2ebcd080d3216c6b30d69
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Thu Sep 25 20:04:16 2014 +0000

    Remove erroneous "#pragma acc end parallel"s.
    
    	gcc/testsuite/
    	* c-c++-common/goacc/reduction-1.c: Remove erroneous "#pragma acc
    	end parallel"s.
    	* c-c++-common/goacc/reduction-2.c: Likewise.
    	* c-c++-common/goacc/reduction-3.c: Likewise.
    	* c-c++-common/goacc/reduction-4.c: Likewise.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@215617 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/testsuite/ChangeLog.gomp                   | 8 ++++++++
 gcc/testsuite/c-c++-common/goacc/reduction-1.c | 9 ---------
 gcc/testsuite/c-c++-common/goacc/reduction-2.c | 6 ------
 gcc/testsuite/c-c++-common/goacc/reduction-3.c | 6 ------
 gcc/testsuite/c-c++-common/goacc/reduction-4.c | 6 ------
 5 files changed, 8 insertions(+), 27 deletions(-)

diff --git gcc/testsuite/ChangeLog.gomp gcc/testsuite/ChangeLog.gomp
index f350c35..786f434 100644
--- gcc/testsuite/ChangeLog.gomp
+++ gcc/testsuite/ChangeLog.gomp
@@ -1,3 +1,11 @@
+2014-09-25  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* c-c++-common/goacc/reduction-1.c: Remove erroneous "#pragma acc
+	end parallel"s.
+	* c-c++-common/goacc/reduction-2.c: Likewise.
+	* c-c++-common/goacc/reduction-3.c: Likewise.
+	* c-c++-common/goacc/reduction-4.c: Likewise.
+
 2014-09-23  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* c-c++-common/goacc/acc_on_device-1.c: New file.
diff --git gcc/testsuite/c-c++-common/goacc/reduction-1.c gcc/testsuite/c-c++-common/goacc/reduction-1.c
index cff7d2d..0f50082 100644
--- gcc/testsuite/c-c++-common/goacc/reduction-1.c
+++ gcc/testsuite/c-c++-common/goacc/reduction-1.c
@@ -15,14 +15,12 @@ main(void)
 #pragma acc loop reduction (+:result)
   for (i = 0; i < n; i++)
     result += array[i];
-#pragma acc end parallel
 
   /* '*' reductions.  */
 #pragma acc parallel vector_length (vl)
 #pragma acc loop reduction (*:result)
   for (i = 0; i < n; i++)
     result *= array[i];
-#pragma acc end parallel
 
 //   result = 0;
 //   vresult = 0;
@@ -32,49 +30,42 @@ main(void)
 // #pragma acc loop reduction (+:result)
 //   for (i = 0; i < n; i++)
 //       result = result > array[i] ? result : array[i];
-// #pragma acc end parallel
 //
 //   /* 'min' reductions.  */
 // #pragma acc parallel vector_length (vl)
 // #pragma acc loop reduction (+:result)
 //   for (i = 0; i < n; i++)
 //       result = result < array[i] ? result : array[i];
-// #pragma acc end parallel
 
   /* '&' reductions.  */
 #pragma acc parallel vector_length (vl)
 #pragma acc loop reduction (&:result)
   for (i = 0; i < n; i++)
     result &= array[i];
-#pragma acc end parallel
 
   /* '|' reductions.  */
 #pragma acc parallel vector_length (vl)
 #pragma acc loop reduction (|:result)
   for (i = 0; i < n; i++)
     result |= array[i];
-#pragma acc end parallel
 
   /* '^' reductions.  */
 #pragma acc parallel vector_length (vl)
 #pragma acc loop reduction (^:result)
   for (i = 0; i < n; i++)
     result ^= array[i];
-#pragma acc end parallel
 
   /* '&&' reductions.  */
 #pragma acc parallel vector_length (vl)
 #pragma acc loop reduction (&&:lresult)
   for (i = 0; i < n; i++)
     lresult = lresult && (result > array[i]);
-#pragma acc end parallel
 
   /* '||' reductions.  */
 #pragma acc parallel vector_length (vl)
 #pragma acc loop reduction (||:lresult)
   for (i = 0; i < n; i++)
     lresult = lresult || (result > array[i]);
-#pragma acc end parallel
 
   return 0;
 }
diff --git gcc/testsuite/c-c++-common/goacc/reduction-2.c gcc/testsuite/c-c++-common/goacc/reduction-2.c
index 9686b37..1f95138 100644
--- gcc/testsuite/c-c++-common/goacc/reduction-2.c
+++ gcc/testsuite/c-c++-common/goacc/reduction-2.c
@@ -15,42 +15,36 @@ main(void)
 #pragma acc loop reduction (+:result)
   for (i = 0; i < n; i++)
     result += array[i];
-#pragma acc end parallel
 
   /* '*' reductions.  */
 #pragma acc parallel vector_length (vl)
 #pragma acc loop reduction (*:result)
   for (i = 0; i < n; i++)
     result *= array[i];
-#pragma acc end parallel
 
 //   /* 'max' reductions.  */
 // #pragma acc parallel vector_length (vl)
 // #pragma acc loop reduction (+:result)
 //   for (i = 0; i < n; i++)
 //       result = result > array[i] ? result : array[i];
-// #pragma acc end parallel
 // 
 //   /* 'min' reductions.  */
 // #pragma acc parallel vector_length (vl)
 // #pragma acc loop reduction (+:result)
 //   for (i = 0; i < n; i++)
 //       result = result < array[i] ? result : array[i];
-// #pragma acc end parallel
 
   /* '&&' reductions.  */
 #pragma acc parallel vector_length (vl)
 #pragma acc loop reduction (&&:lresult)
   for (i = 0; i < n; i++)
     lresult = lresult && (result > array[i]);
-#pragma acc end parallel
 
   /* '||' reductions.  */
 #pragma acc parallel vector_length (vl)
 #pragma acc loop reduction (||:lresult)
   for (i = 0; i < n; i++)
     lresult = lresult || (result > array[i]);
-#pragma acc end parallel
 
   return 0;
 }
diff --git gcc/testsuite/c-c++-common/goacc/reduction-3.c gcc/testsuite/c-c++-common/goacc/reduction-3.c
index c618c4e..476e375 100644
--- gcc/testsuite/c-c++-common/goacc/reduction-3.c
+++ gcc/testsuite/c-c++-common/goacc/reduction-3.c
@@ -15,42 +15,36 @@ main(void)
 #pragma acc loop reduction (+:result)
   for (i = 0; i < n; i++)
     result += array[i];
-#pragma acc end parallel
 
   /* '*' reductions.  */
 #pragma acc parallel vector_length (vl)
 #pragma acc loop reduction (*:result)
   for (i = 0; i < n; i++)
     result *= array[i];
-#pragma acc end parallel
 
 //   /* 'max' reductions.  */
 // #pragma acc parallel vector_length (vl)
 // #pragma acc loop reduction (+:result)
 //   for (i = 0; i < n; i++)
 //       result = result > array[i] ? result : array[i];
-// #pragma acc end parallel
 // 
 //   /* 'min' reductions.  */
 // #pragma acc parallel vector_length (vl)
 // #pragma acc loop reduction (+:result)
 //   for (i = 0; i < n; i++)
 //       result = result < array[i] ? result : array[i];
-// #pragma acc end parallel
 
   /* '&&' reductions.  */
 #pragma acc parallel vector_length (vl)
 #pragma acc loop reduction (&&:lresult)
   for (i = 0; i < n; i++)
     lresult = lresult && (result > array[i]);
-#pragma acc end parallel
 
   /* '||' reductions.  */
 #pragma acc parallel vector_length (vl)
 #pragma acc loop reduction (||:lresult)
   for (i = 0; i < n; i++)
     lresult = lresult || (result > array[i]);
-#pragma acc end parallel
 
   return 0;
 }
diff --git gcc/testsuite/c-c++-common/goacc/reduction-4.c gcc/testsuite/c-c++-common/goacc/reduction-4.c
index 1e032a1..73dde86 100644
--- gcc/testsuite/c-c++-common/goacc/reduction-4.c
+++ gcc/testsuite/c-c++-common/goacc/reduction-4.c
@@ -15,7 +15,6 @@ main(void)
 #pragma acc loop reduction (+:result)
   for (i = 0; i < n; i++)
     result += array[i];
-#pragma acc end parallel
 
   /* Needs support for complex multiplication.  */
 
@@ -24,35 +23,30 @@ main(void)
 // #pragma acc loop reduction (*:result)
 //   for (i = 0; i < n; i++)
 //     result *= array[i];
-// #pragma acc end parallel
 //
 //   /* 'max' reductions.  */
 // #pragma acc parallel vector_length (vl)
 // #pragma acc loop reduction (+:result)
 //   for (i = 0; i < n; i++)
 //       result = result > array[i] ? result : array[i];
-// #pragma acc end parallel
 // 
 //   /* 'min' reductions.  */
 // #pragma acc parallel vector_length (vl)
 // #pragma acc loop reduction (+:result)
 //   for (i = 0; i < n; i++)
 //       result = result < array[i] ? result : array[i];
-// #pragma acc end parallel
 
   /* '&&' reductions.  */
 #pragma acc parallel vector_length (vl)
 #pragma acc loop reduction (&&:lresult)
   for (i = 0; i < n; i++)
     lresult = lresult && (__real__(result) > __real__(array[i]));
-#pragma acc end parallel
 
   /* '||' reductions.  */
 #pragma acc parallel vector_length (vl)
 #pragma acc loop reduction (||:lresult)
   for (i = 0; i < n; i++)
     lresult = lresult || (__real__(result) > __real__(array[i]));
-#pragma acc end parallel
 
   return 0;
 }


Grüße,
 Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140925/f34567b6/attachment.sig>


More information about the Gcc-patches mailing list