1 /* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
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 acc_init (acc_device_default
);
52 x
= (unsigned char *) malloc (N
);
54 for (i
= 0; i
< N
; i
++)
59 d_x
= acc_copyin (x
, N
);
61 if (acc_is_present (x
, N
) != 1)
64 if (pthread_attr_init (&attr
) != 0)
65 perror ("pthread_attr_init failed");
67 tid
= (pthread_t
*) malloc (nthreads
* sizeof (pthread_t
));
69 for (i
= 0; i
< nthreads
; i
++)
71 if (pthread_create (&tid
[i
], &attr
, &test
, (void *) (unsigned long) (i
))
73 perror ("pthread_create failed");
76 if (pthread_attr_destroy (&attr
) != 0)
77 perror ("pthread_attr_destroy failed");
79 for (i
= 0; i
< nthreads
; i
++)
83 if (pthread_join (tid
[i
], &res
) != 0)
84 perror ("pthread join failed");
87 if (acc_is_present (x
, N
) != 1)
94 for (i
= 0; i
< N
; i
++)
96 if (x
[i
] != N
- i
- 1)
100 if (acc_is_present (x
, N
) != 0)
106 /* { dg-output "" } */