Drop Z from X + Z < Y + Z
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / lib-85.c
blobcf925a7b002e6655f64596bf8fc57f740ca0c95f
1 /* { dg-do run { target openacc_nvidia_accel_selected } } */
2 /* { dg-additional-options "-lcuda" } */
4 #include <stdlib.h>
5 #include <unistd.h>
6 #include <openacc.h>
7 #include <stdio.h>
8 #include <cuda.h>
10 int
11 main (int argc, char **argv)
13 const int N = 100;
14 int i;
15 CUstream *streams;
16 CUstream s;
17 CUresult r;
19 acc_init (acc_device_nvidia);
21 (void) acc_get_device_num (acc_device_nvidia);
23 streams = (CUstream *) malloc (N * sizeof (void *));
25 for (i = 0; i < N; i++)
27 streams[i] = (CUstream) acc_get_cuda_stream (i);
28 if (streams[i] != NULL)
29 abort ();
31 r = cuStreamCreate (&streams[i], CU_STREAM_DEFAULT);
32 if (r != CUDA_SUCCESS)
34 fprintf (stderr, "cuStreamCreate failed: %d\n", r);
35 abort ();
38 if (!acc_set_cuda_stream (i, streams[i]))
39 abort ();
42 s = NULL;
44 if (acc_set_cuda_stream (N + 1, s) != 0)
45 abort ();
47 acc_shutdown (acc_device_nvidia);
49 exit (0);
52 /* { dg-output "" } */