1/* Disable the acc_on_device builtin; we want to test the libgomp library 2 function. */ 3/* { dg-additional-options "-fno-builtin-acc_on_device" } */ 4 5#include <stdlib.h> 6#include <openacc.h> 7 8int 9main (int argc, char *argv[]) 10{ 11 /* Host. */ 12 13 { 14 if (!acc_on_device (acc_device_none)) 15 abort (); 16 if (!acc_on_device (acc_device_host)) 17 abort (); 18 if (acc_on_device (acc_device_host_nonshm)) 19 abort (); 20 if (acc_on_device (acc_device_not_host)) 21 abort (); 22 if (acc_on_device (acc_device_nvidia)) 23 abort (); 24 } 25 26 27 /* Host via offloading fallback mode. */ 28 29#pragma acc parallel if(0) 30 { 31 if (!acc_on_device (acc_device_none)) 32 abort (); 33 if (!acc_on_device (acc_device_host)) 34 abort (); 35 if (acc_on_device (acc_device_host_nonshm)) 36 abort (); 37 if (acc_on_device (acc_device_not_host)) 38 abort (); 39 if (acc_on_device (acc_device_nvidia)) 40 abort (); 41 } 42 43 44#if !ACC_DEVICE_TYPE_host 45 46 /* Offloaded. */ 47 48#pragma acc parallel 49 { 50 if (acc_on_device (acc_device_none)) 51 abort (); 52 if (acc_on_device (acc_device_host)) 53 abort (); 54#if ACC_DEVICE_TYPE_host_nonshm 55 if (!acc_on_device (acc_device_host_nonshm)) 56 abort (); 57#else 58 if (acc_on_device (acc_device_host_nonshm)) 59 abort (); 60#endif 61 if (!acc_on_device (acc_device_not_host)) 62 abort (); 63#if ACC_DEVICE_TYPE_nvidia 64 if (!acc_on_device (acc_device_nvidia)) 65 abort (); 66#else 67 if (acc_on_device (acc_device_nvidia)) 68 abort (); 69#endif 70 } 71 72#endif 73 74 return 0; 75} 76