public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: Jakub Jelinek <jakub@redhat.com>, <gcc-patches@gcc.gnu.org>,
	<fortran@gcc.gnu.org>
Subject: Re: Translate libgomp.oacc-c-c++-common/lib-32.c into Fortran
Date: Wed, 24 May 2017 13:45:00 -0000	[thread overview]
Message-ID: <87mva2wetx.fsf@hertz.schwinge.homeip.net> (raw)
In-Reply-To: <20170523110822.GR8499@tucnak>

Hi!

On Tue, 23 May 2017 13:08:22 +0200, Jakub Jelinek <jakub@redhat.com> wrote:
> On Mon, May 22, 2017 at 04:29:51PM +0200, Thomas Schwinge wrote:
> > On Mon, 22 May 2017 16:26:48 +0200, I wrote:
> > >     C/C++ OpenACC: acc_pcopyin, acc_pcreate
> > 
> > >             libgomp/
> > >             [...]
> > >             * testsuite/libgomp.oacc-c-c++-common/lib-38.c: Remove, merging
> > >             its content into...
> > >             * testsuite/libgomp.oacc-c-c++-common/lib-32.c: ... this file.
> > >             Extend testing.
> > 
> > ... which I then translated into two Fortran variants; OK for trunk?

> Ok.

Thanks.  As posted, committed to trunk in r248411:

commit 4a5596a04ac52ae4df1347e7980e0d60fcd1e84b
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed May 24 13:23:45 2017 +0000

    Translate libgomp.oacc-c-c++-common/lib-32.c into Fortran
    
            libgomp/
            * testsuite/libgomp.oacc-fortran/lib-32-1.f: New file.
            * testsuite/libgomp.oacc-fortran/lib-32-2.f: Likewise.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248411 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog                                  |   3 +
 .../testsuite/libgomp.oacc-c-c++-common/lib-32.c   |   1 +
 libgomp/testsuite/libgomp.oacc-fortran/lib-32-1.f  | 179 +++++++++++++++++++++
 libgomp/testsuite/libgomp.oacc-fortran/lib-32-2.f  | 173 ++++++++++++++++++++
 4 files changed, 356 insertions(+)

diff --git libgomp/ChangeLog libgomp/ChangeLog
index 4a95755..af8c5ca 100644
--- libgomp/ChangeLog
+++ libgomp/ChangeLog
@@ -1,5 +1,8 @@
 2017-05-24  Thomas Schwinge  <thomas@codesourcery.com>
 
+	* testsuite/libgomp.oacc-fortran/lib-32-1.f: New file.
+	* testsuite/libgomp.oacc-fortran/lib-32-2.f: Likewise.
+
 	* openacc.h (acc_pcopyin, acc_pcreate): Provide prototypes instead
 	of preprocessor definitions.
 	* libgomp.h (strong_alias): Guard by "#ifdef
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/lib-32.c libgomp/testsuite/libgomp.oacc-c-c++-common/lib-32.c
index 6a9e995..1696fb6 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/lib-32.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/lib-32.c
@@ -1,4 +1,5 @@
 /* acc_present_or_create, acc_present_or_copyin, etc.  */
+/* See also Fortran variants in "../libgomp.oacc-fortran/lib-32*".  */
 
 #include <stdbool.h>
 #include <stdlib.h>
