acc_on_device-1-3.f 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. ! { dg-additional-options "-cpp" }
  2. ! TODO: Have to disable the acc_on_device builtin for we want to test
  3. ! the libgomp library function? The command line option
  4. ! '-fno-builtin-acc_on_device' is valid for C/C++/ObjC/ObjC++ but not
  5. ! for Fortran.
  6. IMPLICIT NONE
  7. INCLUDE "openacc_lib.h"
  8. !Host.
  9. IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NONE)) CALL ABORT
  10. IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST)) CALL ABORT
  11. IF (ACC_ON_DEVICE (ACC_DEVICE_HOST_NONSHM)) CALL ABORT
  12. IF (ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) CALL ABORT
  13. IF (ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) CALL ABORT
  14. !Host via offloading fallback mode.
  15. !$ACC PARALLEL IF(.FALSE.)
  16. IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NONE)) CALL ABORT
  17. IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST)) CALL ABORT
  18. IF (ACC_ON_DEVICE (ACC_DEVICE_HOST_NONSHM)) CALL ABORT
  19. IF (ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) CALL ABORT
  20. IF (ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) CALL ABORT
  21. !$ACC END PARALLEL
  22. #if !ACC_DEVICE_TYPE_host
  23. ! Offloaded.
  24. !$ACC PARALLEL
  25. IF (ACC_ON_DEVICE (ACC_DEVICE_NONE)) CALL ABORT
  26. IF (ACC_ON_DEVICE (ACC_DEVICE_HOST)) CALL ABORT
  27. #if ACC_DEVICE_TYPE_host_nonshm
  28. IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST_NONSHM)) CALL ABORT
  29. #else
  30. IF (ACC_ON_DEVICE (ACC_DEVICE_HOST_NONSHM)) CALL ABORT
  31. #endif
  32. IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) CALL ABORT
  33. #if ACC_DEVICE_TYPE_nvidia
  34. IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) CALL ABORT
  35. #else
  36. IF (ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) CALL ABORT
  37. #endif
  38. !$ACC END PARALLEL
  39. #endif
  40. END