summaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f
blob: c3917760682eba478c69df0af4215afcd9d3b5cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
! { dg-additional-options "-cpp" }
! TODO: Have to disable the acc_on_device builtin for we want to test
! the libgomp library function?  The command line option
! '-fno-builtin-acc_on_device' is valid for C/C++/ObjC/ObjC++ but not
! for Fortran.

      IMPLICIT NONE
      INCLUDE "openacc_lib.h"

!Host.

      IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NONE)) CALL ABORT
      IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST)) CALL ABORT
      IF (ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) CALL ABORT
      IF (ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) CALL ABORT


!Host via offloading fallback mode.

!$ACC PARALLEL IF(.FALSE.)
      IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NONE)) CALL ABORT
      IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST)) CALL ABORT
      IF (ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) CALL ABORT
      IF (ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) CALL ABORT
!$ACC END PARALLEL


#if !ACC_DEVICE_TYPE_host

! Offloaded.

!$ACC PARALLEL
      IF (ACC_ON_DEVICE (ACC_DEVICE_NONE)) CALL ABORT
      IF (ACC_ON_DEVICE (ACC_DEVICE_HOST)) CALL ABORT
      IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) CALL ABORT
#if ACC_DEVICE_TYPE_nvidia
      IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) CALL ABORT
#else
      IF (ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) CALL ABORT
#endif
!$ACC END PARALLEL

#endif

      END