xref: /openbsd-src/gnu/gcc/libgomp/testsuite/libgomp.c/appendix-a/a.36.1.c (revision 404b540a9034ac75a6199ad1a32d1bbc7a0d4210)
1*404b540aSrobert /* { dg-do run } */
2*404b540aSrobert 
3*404b540aSrobert #include <omp.h>
4*404b540aSrobert #include <stdlib.h>
5*404b540aSrobert void
do_by_16(float * x,int iam,int ipoints)6*404b540aSrobert do_by_16 (float *x, int iam, int ipoints)
7*404b540aSrobert {
8*404b540aSrobert }
9*404b540aSrobert 
10*404b540aSrobert void
a36(float * x,int npoints)11*404b540aSrobert a36 (float *x, int npoints)
12*404b540aSrobert {
13*404b540aSrobert   int iam, ipoints;
14*404b540aSrobert   omp_set_dynamic (0);
15*404b540aSrobert   omp_set_num_threads (16);
16*404b540aSrobert #pragma omp parallel shared(x, npoints) private(iam, ipoints)
17*404b540aSrobert   {
18*404b540aSrobert     if (omp_get_num_threads () != 16)
19*404b540aSrobert       abort ();
20*404b540aSrobert     iam = omp_get_thread_num ();
21*404b540aSrobert     ipoints = npoints / 16;
22*404b540aSrobert     do_by_16 (x, iam, ipoints);
23*404b540aSrobert   }
24*404b540aSrobert }
25*404b540aSrobert 
main()26*404b540aSrobert int main()
27*404b540aSrobert {
28*404b540aSrobert   float a[10];
29*404b540aSrobert   a36 (a, 10);
30*404b540aSrobert   return 0;
31*404b540aSrobert }
32