diff --git libgomp/testsuite/libgomp.oacc-fortran/lib-32-1.f libgomp/testsuite/libgomp.oacc-fortran/lib-32-1.f
new file mode 100644
index 0000000..4606d77
--- /dev/null
+++ libgomp/testsuite/libgomp.oacc-fortran/lib-32-1.f
@@ -0,0 +1,179 @@
+!     ACC_PRESENT_OR_CREATE, ACC_PRESENT_OR_COPYIN, etc.
+!     Variant of "../libgomp.oacc-c-c++-common/lib-32.c".
+!     Variant using "openacc_lib.h".
+
+!     { dg-do run }
+
+      PROGRAM MAIN
+      IMPLICIT NONE
+      INCLUDE "openacc_lib.h"
+
+      INTEGER, PARAMETER :: N = 10000
+      INTEGER, ALLOCATABLE :: H(:)
+      INTEGER :: I
+      LOGICAL :: SHARED_MEM
+
+      ALLOCATE (H(N))
+      DO I = 1, N
+         H(I) = I + 0
+      END DO
+
+      SHARED_MEM = ACC_IS_PRESENT (H)
+
+      CALL ACC_PRESENT_OR_CREATE (H)
+      IF (.NOT. ACC_IS_PRESENT (H)) CALL ABORT
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         H(I) = I + 1
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (1, 0, SHARED_MEM)) CALL ABORT
+         H(I) = I + 2
+      END DO
+
+      CALL ACC_PRESENT_OR_CREATE (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (2, 1, SHARED_MEM)) CALL ABORT
+         H(I) = I + 3
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (3, 2, SHARED_MEM)) CALL ABORT
+         H(I) = I + 4
+      END DO
+
+!      CALL ACC_PCREATE (H)
+      CALL ACC_PRESENT_OR_CREATE (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (4, 3, SHARED_MEM)) CALL ABORT
+         H(I) = I + 5
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (5, 4, SHARED_MEM)) CALL ABORT
+         H(I) = I + 6
+      END DO
+
+      CALL ACC_PRESENT_OR_COPYIN (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (6, 5, SHARED_MEM)) CALL ABORT
+         H(I) = I + 7
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (7, 6, SHARED_MEM)) CALL ABORT
+         H(I) = I + 8
+      END DO
+
+!      CALL ACC_PCOPYIN (H)
+      CALL ACC_PRESENT_OR_COPYIN (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (8, 7, SHARED_MEM)) CALL ABORT
+         H(I) = I + 9
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (9, 8, SHARED_MEM)) CALL ABORT
+         H(I) = I + 10
+      END DO
+
+      CALL ACC_COPYOUT (H)
+      IF (.NOT. SHARED_MEM) THEN
+         IF (ACC_IS_PRESENT (H)) CALL ABORT
+      ENDIF
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (10, 9, SHARED_MEM)) CALL ABORT
+      END DO
+
+!      CALL ACC_PCOPYIN (H)
+      CALL ACC_PRESENT_OR_COPYIN (H)
+      IF (.NOT. ACC_IS_PRESENT (H)) CALL ABORT
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (10, 9, SHARED_MEM)) CALL ABORT
+         H(I) = I + 11
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (11, 9, SHARED_MEM)) CALL ABORT
+         H(I) = I + 12
+      END DO
+
+!      CALL ACC_PCOPYIN (H)
+      CALL ACC_PRESENT_OR_COPYIN (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (12, 11, SHARED_MEM)) CALL ABORT
+         H(I) = I + 13
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (13, 12, SHARED_MEM)) CALL ABORT
+         H(I) = I + 14
+      END DO
+
+!      CALL ACC_PCREATE (H)
+      CALL ACC_PRESENT_OR_CREATE (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (14, 13, SHARED_MEM)) CALL ABORT
+         H(I) = I + 15
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (15, 14, SHARED_MEM)) CALL ABORT
+         H(I) = I + 16
+      END DO
+
+!      CALL ACC_PCREATE (H)
+      CALL ACC_PRESENT_OR_CREATE (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (16, 15, SHARED_MEM)) CALL ABORT
+         H(I) = I + 17
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (17, 16, SHARED_MEM)) CALL ABORT
+         H(I) = I + 18
+      END DO
+
+      CALL ACC_UPDATE_SELF (H)
+      IF (.NOT. ACC_IS_PRESENT (H)) CALL ABORT
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (18, 17, SHARED_MEM)) CALL ABORT
+      END DO
+
+      CALL ACC_DELETE (H)
+      IF (.NOT. SHARED_MEM) THEN
+         IF (ACC_IS_PRESENT (H)) CALL ABORT
+      ENDIF
+
+      DEALLOCATE (H)
+
+      END PROGRAM MAIN
diff --git libgomp/testsuite/libgomp.oacc-fortran/lib-32-2.f libgomp/testsuite/libgomp.oacc-fortran/lib-32-2.f
new file mode 100644
index 0000000..88f5566
--- /dev/null
+++ libgomp/testsuite/libgomp.oacc-fortran/lib-32-2.f
@@ -0,0 +1,173 @@
+!     ACC_PRESENT_OR_CREATE, ACC_PRESENT_OR_COPYIN, etc.
+!     Variant of "../libgomp.oacc-c-c++-common/lib-32.c".
+!     Variant using the "openacc" module.
+
+!     { dg-do run }
+
+      PROGRAM MAIN
+      USE OPENACC
+      IMPLICIT NONE
+
+      INTEGER, PARAMETER :: N = 10000
+      INTEGER, ALLOCATABLE :: H(:)
+      INTEGER :: I
+      LOGICAL :: SHARED_MEM
+
+      ALLOCATE (H(N))
+      DO I = 1, N
+         H(I) = I + 0
+      END DO
+
+      SHARED_MEM = ACC_IS_PRESENT (H)
+
+      CALL ACC_PRESENT_OR_CREATE (H)
+      IF (.NOT. ACC_IS_PRESENT (H)) CALL ABORT
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         H(I) = I + 1
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (1, 0, SHARED_MEM)) CALL ABORT
+         H(I) = I + 2
+      END DO
+
+      CALL ACC_PRESENT_OR_CREATE (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (2, 1, SHARED_MEM)) CALL ABORT
+         H(I) = I + 3
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (3, 2, SHARED_MEM)) CALL ABORT
+         H(I) = I + 4
+      END DO
+
+      CALL ACC_PCREATE (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (4, 3, SHARED_MEM)) CALL ABORT
+         H(I) = I + 5
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (5, 4, SHARED_MEM)) CALL ABORT
+         H(I) = I + 6
+      END DO
+
+      CALL ACC_PRESENT_OR_COPYIN (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (6, 5, SHARED_MEM)) CALL ABORT
+         H(I) = I + 7
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (7, 6, SHARED_MEM)) CALL ABORT
+         H(I) = I + 8
+      END DO
+
+      CALL ACC_PCOPYIN (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (8, 7, SHARED_MEM)) CALL ABORT
+         H(I) = I + 9
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (9, 8, SHARED_MEM)) CALL ABORT
+         H(I) = I + 10
+      END DO
+
+      CALL ACC_COPYOUT (H)
+      IF (.NOT. SHARED_MEM) THEN
+         IF (ACC_IS_PRESENT (H)) CALL ABORT
+      ENDIF
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (10, 9, SHARED_MEM)) CALL ABORT
+      END DO
+
+      CALL ACC_PCOPYIN (H)
+      IF (.NOT. ACC_IS_PRESENT (H)) CALL ABORT
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (10, 9, SHARED_MEM)) CALL ABORT
+         H(I) = I + 11
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (11, 9, SHARED_MEM)) CALL ABORT
+         H(I) = I + 12
+      END DO
+
+      CALL ACC_PCOPYIN (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (12, 11, SHARED_MEM)) CALL ABORT
+         H(I) = I + 13
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (13, 12, SHARED_MEM)) CALL ABORT
+         H(I) = I + 14
+      END DO
+
+      CALL ACC_PCREATE (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (14, 13, SHARED_MEM)) CALL ABORT
+         H(I) = I + 15
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (15, 14, SHARED_MEM)) CALL ABORT
+         H(I) = I + 16
+      END DO
+
+      CALL ACC_PCREATE (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (16, 15, SHARED_MEM)) CALL ABORT
+         H(I) = I + 17
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (17, 16, SHARED_MEM)) CALL ABORT
+         H(I) = I + 18
+      END DO
+
+      CALL ACC_UPDATE_SELF (H)
+      IF (.NOT. ACC_IS_PRESENT (H)) CALL ABORT
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (18, 17, SHARED_MEM)) CALL ABORT
+      END DO
+
+      CALL ACC_DELETE (H)
+      IF (.NOT. SHARED_MEM) THEN
+         IF (ACC_IS_PRESENT (H)) CALL ABORT
+      ENDIF
+
+      DEALLOCATE (H)
+
+      END PROGRAM MAIN

