19 if (acc_get_current_cuda_context () != NULL
)
22 if (acc_is_present (x
, N
) != 1)
29 for (i
= 0; i
< N
; i
++)
37 d_x
= acc_copyin (x
, N
);
43 main (int argc
, char **argv
)
45 const int nthreads
= 1;
50 if (acc_get_num_devices (acc_device_nvidia
) == 0)
53 acc_init (acc_device_nvidia
);
55 x
= (unsigned char *) malloc (N
);
57 for (i
= 0; i
< N
; i
++)
62 d_x
= acc_copyin (x
, N
);
64 if (acc_is_present (x
, N
) != 1)
67 if (pthread_attr_init (&attr
) != 0)
68 perror ("pthread_attr_init failed");
70 tid
= (pthread_t
*) malloc (nthreads
* sizeof (pthread_t
));
72 for (i
= 0; i
< nthreads
; i
++)
74 if (pthread_create (&tid
[i
], &attr
, &test
, (void *) (unsigned long) (i
))
76 perror ("pthread_create failed");
79 if (pthread_attr_destroy (&attr
) != 0)
80 perror ("pthread_attr_destroy failed");
82 for (i
= 0; i
< nthreads
; i
++)
86 if (pthread_join (tid
[i
], &res
) != 0)
87 perror ("pthread join failed");
90 if (acc_is_present (x
, N
) != 1)
97 for (i
= 0; i
< N
; i
++)
99 if (x
[i
] != N
- i
- 1)
103 if (acc_is_present (x
, N
) != 0)
106 acc_shutdown (acc_device_nvidia
);
111 /* { dg-output "" } */