Set num_threads to 50 on 32-bit hppa in two libgomp loop tests
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / lib-83.c
blob44ef1dbdc1760b82aad0b3288f2107c15aa37346
1 /* { dg-do run { target openacc_nvidia_accel_selected } } */
2 /* { dg-additional-options "-lcuda" } */
3 /* { dg-require-effective-target openacc_cuda } */
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <unistd.h>
8 #include <openacc.h>
9 #include <cuda.h>
10 #include <sys/time.h>
12 int
13 main (int argc, char **argv)
15 CUstream stream;
16 CUresult r;
17 struct timeval tv1, tv2;
18 time_t t1;
20 acc_init (acc_device_nvidia);
22 stream = (CUstream) acc_get_cuda_stream (0);
23 if (stream != NULL)
24 abort ();
26 r = cuStreamCreate (&stream, CU_STREAM_DEFAULT);
27 if (r != CUDA_SUCCESS)
29 fprintf (stderr, "cuStreamCreate failed: %d\n", r);
30 abort ();
33 if (!acc_set_cuda_stream (0, stream))
34 abort ();
36 gettimeofday (&tv1, NULL);
38 acc_wait_all_async (0);
40 acc_wait (0);
42 gettimeofday (&tv2, NULL);
44 t1 = ((tv2.tv_sec - tv1.tv_sec) * 1000000) + (tv2.tv_usec - tv1.tv_usec);
46 if (t1 > 1000)
48 fprintf (stderr, "too long\n");
49 abort ();
52 acc_shutdown (acc_device_nvidia);
54 exit (0);
57 /* { dg-output "" } */