* OpenACC 1.0 compatibility: acc_async_wait, acc_async_wait_all @ 2017-05-22 17:45 ` Thomas Schwinge 2017-05-23 11:28 ` Jakub Jelinek 0 siblings, 1 reply; 5+ messages in thread From: Thomas Schwinge @ 2017-05-22 17:45 UTC (permalink / raw) To: gcc-patches, Jakub Jelinek Hi! For OpenACC 1.0 compatibility, we need to provide the aliases acc_async_wait, and acc_async_wait_all for acc_wait, and acc_wait_all, respectively. OK for trunk? commit 0f8302913db6d2c23804a3463c51a47e623e76b2 Author: Thomas Schwinge <thomas@codesourcery.com> Date: Mon May 22 19:22:24 2017 +0200 OpenACC 1.0 compatibility: acc_async_wait, acc_async_wait_all libgomp/ * openacc.h (acc_async_wait, acc_async_wait_all): New prototypes. * libgomp.map (OACC_2.0): Add these. * oacc-async.c (acc_async_wait, acc_async_wait_all): New aliases for "acc_wait", and "acc_wait_all", respectively. * openacc.f90 (acc_async_wait, acc_async_wait_all): New interfaces for "acc_wait", and "acc_wait_all", respectively. * openacc_lib.h (acc_async_wait, acc_async_wait_all): Likewise. * libgomp.texi (acc_wait, acc_wait_all): Update. * testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c: Update. * testsuite/libgomp.oacc-fortran/par-reduction-2-1.f: New file. * testsuite/libgomp.oacc-fortran/par-reduction-2-2.f: Likewise. --- libgomp/libgomp.map | 2 + libgomp/libgomp.texi | 7 ++- libgomp/oacc-async.c | 22 +++++++++ libgomp/openacc.f90 | 16 +++++- libgomp/openacc.h | 2 + libgomp/openacc_lib.h | 11 +++++ .../libgomp.oacc-c-c++-common/par-reduction-2.c | 9 ++-- .../libgomp.oacc-fortran/par-reduction-2-1.f | 57 ++++++++++++++++++++++ .../libgomp.oacc-fortran/par-reduction-2-2.f | 57 ++++++++++++++++++++++ 9 files changed, 176 insertions(+), 7 deletions(-) diff --git libgomp/libgomp.map libgomp/libgomp.map index c7bf245..141424b 100644 --- libgomp/libgomp.map +++ libgomp/libgomp.map @@ -315,10 +315,12 @@ OACC_2.0 { acc_async_test_all; acc_async_test_all_h_; acc_wait; + acc_async_wait; acc_wait_h_; acc_wait_async; acc_wait_async_h_; acc_wait_all; + acc_async_wait_all; acc_wait_all_h_; acc_wait_all_async; acc_wait_all_async_h_; diff --git libgomp/libgomp.texi libgomp/libgomp.texi index cc5ee1c..230720f 100644 --- libgomp/libgomp.texi +++ libgomp/libgomp.texi @@ -2095,12 +2095,15 @@ specified in @var{arg}. @item @emph{C/C++}: @multitable @columnfractions .20 .80 @item @emph{Prototype}: @tab @code{acc_wait(arg);} +@item @emph{Prototype (OpenACC 1.0 compatibility)}: @tab @code{acc_async_wait(arg);} @end multitable @item @emph{Fortran}: @multitable @columnfractions .20 .80 @item @emph{Interface}: @tab @code{subroutine acc_wait(arg)} @item @tab @code{integer(acc_handle_kind) arg} +@item @emph{Interface (OpenACC 1.0 compatibility)}: @tab @code{subroutine acc_async_wait(arg)} +@item @tab @code{integer(acc_handle_kind) arg} @end multitable @item @emph{Reference}: @@ -2119,11 +2122,13 @@ This function waits for the completion of all asynchronous operations. @item @emph{C/C++}: @multitable @columnfractions .20 .80 @item @emph{Prototype}: @tab @code{acc_wait_all(void);} +@item @emph{Prototype (OpenACC 1.0 compatibility)}: @tab @code{acc_async_wait_all(void);} @end multitable @item @emph{Fortran}: @multitable @columnfractions .20 .80 -@item @emph{Interface}: @tab @code{subroutine acc_wait_async()} +@item @emph{Interface}: @tab @code{subroutine acc_wait_all()} +@item @emph{Interface (OpenACC 1.0 compatibility)}: @tab @code{subroutine acc_async_wait_all()} @end multitable @item @emph{Reference}: diff --git libgomp/oacc-async.c libgomp/oacc-async.c index b68c84d..1334f99 100644 --- libgomp/oacc-async.c +++ libgomp/oacc-async.c @@ -70,6 +70,17 @@ acc_wait (int async) thr->dev->openacc.async_wait_func (async); } +/* acc_async_wait is an OpenACC 1.0 compatibility name for acc_wait. */ +#ifdef HAVE_ATTRIBUTE_ALIAS +strong_alias (acc_wait, acc_async_wait) +#else +void +acc_async_wait (int async) +{ + acc_wait (async); +} +#endif + void acc_wait_async (int async1, int async2) { @@ -92,6 +103,17 @@ acc_wait_all (void) thr->dev->openacc.async_wait_all_func (); } +/* acc_async_wait_all is an OpenACC 1.0 compatibility name for acc_wait_all. */ +#ifdef HAVE_ATTRIBUTE_ALIAS +strong_alias (acc_wait_all, acc_async_wait_all) +#else +void +acc_async_wait_all (void) +{ + acc_wait_all (); +} +#endif + void acc_wait_all_async (int async) { diff --git libgomp/openacc.f90 libgomp/openacc.f90 index a4422d4..0eb34ff 100644 --- libgomp/openacc.f90 +++ libgomp/openacc.f90 @@ -470,8 +470,10 @@ module openacc public :: acc_get_num_devices, acc_set_device_type, acc_get_device_type public :: acc_set_device_num, acc_get_device_num, acc_async_test - public :: acc_async_test_all, acc_wait, acc_wait_async, acc_wait_all - public :: acc_wait_all_async, acc_init, acc_shutdown, acc_on_device + public :: acc_async_test_all + public :: acc_wait, acc_async_wait, acc_wait_async + public :: acc_wait_all, acc_async_wait_all, acc_wait_all_async + public :: acc_init, acc_shutdown, acc_on_device public :: acc_copyin, acc_present_or_copyin, acc_pcopyin, acc_create public :: acc_present_or_create, acc_pcreate, acc_copyout, acc_delete public :: acc_update_device, acc_update_self, acc_is_present @@ -510,6 +512,11 @@ module openacc procedure :: acc_wait_h end interface + ! acc_async_wait is an OpenACC 1.0 compatibility name for acc_wait. + interface acc_async_wait + procedure :: acc_wait_h + end interface + interface acc_wait_async procedure :: acc_wait_async_h end interface @@ -518,6 +525,11 @@ module openacc procedure :: acc_wait_all_h end interface + ! acc_async_wait_all is an OpenACC 1.0 compatibility name for acc_wait_all. + interface acc_async_wait_all + procedure :: acc_wait_all_h + end interface + interface acc_wait_all_async procedure :: acc_wait_all_async_h end interface diff --git libgomp/openacc.h libgomp/openacc.h index ebccb18..137e2c1 100644 --- libgomp/openacc.h +++ libgomp/openacc.h @@ -75,8 +75,10 @@ int acc_get_device_num (acc_device_t) __GOACC_NOTHROW; int acc_async_test (int) __GOACC_NOTHROW; int acc_async_test_all (void) __GOACC_NOTHROW; void acc_wait (int) __GOACC_NOTHROW; +void acc_async_wait (int) __GOACC_NOTHROW; void acc_wait_async (int, int) __GOACC_NOTHROW; void acc_wait_all (void) __GOACC_NOTHROW; +void acc_async_wait_all (void) __GOACC_NOTHROW; void acc_wait_all_async (int) __GOACC_NOTHROW; void acc_init (acc_device_t) __GOACC_NOTHROW; void acc_shutdown (acc_device_t) __GOACC_NOTHROW; diff --git libgomp/openacc_lib.h libgomp/openacc_lib.h index 7818bd7..289b551 100644 --- libgomp/openacc_lib.h +++ libgomp/openacc_lib.h @@ -108,6 +108,11 @@ end subroutine end interface +! acc_async_wait is an OpenACC 1.0 compatibility name for acc_wait. + interface acc_async_wait + procedure :: acc_wait_h + end interface + interface acc_wait_async subroutine acc_wait_async_h (a1, a2) integer a1, a2 @@ -119,6 +124,12 @@ end subroutine end interface +! acc_async_wait_all is an OpenACC 1.0 compatibility name for +! acc_wait_all. + interface acc_async_wait_all + procedure :: acc_wait_all_h + end interface + interface acc_wait_all_async subroutine acc_wait_all_async_h (a) integer a diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c index 911b76c..5ab52e9 100644 --- libgomp/testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c +++ libgomp/testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c @@ -1,10 +1,11 @@ +/* Test of reduction on parallel directive (with async). */ +/* See also Fortran variants in "../libgomp.oacc-fortran/par-reduction-2*". */ + /* { dg-additional-options "-w" } */ #include <assert.h> #include <openacc.h> -/* Test of reduction on parallel directive (with async). */ - int main (int argc, char *argv[]) { @@ -25,7 +26,7 @@ main (int argc, char *argv[]) } res = GANGS * 5; - acc_wait (1); + acc_async_wait (1); assert (res == res1); assert (res == res2); @@ -49,7 +50,7 @@ main (int argc, char *argv[]) for (int i = 0; i < GANGS; ++i) res *= 5; - acc_wait (1); + acc_async_wait_all (); assert (res == res1); assert (res == res2); diff --git libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-1.f libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-1.f new file mode 100644 index 0000000..dcd6592 --- /dev/null +++ libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-1.f @@ -0,0 +1,57 @@ +! Test of reduction on parallel directive (with async). +! Variant of "../libgomp.oacc-c-c++-common/par-reduction-2.c". +! Variant using "openacc_lib.h". + +! { dg-do run } + + PROGRAM MAIN + IMPLICIT NONE + INCLUDE "openacc_lib.h" + + INTEGER RES, RES1, RES2 + + RES1 = 0 + RES2 = 0 + +!$ACC PARALLEL NUM_GANGS(256) NUM_WORKERS(32) VECTOR_LENGTH(32) +!$ACC& REDUCTION(+:RES1) COPY(RES1, RES2) ASYNC(1) + res1 = res1 + 5 + +!$ACC ATOMIC + res2 = res2 + 5 +!$ACC END PARALLEL + + IF (ACC_GET_DEVICE_TYPE () .EQ. ACC_DEVICE_HOST) THEN + RES = 1 * 5 + ELSE + RES = 256 * 5 + END IF + + CALL ACC_ASYNC_WAIT (1) + + IF (RES .NE. RES1) CALL ABORT + IF (RES .NE. RES2) CALL ABORT + + RES1 = 1 + RES2 = 1 + +!$ACC PARALLEL NUM_GANGS(8) NUM_WORKERS(32) VECTOR_LENGTH(32) +!$ACC& REDUCTION(*:RES1) COPY(RES1, RES2) ASYNC(1) + res1 = res1 * 5 + +!$ACC ATOMIC + res2 = res2 * 5 +!$ACC END PARALLEL + + IF (ACC_GET_DEVICE_TYPE () .EQ. ACC_DEVICE_HOST) THEN + RES = 5 ** 1 + ELSE + RES = 5 ** 8 + END IF + + CALL ACC_ASYNC_WAIT_ALL + + IF (RES .NE. RES1) CALL ABORT + IF (RES .NE. RES2) CALL ABORT + + END PROGRAM diff --git libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-2.f libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-2.f new file mode 100644 index 0000000..bf72002 --- /dev/null +++ libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-2.f @@ -0,0 +1,57 @@ +! Test of reduction on parallel directive (with async). +! Variant of "../libgomp.oacc-c-c++-common/par-reduction-2.c". +! Variant using the "openacc" module. + +! { dg-do run } + + PROGRAM MAIN + USE OPENACC + IMPLICIT NONE + + INTEGER RES, RES1, RES2 + + RES1 = 0 + RES2 = 0 + +!$ACC PARALLEL NUM_GANGS(256) NUM_WORKERS(32) VECTOR_LENGTH(32) +!$ACC& REDUCTION(+:RES1) COPY(RES1, RES2) ASYNC(1) + res1 = res1 + 5 + +!$ACC ATOMIC + res2 = res2 + 5 +!$ACC END PARALLEL + + IF (ACC_GET_DEVICE_TYPE () .EQ. ACC_DEVICE_HOST) THEN + RES = 1 * 5 + ELSE + RES = 256 * 5 + END IF + + CALL ACC_ASYNC_WAIT (1) + + IF (RES .NE. RES1) CALL ABORT + IF (RES .NE. RES2) CALL ABORT + + RES1 = 1 + RES2 = 1 + +!$ACC PARALLEL NUM_GANGS(8) NUM_WORKERS(32) VECTOR_LENGTH(32) +!$ACC& REDUCTION(*:RES1) COPY(RES1, RES2) ASYNC(1) + res1 = res1 * 5 + +!$ACC ATOMIC + res2 = res2 * 5 +!$ACC END PARALLEL + + IF (ACC_GET_DEVICE_TYPE () .EQ. ACC_DEVICE_HOST) THEN + RES = 5 ** 1 + ELSE + RES = 5 ** 8 + END IF + + CALL ACC_ASYNC_WAIT_ALL + + IF (RES .NE. RES1) CALL ABORT + IF (RES .NE. RES2) CALL ABORT + + END PROGRAM Grüße Thomas ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: OpenACC 1.0 compatibility: acc_async_wait, acc_async_wait_all 2017-05-22 17:45 ` OpenACC 1.0 compatibility: acc_async_wait, acc_async_wait_all Thomas Schwinge @ 2017-05-23 11:28 ` Jakub Jelinek 2017-05-24 11:54 ` Thomas Schwinge 0 siblings, 1 reply; 5+ messages in thread From: Jakub Jelinek @ 2017-05-23 11:28 UTC (permalink / raw) To: Thomas Schwinge; +Cc: gcc-patches On Mon, May 22, 2017 at 07:42:38PM +0200, Thomas Schwinge wrote: > Hi! > > For OpenACC 1.0 compatibility, we need to provide the aliases > acc_async_wait, and acc_async_wait_all for acc_wait, and acc_wait_all, > respectively. OK for trunk? > > commit 0f8302913db6d2c23804a3463c51a47e623e76b2 > Author: Thomas Schwinge <thomas@codesourcery.com> > Date: Mon May 22 19:22:24 2017 +0200 > > OpenACC 1.0 compatibility: acc_async_wait, acc_async_wait_all > > libgomp/ > * openacc.h (acc_async_wait, acc_async_wait_all): New prototypes. > * libgomp.map (OACC_2.0): Add these. > * oacc-async.c (acc_async_wait, acc_async_wait_all): New aliases > for "acc_wait", and "acc_wait_all", respectively. > * openacc.f90 (acc_async_wait, acc_async_wait_all): New interfaces > for "acc_wait", and "acc_wait_all", respectively. > * openacc_lib.h (acc_async_wait, acc_async_wait_all): Likewise. > * libgomp.texi (acc_wait, acc_wait_all): Update. > * testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c: Update. > * testsuite/libgomp.oacc-fortran/par-reduction-2-1.f: New file. > * testsuite/libgomp.oacc-fortran/par-reduction-2-2.f: Likewise. All I've said about acc_pcopyin applies here too. Except that OACC_1.0 as symbol version might look like a good idea here. Jakub ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: OpenACC 1.0 compatibility: acc_async_wait, acc_async_wait_all 2017-05-23 11:28 ` Jakub Jelinek @ 2017-05-24 11:54 ` Thomas Schwinge 2017-05-24 11:58 ` Jakub Jelinek 0 siblings, 1 reply; 5+ messages in thread From: Thomas Schwinge @ 2017-05-24 11:54 UTC (permalink / raw) To: Jakub Jelinek, gcc-patches, fortran Hi Jakub! On Tue, 23 May 2017 13:17:26 +0200, Jakub Jelinek <jakub@redhat.com> wrote: > On Mon, May 22, 2017 at 07:42:38PM +0200, Thomas Schwinge wrote: > > For OpenACC 1.0 compatibility, we need to provide the aliases > > acc_async_wait, and acc_async_wait_all for acc_wait, and acc_wait_all, > > respectively. > > OpenACC 1.0 compatibility: acc_async_wait, acc_async_wait_all > All I've said about acc_pcopyin applies here too. Obviously. ;-) > Except that OACC_1.0 > as symbol version might look like a good idea here. GCC never implemented OpenACC 1.0 but directly started with 2.0a, so I would find it confusing to now starting using 1.0 versions for these symbols specifically. OK for trunk using "OACC_2.0.1" symbol version? commit 5c0da4609b29a406601c2dd92f8dbff2f448bc1d Author: Thomas Schwinge <thomas@codesourcery.com> Date: Wed May 24 12:49:19 2017 +0200 OpenACC 1.0 compatibility: acc_async_wait, acc_async_wait_all libgomp/ * openacc.h (acc_async_wait, acc_async_wait_all): New prototypes. * libgomp.map (OACC_2.0.1): Add these. * oacc-async.c (acc_async_wait, acc_async_wait_all): New aliases for "acc_wait", and "acc_wait_all", respectively. * openacc.f90 (acc_async_wait, acc_async_wait_all): New interfaces for "acc_wait", and "acc_wait_all", respectively. * openacc_lib.h (acc_async_wait, acc_async_wait_all): Likewise. * libgomp.texi (acc_wait, acc_wait_all): Update. * testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c: Update. * testsuite/libgomp.oacc-fortran/par-reduction-2-1.f: New file. * testsuite/libgomp.oacc-fortran/par-reduction-2-2.f: Likewise. --- libgomp/libgomp.map | 2 + libgomp/libgomp.texi | 7 ++- libgomp/oacc-async.c | 22 +++++++++ libgomp/openacc.f90 | 16 +++++- libgomp/openacc.h | 2 + libgomp/openacc_lib.h | 11 +++++ .../libgomp.oacc-c-c++-common/par-reduction-2.c | 9 ++-- .../libgomp.oacc-fortran/par-reduction-2-1.f | 57 ++++++++++++++++++++++ .../libgomp.oacc-fortran/par-reduction-2-2.f | 57 ++++++++++++++++++++++ 9 files changed, 176 insertions(+), 7 deletions(-) diff --git libgomp/libgomp.map libgomp/libgomp.map index b43c6de..f9044ae 100644 --- libgomp/libgomp.map +++ libgomp/libgomp.map @@ -380,6 +380,8 @@ OACC_2.0 { OACC_2.0.1 { global: + acc_async_wait; + acc_async_wait_all; acc_pcopyin; acc_pcreate; } OACC_2.0; diff --git libgomp/libgomp.texi libgomp/libgomp.texi index cc5ee1c..230720f 100644 --- libgomp/libgomp.texi +++ libgomp/libgomp.texi @@ -2095,12 +2095,15 @@ specified in @var{arg}. @item @emph{C/C++}: @multitable @columnfractions .20 .80 @item @emph{Prototype}: @tab @code{acc_wait(arg);} +@item @emph{Prototype (OpenACC 1.0 compatibility)}: @tab @code{acc_async_wait(arg);} @end multitable @item @emph{Fortran}: @multitable @columnfractions .20 .80 @item @emph{Interface}: @tab @code{subroutine acc_wait(arg)} @item @tab @code{integer(acc_handle_kind) arg} +@item @emph{Interface (OpenACC 1.0 compatibility)}: @tab @code{subroutine acc_async_wait(arg)} +@item @tab @code{integer(acc_handle_kind) arg} @end multitable @item @emph{Reference}: @@ -2119,11 +2122,13 @@ This function waits for the completion of all asynchronous operations. @item @emph{C/C++}: @multitable @columnfractions .20 .80 @item @emph{Prototype}: @tab @code{acc_wait_all(void);} +@item @emph{Prototype (OpenACC 1.0 compatibility)}: @tab @code{acc_async_wait_all(void);} @end multitable @item @emph{Fortran}: @multitable @columnfractions .20 .80 -@item @emph{Interface}: @tab @code{subroutine acc_wait_async()} +@item @emph{Interface}: @tab @code{subroutine acc_wait_all()} +@item @emph{Interface (OpenACC 1.0 compatibility)}: @tab @code{subroutine acc_async_wait_all()} @end multitable @item @emph{Reference}: diff --git libgomp/oacc-async.c libgomp/oacc-async.c index b68c84d..1334f99 100644 --- libgomp/oacc-async.c +++ libgomp/oacc-async.c @@ -70,6 +70,17 @@ acc_wait (int async) thr->dev->openacc.async_wait_func (async); } +/* acc_async_wait is an OpenACC 1.0 compatibility name for acc_wait. */ +#ifdef HAVE_ATTRIBUTE_ALIAS +strong_alias (acc_wait, acc_async_wait) +#else +void +acc_async_wait (int async) +{ + acc_wait (async); +} +#endif + void acc_wait_async (int async1, int async2) { @@ -92,6 +103,17 @@ acc_wait_all (void) thr->dev->openacc.async_wait_all_func (); } +/* acc_async_wait_all is an OpenACC 1.0 compatibility name for acc_wait_all. */ +#ifdef HAVE_ATTRIBUTE_ALIAS +strong_alias (acc_wait_all, acc_async_wait_all) +#else +void +acc_async_wait_all (void) +{ + acc_wait_all (); +} +#endif + void acc_wait_all_async (int async) { diff --git libgomp/openacc.f90 libgomp/openacc.f90 index a4422d4..0eb34ff 100644 --- libgomp/openacc.f90 +++ libgomp/openacc.f90 @@ -470,8 +470,10 @@ module openacc public :: acc_get_num_devices, acc_set_device_type, acc_get_device_type public :: acc_set_device_num, acc_get_device_num, acc_async_test - public :: acc_async_test_all, acc_wait, acc_wait_async, acc_wait_all - public :: acc_wait_all_async, acc_init, acc_shutdown, acc_on_device + public :: acc_async_test_all + public :: acc_wait, acc_async_wait, acc_wait_async + public :: acc_wait_all, acc_async_wait_all, acc_wait_all_async + public :: acc_init, acc_shutdown, acc_on_device public :: acc_copyin, acc_present_or_copyin, acc_pcopyin, acc_create public :: acc_present_or_create, acc_pcreate, acc_copyout, acc_delete public :: acc_update_device, acc_update_self, acc_is_present @@ -510,6 +512,11 @@ module openacc procedure :: acc_wait_h end interface + ! acc_async_wait is an OpenACC 1.0 compatibility name for acc_wait. + interface acc_async_wait + procedure :: acc_wait_h + end interface + interface acc_wait_async procedure :: acc_wait_async_h end interface @@ -518,6 +525,11 @@ module openacc procedure :: acc_wait_all_h end interface + ! acc_async_wait_all is an OpenACC 1.0 compatibility name for acc_wait_all. + interface acc_async_wait_all + procedure :: acc_wait_all_h + end interface + interface acc_wait_all_async procedure :: acc_wait_all_async_h end interface diff --git libgomp/openacc.h libgomp/openacc.h index ebccb18..137e2c1 100644 --- libgomp/openacc.h +++ libgomp/openacc.h @@ -75,8 +75,10 @@ int acc_get_device_num (acc_device_t) __GOACC_NOTHROW; int acc_async_test (int) __GOACC_NOTHROW; int acc_async_test_all (void) __GOACC_NOTHROW; void acc_wait (int) __GOACC_NOTHROW; +void acc_async_wait (int) __GOACC_NOTHROW; void acc_wait_async (int, int) __GOACC_NOTHROW; void acc_wait_all (void) __GOACC_NOTHROW; +void acc_async_wait_all (void) __GOACC_NOTHROW; void acc_wait_all_async (int) __GOACC_NOTHROW; void acc_init (acc_device_t) __GOACC_NOTHROW; void acc_shutdown (acc_device_t) __GOACC_NOTHROW; diff --git libgomp/openacc_lib.h libgomp/openacc_lib.h index 7818bd7..289b551 100644 --- libgomp/openacc_lib.h +++ libgomp/openacc_lib.h @@ -108,6 +108,11 @@ end subroutine end interface +! acc_async_wait is an OpenACC 1.0 compatibility name for acc_wait. + interface acc_async_wait + procedure :: acc_wait_h + end interface + interface acc_wait_async subroutine acc_wait_async_h (a1, a2) integer a1, a2 @@ -119,6 +124,12 @@ end subroutine end interface +! acc_async_wait_all is an OpenACC 1.0 compatibility name for +! acc_wait_all. + interface acc_async_wait_all + procedure :: acc_wait_all_h + end interface + interface acc_wait_all_async subroutine acc_wait_all_async_h (a) integer a diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c index 911b76c..5ab52e9 100644 --- libgomp/testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c +++ libgomp/testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c @@ -1,10 +1,11 @@ +/* Test of reduction on parallel directive (with async). */ +/* See also Fortran variants in "../libgomp.oacc-fortran/par-reduction-2*". */ + /* { dg-additional-options "-w" } */ #include <assert.h> #include <openacc.h> -/* Test of reduction on parallel directive (with async). */ - int main (int argc, char *argv[]) { @@ -25,7 +26,7 @@ main (int argc, char *argv[]) } res = GANGS * 5; - acc_wait (1); + acc_async_wait (1); assert (res == res1); assert (res == res2); @@ -49,7 +50,7 @@ main (int argc, char *argv[]) for (int i = 0; i < GANGS; ++i) res *= 5; - acc_wait (1); + acc_async_wait_all (); assert (res == res1); assert (res == res2); diff --git libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-1.f libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-1.f new file mode 100644 index 0000000..dcd6592 --- /dev/null +++ libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-1.f @@ -0,0 +1,57 @@ +! Test of reduction on parallel directive (with async). +! Variant of "../libgomp.oacc-c-c++-common/par-reduction-2.c". +! Variant using "openacc_lib.h". + +! { dg-do run } + + PROGRAM MAIN + IMPLICIT NONE + INCLUDE "openacc_lib.h" + + INTEGER RES, RES1, RES2 + + RES1 = 0 + RES2 = 0 + +!$ACC PARALLEL NUM_GANGS(256) NUM_WORKERS(32) VECTOR_LENGTH(32) +!$ACC& REDUCTION(+:RES1) COPY(RES1, RES2) ASYNC(1) + res1 = res1 + 5 + +!$ACC ATOMIC + res2 = res2 + 5 +!$ACC END PARALLEL + + IF (ACC_GET_DEVICE_TYPE () .EQ. ACC_DEVICE_HOST) THEN + RES = 1 * 5 + ELSE + RES = 256 * 5 + END IF + + CALL ACC_ASYNC_WAIT (1) + + IF (RES .NE. RES1) CALL ABORT + IF (RES .NE. RES2) CALL ABORT + + RES1 = 1 + RES2 = 1 + +!$ACC PARALLEL NUM_GANGS(8) NUM_WORKERS(32) VECTOR_LENGTH(32) +!$ACC& REDUCTION(*:RES1) COPY(RES1, RES2) ASYNC(1) + res1 = res1 * 5 + +!$ACC ATOMIC + res2 = res2 * 5 +!$ACC END PARALLEL + + IF (ACC_GET_DEVICE_TYPE () .EQ. ACC_DEVICE_HOST) THEN + RES = 5 ** 1 + ELSE + RES = 5 ** 8 + END IF + + CALL ACC_ASYNC_WAIT_ALL + + IF (RES .NE. RES1) CALL ABORT + IF (RES .NE. RES2) CALL ABORT + + END PROGRAM diff --git libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-2.f libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-2.f new file mode 100644 index 0000000..bf72002 --- /dev/null +++ libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-2.f @@ -0,0 +1,57 @@ +! Test of reduction on parallel directive (with async). +! Variant of "../libgomp.oacc-c-c++-common/par-reduction-2.c". +! Variant using the "openacc" module. + +! { dg-do run } + + PROGRAM MAIN + USE OPENACC + IMPLICIT NONE + + INTEGER RES, RES1, RES2 + + RES1 = 0 + RES2 = 0 + +!$ACC PARALLEL NUM_GANGS(256) NUM_WORKERS(32) VECTOR_LENGTH(32) +!$ACC& REDUCTION(+:RES1) COPY(RES1, RES2) ASYNC(1) + res1 = res1 + 5 + +!$ACC ATOMIC + res2 = res2 + 5 +!$ACC END PARALLEL + + IF (ACC_GET_DEVICE_TYPE () .EQ. ACC_DEVICE_HOST) THEN + RES = 1 * 5 + ELSE + RES = 256 * 5 + END IF + + CALL ACC_ASYNC_WAIT (1) + + IF (RES .NE. RES1) CALL ABORT + IF (RES .NE. RES2) CALL ABORT + + RES1 = 1 + RES2 = 1 + +!$ACC PARALLEL NUM_GANGS(8) NUM_WORKERS(32) VECTOR_LENGTH(32) +!$ACC& REDUCTION(*:RES1) COPY(RES1, RES2) ASYNC(1) + res1 = res1 * 5 + +!$ACC ATOMIC + res2 = res2 * 5 +!$ACC END PARALLEL + + IF (ACC_GET_DEVICE_TYPE () .EQ. ACC_DEVICE_HOST) THEN + RES = 5 ** 1 + ELSE + RES = 5 ** 8 + END IF + + CALL ACC_ASYNC_WAIT_ALL + + IF (RES .NE. RES1) CALL ABORT + IF (RES .NE. RES2) CALL ABORT + + END PROGRAM Grüße Thomas ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: OpenACC 1.0 compatibility: acc_async_wait, acc_async_wait_all 2017-05-24 11:54 ` Thomas Schwinge @ 2017-05-24 11:58 ` Jakub Jelinek 2017-05-24 13:48 ` Thomas Schwinge 0 siblings, 1 reply; 5+ messages in thread From: Jakub Jelinek @ 2017-05-24 11:58 UTC (permalink / raw) To: Thomas Schwinge; +Cc: gcc-patches, fortran On Wed, May 24, 2017 at 01:47:34PM +0200, Thomas Schwinge wrote: > Hi Jakub! > > On Tue, 23 May 2017 13:17:26 +0200, Jakub Jelinek <jakub@redhat.com> wrote: > > On Mon, May 22, 2017 at 07:42:38PM +0200, Thomas Schwinge wrote: > > > For OpenACC 1.0 compatibility, we need to provide the aliases > > > acc_async_wait, and acc_async_wait_all for acc_wait, and acc_wait_all, > > > respectively. > > > > OpenACC 1.0 compatibility: acc_async_wait, acc_async_wait_all > > > All I've said about acc_pcopyin applies here too. > > Obviously. ;-) > > > Except that OACC_1.0 > > as symbol version might look like a good idea here. > > GCC never implemented OpenACC 1.0 but directly started with 2.0a, so I > would find it confusing to now starting using 1.0 versions for these > symbols specifically. > > OK for trunk using "OACC_2.0.1" symbol version? Ok. Jakub ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: OpenACC 1.0 compatibility: acc_async_wait, acc_async_wait_all 2017-05-24 11:58 ` Jakub Jelinek @ 2017-05-24 13:48 ` Thomas Schwinge 0 siblings, 0 replies; 5+ messages in thread From: Thomas Schwinge @ 2017-05-24 13:48 UTC (permalink / raw) To: Jakub Jelinek, gcc-patches, fortran Hi! On Wed, 24 May 2017 13:58:12 +0200, Jakub Jelinek <jakub@redhat.com> wrote: > On Wed, May 24, 2017 at 01:47:34PM +0200, Thomas Schwinge wrote: > > On Tue, 23 May 2017 13:17:26 +0200, Jakub Jelinek <jakub@redhat.com> wrote: > > > On Mon, May 22, 2017 at 07:42:38PM +0200, Thomas Schwinge wrote: > > > > For OpenACC 1.0 compatibility, we need to provide the aliases > > > > acc_async_wait, and acc_async_wait_all for acc_wait, and acc_wait_all, > > > > respectively. > > > > > > OpenACC 1.0 compatibility: acc_async_wait, acc_async_wait_all > > OK for trunk using "OACC_2.0.1" symbol version? > > Ok. Thanks. Committed to trunk in r248413: commit 0e1c776433f71834e5af2c9778a4f20bfb04f7f3 Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Wed May 24 13:25:01 2017 +0000 OpenACC 1.0 compatibility: acc_async_wait, acc_async_wait_all libgomp/ * openacc.h (acc_async_wait, acc_async_wait_all): New prototypes. * libgomp.map (OACC_2.0.1): Add these. * oacc-async.c (acc_async_wait, acc_async_wait_all): New aliases for "acc_wait", and "acc_wait_all", respectively. * openacc.f90 (acc_async_wait, acc_async_wait_all): New interfaces for "acc_wait", and "acc_wait_all", respectively. * openacc_lib.h (acc_async_wait, acc_async_wait_all): Likewise. * libgomp.texi (acc_wait, acc_wait_all): Update. * testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c: Update. * testsuite/libgomp.oacc-fortran/par-reduction-2-1.f: New file. * testsuite/libgomp.oacc-fortran/par-reduction-2-2.f: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248413 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgomp/ChangeLog | 12 +++++ libgomp/libgomp.map | 2 + libgomp/libgomp.texi | 7 ++- libgomp/oacc-async.c | 22 +++++++++ libgomp/openacc.f90 | 16 +++++- libgomp/openacc.h | 2 + libgomp/openacc_lib.h | 11 +++++ .../libgomp.oacc-c-c++-common/par-reduction-2.c | 9 ++-- .../libgomp.oacc-fortran/par-reduction-2-1.f | 57 ++++++++++++++++++++++ .../libgomp.oacc-fortran/par-reduction-2-2.f | 57 ++++++++++++++++++++++ 10 files changed, 188 insertions(+), 7 deletions(-) diff --git libgomp/ChangeLog libgomp/ChangeLog index 55869d2..8adc10b 100644 --- libgomp/ChangeLog +++ libgomp/ChangeLog @@ -1,5 +1,17 @@ 2017-05-24 Thomas Schwinge <thomas@codesourcery.com> + * openacc.h (acc_async_wait, acc_async_wait_all): New prototypes. + * libgomp.map (OACC_2.0.1): Add these. + * oacc-async.c (acc_async_wait, acc_async_wait_all): New aliases + for "acc_wait", and "acc_wait_all", respectively. + * openacc.f90 (acc_async_wait, acc_async_wait_all): New interfaces + for "acc_wait", and "acc_wait_all", respectively. + * openacc_lib.h (acc_async_wait, acc_async_wait_all): Likewise. + * libgomp.texi (acc_wait, acc_wait_all): Update. + * testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c: Update. + * testsuite/libgomp.oacc-fortran/par-reduction-2-1.f: New file. + * testsuite/libgomp.oacc-fortran/par-reduction-2-2.f: Likewise. + * openacc_lib.h (acc_pcopyin, acc_pcreate): Route to acc_present_or_copyin and acc_present_or_create procedures, respectively. diff --git libgomp/libgomp.map libgomp/libgomp.map index b43c6de..f9044ae 100644 --- libgomp/libgomp.map +++ libgomp/libgomp.map @@ -380,6 +380,8 @@ OACC_2.0 { OACC_2.0.1 { global: + acc_async_wait; + acc_async_wait_all; acc_pcopyin; acc_pcreate; } OACC_2.0; diff --git libgomp/libgomp.texi libgomp/libgomp.texi index cc5ee1c..230720f 100644 --- libgomp/libgomp.texi +++ libgomp/libgomp.texi @@ -2095,12 +2095,15 @@ specified in @var{arg}. @item @emph{C/C++}: @multitable @columnfractions .20 .80 @item @emph{Prototype}: @tab @code{acc_wait(arg);} +@item @emph{Prototype (OpenACC 1.0 compatibility)}: @tab @code{acc_async_wait(arg);} @end multitable @item @emph{Fortran}: @multitable @columnfractions .20 .80 @item @emph{Interface}: @tab @code{subroutine acc_wait(arg)} @item @tab @code{integer(acc_handle_kind) arg} +@item @emph{Interface (OpenACC 1.0 compatibility)}: @tab @code{subroutine acc_async_wait(arg)} +@item @tab @code{integer(acc_handle_kind) arg} @end multitable @item @emph{Reference}: @@ -2119,11 +2122,13 @@ This function waits for the completion of all asynchronous operations. @item @emph{C/C++}: @multitable @columnfractions .20 .80 @item @emph{Prototype}: @tab @code{acc_wait_all(void);} +@item @emph{Prototype (OpenACC 1.0 compatibility)}: @tab @code{acc_async_wait_all(void);} @end multitable @item @emph{Fortran}: @multitable @columnfractions .20 .80 -@item @emph{Interface}: @tab @code{subroutine acc_wait_async()} +@item @emph{Interface}: @tab @code{subroutine acc_wait_all()} +@item @emph{Interface (OpenACC 1.0 compatibility)}: @tab @code{subroutine acc_async_wait_all()} @end multitable @item @emph{Reference}: diff --git libgomp/oacc-async.c libgomp/oacc-async.c index b68c84d..1334f99 100644 --- libgomp/oacc-async.c +++ libgomp/oacc-async.c @@ -70,6 +70,17 @@ acc_wait (int async) thr->dev->openacc.async_wait_func (async); } +/* acc_async_wait is an OpenACC 1.0 compatibility name for acc_wait. */ +#ifdef HAVE_ATTRIBUTE_ALIAS +strong_alias (acc_wait, acc_async_wait) +#else +void +acc_async_wait (int async) +{ + acc_wait (async); +} +#endif + void acc_wait_async (int async1, int async2) { @@ -92,6 +103,17 @@ acc_wait_all (void) thr->dev->openacc.async_wait_all_func (); } +/* acc_async_wait_all is an OpenACC 1.0 compatibility name for acc_wait_all. */ +#ifdef HAVE_ATTRIBUTE_ALIAS +strong_alias (acc_wait_all, acc_async_wait_all) +#else +void +acc_async_wait_all (void) +{ + acc_wait_all (); +} +#endif + void acc_wait_all_async (int async) { diff --git libgomp/openacc.f90 libgomp/openacc.f90 index a4422d4..0eb34ff 100644 --- libgomp/openacc.f90 +++ libgomp/openacc.f90 @@ -470,8 +470,10 @@ module openacc public :: acc_get_num_devices, acc_set_device_type, acc_get_device_type public :: acc_set_device_num, acc_get_device_num, acc_async_test - public :: acc_async_test_all, acc_wait, acc_wait_async, acc_wait_all - public :: acc_wait_all_async, acc_init, acc_shutdown, acc_on_device + public :: acc_async_test_all + public :: acc_wait, acc_async_wait, acc_wait_async + public :: acc_wait_all, acc_async_wait_all, acc_wait_all_async + public :: acc_init, acc_shutdown, acc_on_device public :: acc_copyin, acc_present_or_copyin, acc_pcopyin, acc_create public :: acc_present_or_create, acc_pcreate, acc_copyout, acc_delete public :: acc_update_device, acc_update_self, acc_is_present @@ -510,6 +512,11 @@ module openacc procedure :: acc_wait_h end interface + ! acc_async_wait is an OpenACC 1.0 compatibility name for acc_wait. + interface acc_async_wait + procedure :: acc_wait_h + end interface + interface acc_wait_async procedure :: acc_wait_async_h end interface @@ -518,6 +525,11 @@ module openacc procedure :: acc_wait_all_h end interface + ! acc_async_wait_all is an OpenACC 1.0 compatibility name for acc_wait_all. + interface acc_async_wait_all + procedure :: acc_wait_all_h + end interface + interface acc_wait_all_async procedure :: acc_wait_all_async_h end interface diff --git libgomp/openacc.h libgomp/openacc.h index ebccb18..137e2c1 100644 --- libgomp/openacc.h +++ libgomp/openacc.h @@ -75,8 +75,10 @@ int acc_get_device_num (acc_device_t) __GOACC_NOTHROW; int acc_async_test (int) __GOACC_NOTHROW; int acc_async_test_all (void) __GOACC_NOTHROW; void acc_wait (int) __GOACC_NOTHROW; +void acc_async_wait (int) __GOACC_NOTHROW; void acc_wait_async (int, int) __GOACC_NOTHROW; void acc_wait_all (void) __GOACC_NOTHROW; +void acc_async_wait_all (void) __GOACC_NOTHROW; void acc_wait_all_async (int) __GOACC_NOTHROW; void acc_init (acc_device_t) __GOACC_NOTHROW; void acc_shutdown (acc_device_t) __GOACC_NOTHROW; diff --git libgomp/openacc_lib.h libgomp/openacc_lib.h index 7818bd7..289b551 100644 --- libgomp/openacc_lib.h +++ libgomp/openacc_lib.h @@ -108,6 +108,11 @@ end subroutine end interface +! acc_async_wait is an OpenACC 1.0 compatibility name for acc_wait. + interface acc_async_wait + procedure :: acc_wait_h + end interface + interface acc_wait_async subroutine acc_wait_async_h (a1, a2) integer a1, a2 @@ -119,6 +124,12 @@ end subroutine end interface +! acc_async_wait_all is an OpenACC 1.0 compatibility name for +! acc_wait_all. + interface acc_async_wait_all + procedure :: acc_wait_all_h + end interface + interface acc_wait_all_async subroutine acc_wait_all_async_h (a) integer a diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c index 911b76c..5ab52e9 100644 --- libgomp/testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c +++ libgomp/testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c @@ -1,10 +1,11 @@ +/* Test of reduction on parallel directive (with async). */ +/* See also Fortran variants in "../libgomp.oacc-fortran/par-reduction-2*". */ + /* { dg-additional-options "-w" } */ #include <assert.h> #include <openacc.h> -/* Test of reduction on parallel directive (with async). */ - int main (int argc, char *argv[]) { @@ -25,7 +26,7 @@ main (int argc, char *argv[]) } res = GANGS * 5; - acc_wait (1); + acc_async_wait (1); assert (res == res1); assert (res == res2); @@ -49,7 +50,7 @@ main (int argc, char *argv[]) for (int i = 0; i < GANGS; ++i) res *= 5; - acc_wait (1); + acc_async_wait_all (); assert (res == res1); assert (res == res2); diff --git libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-1.f libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-1.f new file mode 100644 index 0000000..dcd6592 --- /dev/null +++ libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-1.f @@ -0,0 +1,57 @@ +! Test of reduction on parallel directive (with async). +! Variant of "../libgomp.oacc-c-c++-common/par-reduction-2.c". +! Variant using "openacc_lib.h". + +! { dg-do run } + + PROGRAM MAIN + IMPLICIT NONE + INCLUDE "openacc_lib.h" + + INTEGER RES, RES1, RES2 + + RES1 = 0 + RES2 = 0 + +!$ACC PARALLEL NUM_GANGS(256) NUM_WORKERS(32) VECTOR_LENGTH(32) +!$ACC& REDUCTION(+:RES1) COPY(RES1, RES2) ASYNC(1) + res1 = res1 + 5 + +!$ACC ATOMIC + res2 = res2 + 5 +!$ACC END PARALLEL + + IF (ACC_GET_DEVICE_TYPE () .EQ. ACC_DEVICE_HOST) THEN + RES = 1 * 5 + ELSE + RES = 256 * 5 + END IF + + CALL ACC_ASYNC_WAIT (1) + + IF (RES .NE. RES1) CALL ABORT + IF (RES .NE. RES2) CALL ABORT + + RES1 = 1 + RES2 = 1 + +!$ACC PARALLEL NUM_GANGS(8) NUM_WORKERS(32) VECTOR_LENGTH(32) +!$ACC& REDUCTION(*:RES1) COPY(RES1, RES2) ASYNC(1) + res1 = res1 * 5 + +!$ACC ATOMIC + res2 = res2 * 5 +!$ACC END PARALLEL + + IF (ACC_GET_DEVICE_TYPE () .EQ. ACC_DEVICE_HOST) THEN + RES = 5 ** 1 + ELSE + RES = 5 ** 8 + END IF + + CALL ACC_ASYNC_WAIT_ALL + + IF (RES .NE. RES1) CALL ABORT + IF (RES .NE. RES2) CALL ABORT + + END PROGRAM diff --git libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-2.f libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-2.f new file mode 100644 index 0000000..bf72002 --- /dev/null +++ libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-2.f @@ -0,0 +1,57 @@ +! Test of reduction on parallel directive (with async). +! Variant of "../libgomp.oacc-c-c++-common/par-reduction-2.c". +! Variant using the "openacc" module. + +! { dg-do run } + + PROGRAM MAIN + USE OPENACC + IMPLICIT NONE + + INTEGER RES, RES1, RES2 + + RES1 = 0 + RES2 = 0 + +!$ACC PARALLEL NUM_GANGS(256) NUM_WORKERS(32) VECTOR_LENGTH(32) +!$ACC& REDUCTION(+:RES1) COPY(RES1, RES2) ASYNC(1) + res1 = res1 + 5 + +!$ACC ATOMIC + res2 = res2 + 5 +!$ACC END PARALLEL + + IF (ACC_GET_DEVICE_TYPE () .EQ. ACC_DEVICE_HOST) THEN + RES = 1 * 5 + ELSE + RES = 256 * 5 + END IF + + CALL ACC_ASYNC_WAIT (1) + + IF (RES .NE. RES1) CALL ABORT + IF (RES .NE. RES2) CALL ABORT + + RES1 = 1 + RES2 = 1 + +!$ACC PARALLEL NUM_GANGS(8) NUM_WORKERS(32) VECTOR_LENGTH(32) +!$ACC& REDUCTION(*:RES1) COPY(RES1, RES2) ASYNC(1) + res1 = res1 * 5 + +!$ACC ATOMIC + res2 = res2 * 5 +!$ACC END PARALLEL + + IF (ACC_GET_DEVICE_TYPE () .EQ. ACC_DEVICE_HOST) THEN + RES = 5 ** 1 + ELSE + RES = 5 ** 8 + END IF + + CALL ACC_ASYNC_WAIT_ALL + + IF (RES .NE. RES1) CALL ABORT + IF (RES .NE. RES2) CALL ABORT + + END PROGRAM Committed to gomp-4_0-branch in r248417: commit 8d9846ab26ce26a91aeae2b1c7e94f854ad0a331 Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Wed May 24 13:26:16 2017 +0000 OpenACC 1.0 compatibility: acc_async_wait, acc_async_wait_all libgomp/ * openacc.h (acc_async_wait, acc_async_wait_all): New prototypes. * libgomp.map (OACC_2.0.1): Add these. * oacc-async.c (acc_async_wait, acc_async_wait_all): New aliases for "acc_wait", and "acc_wait_all", respectively. * openacc.f90 (acc_async_wait, acc_async_wait_all): New interfaces for "acc_wait", and "acc_wait_all", respectively. * openacc_lib.h (acc_async_wait, acc_async_wait_all): Likewise. * libgomp.texi (acc_wait, acc_wait_all): Update. * testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c: Update. * testsuite/libgomp.oacc-fortran/par-reduction-2-1.f: New file. * testsuite/libgomp.oacc-fortran/par-reduction-2-2.f: Likewise. trunk r248413 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@248417 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgomp/ChangeLog.gomp | 12 +++++ libgomp/libgomp.map | 2 + libgomp/libgomp.texi | 7 ++- libgomp/oacc-async.c | 22 +++++++++ libgomp/openacc.f90 | 16 +++++- libgomp/openacc.h | 2 + libgomp/openacc_lib.h | 11 +++++ .../libgomp.oacc-c-c++-common/par-reduction-2.c | 9 ++-- .../libgomp.oacc-fortran/par-reduction-2-1.f | 57 ++++++++++++++++++++++ .../libgomp.oacc-fortran/par-reduction-2-2.f | 57 ++++++++++++++++++++++ 10 files changed, 188 insertions(+), 7 deletions(-) diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp index bbd7ec6..fe13c9b 100644 --- libgomp/ChangeLog.gomp +++ libgomp/ChangeLog.gomp @@ -1,5 +1,17 @@ 2017-05-24 Thomas Schwinge <thomas@codesourcery.com> + * openacc.h (acc_async_wait, acc_async_wait_all): New prototypes. + * libgomp.map (OACC_2.0.1): Add these. + * oacc-async.c (acc_async_wait, acc_async_wait_all): New aliases + for "acc_wait", and "acc_wait_all", respectively. + * openacc.f90 (acc_async_wait, acc_async_wait_all): New interfaces + for "acc_wait", and "acc_wait_all", respectively. + * openacc_lib.h (acc_async_wait, acc_async_wait_all): Likewise. + * libgomp.texi (acc_wait, acc_wait_all): Update. + * testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c: Update. + * testsuite/libgomp.oacc-fortran/par-reduction-2-1.f: New file. + * testsuite/libgomp.oacc-fortran/par-reduction-2-2.f: Likewise. + * openacc_lib.h (acc_pcopyin, acc_pcreate): Route to acc_present_or_copyin and acc_present_or_create procedures, respectively. diff --git libgomp/libgomp.map libgomp/libgomp.map index 2461c00..546ac92 100644 --- libgomp/libgomp.map +++ libgomp/libgomp.map @@ -380,6 +380,8 @@ OACC_2.0 { OACC_2.0.1 { global: + acc_async_wait; + acc_async_wait_all; acc_pcopyin; acc_pcreate; } OACC_2.0; diff --git libgomp/libgomp.texi libgomp/libgomp.texi index 1dea1e2..eae2a74 100644 --- libgomp/libgomp.texi +++ libgomp/libgomp.texi @@ -2169,12 +2169,15 @@ specified in @var{arg}. @item @emph{C/C++}: @multitable @columnfractions .20 .80 @item @emph{Prototype}: @tab @code{acc_wait(arg);} +@item @emph{Prototype (OpenACC 1.0 compatibility)}: @tab @code{acc_async_wait(arg);} @end multitable @item @emph{Fortran}: @multitable @columnfractions .20 .80 @item @emph{Interface}: @tab @code{subroutine acc_wait(arg)} @item @tab @code{integer(acc_handle_kind) arg} +@item @emph{Interface (OpenACC 1.0 compatibility)}: @tab @code{subroutine acc_async_wait(arg)} +@item @tab @code{integer(acc_handle_kind) arg} @end multitable @item @emph{Reference}: @@ -2218,11 +2221,13 @@ This function waits for the completion of all asynchronous operations. @item @emph{C/C++}: @multitable @columnfractions .20 .80 @item @emph{Prototype}: @tab @code{acc_wait_all(void);} +@item @emph{Prototype (OpenACC 1.0 compatibility)}: @tab @code{acc_async_wait_all(void);} @end multitable @item @emph{Fortran}: @multitable @columnfractions .20 .80 -@item @emph{Interface}: @tab @code{subroutine acc_wait_async()} +@item @emph{Interface}: @tab @code{subroutine acc_wait_all()} +@item @emph{Interface (OpenACC 1.0 compatibility)}: @tab @code{subroutine acc_async_wait_all()} @end multitable @item @emph{Reference}: diff --git libgomp/oacc-async.c libgomp/oacc-async.c index 7cefa0f..dbad95d 100644 --- libgomp/oacc-async.c +++ libgomp/oacc-async.c @@ -122,6 +122,17 @@ acc_wait (int async) } } +/* acc_async_wait is an OpenACC 1.0 compatibility name for acc_wait. */ +#ifdef HAVE_ATTRIBUTE_ALIAS +strong_alias (acc_wait, acc_async_wait) +#else +void +acc_async_wait (int async) +{ + acc_wait (async); +} +#endif + void acc_wait_async (int async1, int async2) { @@ -174,6 +185,17 @@ acc_wait_all (void) } } +/* acc_async_wait_all is an OpenACC 1.0 compatibility name for acc_wait_all. */ +#ifdef HAVE_ATTRIBUTE_ALIAS +strong_alias (acc_wait_all, acc_async_wait_all) +#else +void +acc_async_wait_all (void) +{ + acc_wait_all (); +} +#endif + void acc_wait_all_async (int async) { diff --git libgomp/openacc.f90 libgomp/openacc.f90 index 25121c0..e02ecc4 100644 --- libgomp/openacc.f90 +++ libgomp/openacc.f90 @@ -798,8 +798,10 @@ module openacc public :: acc_get_num_devices, acc_set_device_type, acc_get_device_type public :: acc_set_device_num, acc_get_device_num, acc_async_test public :: acc_set_default_async, acc_get_default_async - public :: acc_async_test_all, acc_wait, acc_wait_async, acc_wait_all - public :: acc_wait_all_async, acc_init, acc_shutdown, acc_on_device + public :: acc_async_test_all + public :: acc_wait, acc_async_wait, acc_wait_async + public :: acc_wait_all, acc_async_wait_all, acc_wait_all_async + public :: acc_init, acc_shutdown, acc_on_device public :: acc_copyin, acc_present_or_copyin, acc_pcopyin, acc_create public :: acc_present_or_create, acc_pcreate, acc_copyout, acc_delete public :: acc_update_device, acc_update_self, acc_is_present @@ -848,6 +850,11 @@ module openacc procedure :: acc_wait_h end interface + ! acc_async_wait is an OpenACC 1.0 compatibility name for acc_wait. + interface acc_async_wait + procedure :: acc_wait_h + end interface + interface acc_wait_async procedure :: acc_wait_async_h end interface @@ -856,6 +863,11 @@ module openacc procedure :: acc_wait_all_h end interface + ! acc_async_wait_all is an OpenACC 1.0 compatibility name for acc_wait_all. + interface acc_async_wait_all + procedure :: acc_wait_all_h + end interface + interface acc_wait_all_async procedure :: acc_wait_all_async_h end interface diff --git libgomp/openacc.h libgomp/openacc.h index 67d8639..4283cf3 100644 --- libgomp/openacc.h +++ libgomp/openacc.h @@ -78,8 +78,10 @@ int acc_get_default_async (void) __GOACC_NOTHROW; int acc_async_test (int) __GOACC_NOTHROW; int acc_async_test_all (void) __GOACC_NOTHROW; void acc_wait (int) __GOACC_NOTHROW; +void acc_async_wait (int) __GOACC_NOTHROW; void acc_wait_async (int, int) __GOACC_NOTHROW; void acc_wait_all (void) __GOACC_NOTHROW; +void acc_async_wait_all (void) __GOACC_NOTHROW; void acc_wait_all_async (int) __GOACC_NOTHROW; void acc_init (acc_device_t) __GOACC_NOTHROW; void acc_shutdown (acc_device_t) __GOACC_NOTHROW; diff --git libgomp/openacc_lib.h libgomp/openacc_lib.h index 62fbb23..92fd1da 100644 --- libgomp/openacc_lib.h +++ libgomp/openacc_lib.h @@ -121,6 +121,11 @@ end subroutine end interface +! acc_async_wait is an OpenACC 1.0 compatibility name for acc_wait. + interface acc_async_wait + procedure :: acc_wait_h + end interface + interface acc_wait_async subroutine acc_wait_async_h (a1, a2) integer a1, a2 @@ -132,6 +137,12 @@ end subroutine end interface +! acc_async_wait_all is an OpenACC 1.0 compatibility name for +! acc_wait_all. + interface acc_async_wait_all + procedure :: acc_wait_all_h + end interface + interface acc_wait_all_async subroutine acc_wait_all_async_h (a) integer a diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c index 911b76c..5ab52e9 100644 --- libgomp/testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c +++ libgomp/testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c @@ -1,10 +1,11 @@ +/* Test of reduction on parallel directive (with async). */ +/* See also Fortran variants in "../libgomp.oacc-fortran/par-reduction-2*". */ + /* { dg-additional-options "-w" } */ #include <assert.h> #include <openacc.h> -/* Test of reduction on parallel directive (with async). */ - int main (int argc, char *argv[]) { @@ -25,7 +26,7 @@ main (int argc, char *argv[]) } res = GANGS * 5; - acc_wait (1); + acc_async_wait (1); assert (res == res1); assert (res == res2); @@ -49,7 +50,7 @@ main (int argc, char *argv[]) for (int i = 0; i < GANGS; ++i) res *= 5; - acc_wait (1); + acc_async_wait_all (); assert (res == res1); assert (res == res2); diff --git libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-1.f libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-1.f new file mode 100644 index 0000000..7b85e47 --- /dev/null +++ libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-1.f @@ -0,0 +1,57 @@ +! Test of reduction on parallel directive (with async). +! Variant of "../libgomp.oacc-c-c++-common/par-reduction-2.c". +! Variant using "openacc_lib.h". + +! { dg-do run } + + PROGRAM MAIN + IMPLICIT NONE + INCLUDE "openacc_lib.h" + + INTEGER RES, RES1, RES2 + + RES1 = 0 + RES2 = 0 + +!$ACC PARALLEL NUM_GANGS(256) NUM_WORKERS(32) VECTOR_LENGTH(32) +!$ACC& REDUCTION(+:RES1) COPY(RES1, RES2) ASYNC(1) ! { dg-warning "region is (gang|worker|vector) partitioned" } + res1 = res1 + 5 + +!$ACC ATOMIC + res2 = res2 + 5 +!$ACC END PARALLEL + + IF (ACC_GET_DEVICE_TYPE () .EQ. ACC_DEVICE_HOST) THEN + RES = 1 * 5 + ELSE + RES = 256 * 5 + END IF + + CALL ACC_ASYNC_WAIT (1) + + IF (RES .NE. RES1) CALL ABORT + IF (RES .NE. RES2) CALL ABORT + + RES1 = 1 + RES2 = 1 + +!$ACC PARALLEL NUM_GANGS(8) NUM_WORKERS(32) VECTOR_LENGTH(32) +!$ACC& REDUCTION(*:RES1) COPY(RES1, RES2) ASYNC(1) ! { dg-warning "region is (gang|worker|vector) partitioned" } + res1 = res1 * 5 + +!$ACC ATOMIC + res2 = res2 * 5 +!$ACC END PARALLEL + + IF (ACC_GET_DEVICE_TYPE () .EQ. ACC_DEVICE_HOST) THEN + RES = 5 ** 1 + ELSE + RES = 5 ** 8 + END IF + + CALL ACC_ASYNC_WAIT_ALL + + IF (RES .NE. RES1) CALL ABORT + IF (RES .NE. RES2) CALL ABORT + + END PROGRAM diff --git libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-2.f libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-2.f new file mode 100644 index 0000000..8850f7b --- /dev/null +++ libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-2.f @@ -0,0 +1,57 @@ +! Test of reduction on parallel directive (with async). +! Variant of "../libgomp.oacc-c-c++-common/par-reduction-2.c". +! Variant using the "openacc" module. + +! { dg-do run } + + PROGRAM MAIN + USE OPENACC + IMPLICIT NONE + + INTEGER RES, RES1, RES2 + + RES1 = 0 + RES2 = 0 + +!$ACC PARALLEL NUM_GANGS(256) NUM_WORKERS(32) VECTOR_LENGTH(32) +!$ACC& REDUCTION(+:RES1) COPY(RES1, RES2) ASYNC(1) ! { dg-warning "region is (gang|worker|vector) partitioned" } + res1 = res1 + 5 + +!$ACC ATOMIC + res2 = res2 + 5 +!$ACC END PARALLEL + + IF (ACC_GET_DEVICE_TYPE () .EQ. ACC_DEVICE_HOST) THEN + RES = 1 * 5 + ELSE + RES = 256 * 5 + END IF + + CALL ACC_ASYNC_WAIT (1) + + IF (RES .NE. RES1) CALL ABORT + IF (RES .NE. RES2) CALL ABORT + + RES1 = 1 + RES2 = 1 + +!$ACC PARALLEL NUM_GANGS(8) NUM_WORKERS(32) VECTOR_LENGTH(32) +!$ACC& REDUCTION(*:RES1) COPY(RES1, RES2) ASYNC(1) ! { dg-warning "region is (gang|worker|vector) partitioned" } + res1 = res1 * 5 + +!$ACC ATOMIC + res2 = res2 * 5 +!$ACC END PARALLEL + + IF (ACC_GET_DEVICE_TYPE () .EQ. ACC_DEVICE_HOST) THEN + RES = 5 ** 1 + ELSE + RES = 5 ** 8 + END IF + + CALL ACC_ASYNC_WAIT_ALL + + IF (RES .NE. RES1) CALL ABORT + IF (RES .NE. RES2) CALL ABORT + + END PROGRAM Grüße Thomas ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-05-24 13:48 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <87r3ygyz9t.fsf@schwinge.name> 2017-05-22 17:45 ` OpenACC 1.0 compatibility: acc_async_wait, acc_async_wait_all Thomas Schwinge 2017-05-23 11:28 ` Jakub Jelinek 2017-05-24 11:54 ` Thomas Schwinge 2017-05-24 11:58 ` Jakub Jelinek 2017-05-24 13:48 ` Thomas Schwinge
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).