gcc/libgomp/testsuite/libgomp.oacc-fortran/par-reduction-2-2.f
Thomas Schwinge 7ce6440371 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.

From-SVN: r248413
2017-05-24 15:25:01 +02:00

58 lines
1.2 KiB
Fortran

! 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