Committed to gomp-4_0-branch in r248415:

commit 7621601fad34df2509e572e961ea7dae20d7b225
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed May 24 13:25:54 2017 +0000

    Translate libgomp.oacc-c-c++-common/lib-32.c into Fortran
    
            libgomp/
            * testsuite/libgomp.oacc-fortran/lib-32-1.f: New file.
            * testsuite/libgomp.oacc-fortran/lib-32-2.f: Likewise.
    
    trunk r248411
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@248415 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog.gomp                             |   3 +
 .../testsuite/libgomp.oacc-c-c++-common/lib-32.c   |   1 +
 libgomp/testsuite/libgomp.oacc-fortran/lib-32-1.f  | 179 +++++++++++++++++++++
 libgomp/testsuite/libgomp.oacc-fortran/lib-32-2.f  | 173 ++++++++++++++++++++
 4 files changed, 356 insertions(+)

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index 4ab1004..de4eeb4 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,5 +1,8 @@
 2017-05-24  Thomas Schwinge  <thomas@codesourcery.com>
 
+	* testsuite/libgomp.oacc-fortran/lib-32-1.f: New file.
+	* testsuite/libgomp.oacc-fortran/lib-32-2.f: Likewise.
+
 	* openacc.h (acc_pcopyin, acc_pcreate): Provide prototypes instead
 	of preprocessor definitions.
 	* libgomp.h (strong_alias): Guard by "#ifdef
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/lib-32.c libgomp/testsuite/libgomp.oacc-c-c++-common/lib-32.c
index 666d4b8..9ec3453 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/lib-32.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/lib-32.c
@@ -1,4 +1,5 @@
 /* acc_present_or_create, acc_present_or_copyin, etc.  */
