1 /* { dg-do run { target openacc_nvidia_accel_selected } } */
2 /* { dg-additional-options "-lcuda" } */
3 /* { dg-require-effective-target openacc_cuda } */
11 #if !defined __cplusplus
13 # define static_assert _Static_assert
16 static_assert (acc_async_sync
== -2, "acc_async_sync?");
17 static_assert (acc_async_noval
== -1, "acc_async_noval?");
20 main (int argc
, char **argv
)
28 acc_init (acc_device_nvidia
);
30 (void) acc_get_device_num (acc_device_nvidia
);
32 streams
= (CUstream
*) malloc ((2 + N
) * sizeof (void *));
34 /* "streams[i]" is valid for i in [acc_async_sync..N). */
36 for (i
= acc_async_sync
; i
< N
; i
++)
38 streams
[i
] = (CUstream
) acc_get_cuda_stream (i
);
39 if (streams
[i
] != NULL
)
42 r
= cuStreamCreate (&streams
[i
], CU_STREAM_DEFAULT
);
43 if (r
!= CUDA_SUCCESS
)
45 fprintf (stderr
, "cuStreamCreate failed: %d\n", r
);
49 int ret
= acc_set_cuda_stream (i
, streams
[i
]);
50 if (i
== acc_async_sync
)
64 if (acc_set_cuda_stream (N
+ 1, s
) != 0)
67 acc_shutdown (acc_device_nvidia
);
72 /* { dg-output "" } */