+/* See also Fortran variants in "../libgomp.oacc-fortran/lib-32*".  */
 
 #include <stdbool.h>
 #include <stdlib.h>
diff --git libgomp/testsuite/libgomp.oacc-fortran/lib-32-1.f libgomp/testsuite/libgomp.oacc-fortran/lib-32-1.f
new file mode 100644
index 0000000..4ed866b
--- /dev/null
+++ libgomp/testsuite/libgomp.oacc-fortran/lib-32-1.f
@@ -0,0 +1,179 @@
+!     ACC_PRESENT_OR_CREATE, ACC_PRESENT_OR_COPYIN, etc.
+!     Variant of "../libgomp.oacc-c-c++-common/lib-32.c".
+!     Variant using "openacc_lib.h".
+
+!     { dg-do run }
+
+      PROGRAM MAIN
+      IMPLICIT NONE
+      INCLUDE "openacc_lib.h"
+
+      INTEGER, PARAMETER :: N = 10000
+      INTEGER, ALLOCATABLE :: H(:)
+      INTEGER :: I
+      LOGICAL :: SHARED_MEM
+
+      ALLOCATE (H(N))
+      DO I = 1, N
+         H(I) = I + 0
+      END DO
+
+      SHARED_MEM = ACC_IS_PRESENT (H)
+
+      CALL ACC_PRESENT_OR_CREATE (H)
+      IF (.NOT. ACC_IS_PRESENT (H)) CALL ABORT
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         H(I) = I + 1
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (1, 0, SHARED_MEM)) CALL ABORT
+         H(I) = I + 2
+      END DO
+
+      CALL ACC_PRESENT_OR_CREATE (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (2, 1, SHARED_MEM)) CALL ABORT
+         H(I) = I + 3
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (3, 2, SHARED_MEM)) CALL ABORT
+         H(I) = I + 4
+      END DO
+
+!      CALL ACC_PCREATE (H)
+      CALL ACC_PRESENT_OR_CREATE (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (4, 3, SHARED_MEM)) CALL ABORT
+         H(I) = I + 5
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (5, 4, SHARED_MEM)) CALL ABORT
+         H(I) = I + 6
+      END DO
+
+      CALL ACC_PRESENT_OR_COPYIN (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (6, 5, SHARED_MEM)) CALL ABORT
+         H(I) = I + 7
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (7, 6, SHARED_MEM)) CALL ABORT
+         H(I) = I + 8
+      END DO
+
+!      CALL ACC_PCOPYIN (H)
+      CALL ACC_PRESENT_OR_COPYIN (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (8, 7, SHARED_MEM)) CALL ABORT
+         H(I) = I + 9
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (9, 8, SHARED_MEM)) CALL ABORT
+         H(I) = I + 10
+      END DO
+
+      CALL ACC_COPYOUT_FINALIZE (H)
+      IF (.NOT. SHARED_MEM) THEN
+         IF (ACC_IS_PRESENT (H)) CALL ABORT
+      ENDIF
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (10, 9, SHARED_MEM)) CALL ABORT
+      END DO
+
+!      CALL ACC_PCOPYIN (H)
+      CALL ACC_PRESENT_OR_COPYIN (H)
+      IF (.NOT. ACC_IS_PRESENT (H)) CALL ABORT
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (10, 9, SHARED_MEM)) CALL ABORT
+         H(I) = I + 11
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (11, 9, SHARED_MEM)) CALL ABORT
+         H(I) = I + 12
+      END DO
+
+!      CALL ACC_PCOPYIN (H)
+      CALL ACC_PRESENT_OR_COPYIN (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (12, 11, SHARED_MEM)) CALL ABORT
+         H(I) = I + 13
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (13, 12, SHARED_MEM)) CALL ABORT
+         H(I) = I + 14
+      END DO
+
+!      CALL ACC_PCREATE (H)
+      CALL ACC_PRESENT_OR_CREATE (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (14, 13, SHARED_MEM)) CALL ABORT
+         H(I) = I + 15
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (15, 14, SHARED_MEM)) CALL ABORT
+         H(I) = I + 16
+      END DO
+
+!      CALL ACC_PCREATE (H)
+      CALL ACC_PRESENT_OR_CREATE (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (16, 15, SHARED_MEM)) CALL ABORT
+         H(I) = I + 17
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (17, 16, SHARED_MEM)) CALL ABORT
+         H(I) = I + 18
+      END DO
+
+      CALL ACC_UPDATE_SELF (H)
+      IF (.NOT. ACC_IS_PRESENT (H)) CALL ABORT
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (18, 17, SHARED_MEM)) CALL ABORT
+      END DO
+
+      CALL ACC_DELETE_FINALIZE (H)
+      IF (.NOT. SHARED_MEM) THEN
+         IF (ACC_IS_PRESENT (H)) CALL ABORT
+      ENDIF
+
+      DEALLOCATE (H)
+
+      END PROGRAM MAIN
diff --git libgomp/testsuite/libgomp.oacc-fortran/lib-32-2.f libgomp/testsuite/libgomp.oacc-fortran/lib-32-2.f
new file mode 100644
index 0000000..3e88ce2
--- /dev/null
+++ libgomp/testsuite/libgomp.oacc-fortran/lib-32-2.f
@@ -0,0 +1,173 @@
+!     ACC_PRESENT_OR_CREATE, ACC_PRESENT_OR_COPYIN, etc.
+!     Variant of "../libgomp.oacc-c-c++-common/lib-32.c".
+!     Variant using the "openacc" module.
+
+!     { dg-do run }
+
+      PROGRAM MAIN
+      USE OPENACC
+      IMPLICIT NONE
+
+      INTEGER, PARAMETER :: N = 10000
+      INTEGER, ALLOCATABLE :: H(:)
+      INTEGER :: I
+      LOGICAL :: SHARED_MEM
+
+      ALLOCATE (H(N))
+      DO I = 1, N
+         H(I) = I + 0
+      END DO
+
+      SHARED_MEM = ACC_IS_PRESENT (H)
+
+      CALL ACC_PRESENT_OR_CREATE (H)
+      IF (.NOT. ACC_IS_PRESENT (H)) CALL ABORT
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         H(I) = I + 1
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (1, 0, SHARED_MEM)) CALL ABORT
+         H(I) = I + 2
+      END DO
+
+      CALL ACC_PRESENT_OR_CREATE (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (2, 1, SHARED_MEM)) CALL ABORT
+         H(I) = I + 3
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (3, 2, SHARED_MEM)) CALL ABORT
+         H(I) = I + 4
+      END DO
+
+      CALL ACC_PCREATE (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (4, 3, SHARED_MEM)) CALL ABORT
+         H(I) = I + 5
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (5, 4, SHARED_MEM)) CALL ABORT
+         H(I) = I + 6
+      END DO
+
+      CALL ACC_PRESENT_OR_COPYIN (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (6, 5, SHARED_MEM)) CALL ABORT
+         H(I) = I + 7
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (7, 6, SHARED_MEM)) CALL ABORT
+         H(I) = I + 8
+      END DO
+
+      CALL ACC_PCOPYIN (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (8, 7, SHARED_MEM)) CALL ABORT
+         H(I) = I + 9
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (9, 8, SHARED_MEM)) CALL ABORT
+         H(I) = I + 10
+      END DO
+
+      CALL ACC_COPYOUT_FINALIZE (H)
+      IF (.NOT. SHARED_MEM) THEN
+         IF (ACC_IS_PRESENT (H)) CALL ABORT
+      ENDIF
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (10, 9, SHARED_MEM)) CALL ABORT
+      END DO
+
+      CALL ACC_PCOPYIN (H)
+      IF (.NOT. ACC_IS_PRESENT (H)) CALL ABORT
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (10, 9, SHARED_MEM)) CALL ABORT
+         H(I) = I + 11
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (11, 9, SHARED_MEM)) CALL ABORT
+         H(I) = I + 12
+      END DO
+
+      CALL ACC_PCOPYIN (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (12, 11, SHARED_MEM)) CALL ABORT
+         H(I) = I + 13
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (13, 12, SHARED_MEM)) CALL ABORT
+         H(I) = I + 14
+      END DO
+
+      CALL ACC_PCREATE (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (14, 13, SHARED_MEM)) CALL ABORT
+         H(I) = I + 15
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (15, 14, SHARED_MEM)) CALL ABORT
+         H(I) = I + 16
+      END DO
+
+      CALL ACC_PCREATE (H)
+
+!$ACC PARALLEL LOOP DEFAULT (PRESENT)
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (16, 15, SHARED_MEM)) CALL ABORT
+         H(I) = I + 17
+      END DO
+!$ACC END PARALLEL LOOP
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (17, 16, SHARED_MEM)) CALL ABORT
+         H(I) = I + 18
+      END DO
+
+      CALL ACC_UPDATE_SELF (H)
+      IF (.NOT. ACC_IS_PRESENT (H)) CALL ABORT
+
+      DO I = 1, N
+         IF (H(I) .NE. I + MERGE (18, 17, SHARED_MEM)) CALL ABORT
+      END DO
+
+      CALL ACC_DELETE_FINALIZE (H)
+      IF (.NOT. SHARED_MEM) THEN
+         IF (ACC_IS_PRESENT (H)) CALL ABORT
+      ENDIF
+
+      DEALLOCATE (H)
+
+      END PROGRAM MAIN


Grüße
 Thomas

  reply	other threads:[~2017-05-24 13:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-22 14:28 C/C++ OpenACC: acc_pcopyin, acc_pcreate Thomas Schwinge
2017-05-22 15:23 ` Translate libgomp.oacc-c-c++-common/lib-32.c into Fortran (was: C/C++ OpenACC: acc_pcopyin, acc_pcreate) Thomas Schwinge
2017-05-23 11:12   ` Jakub Jelinek
2017-05-24 13:45     ` Thomas Schwinge [this message]
2017-05-23 11:08 ` C/C++ OpenACC: acc_pcopyin, acc_pcreate Jakub Jelinek
2017-05-24 10:57   ` Thomas Schwinge
2017-05-24 11:24     ` Jakub Jelinek
2017-05-24 13:41       ` Thomas Schwinge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mva2wetx.fsf@hertz.schwinge.homeip.net \
    --to=thomas@codesourcery.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).