(root)/
gcc-13.2.0/
libgomp/
testsuite/
libgomp.oacc-c-c++-common/
mapping-1.c
       1  /* { dg-do run } */
       2  
       3  #include <stdio.h>
       4  #include <stdlib.h>
       5  #include <unistd.h>
       6  
       7  /* Exercise the kernel launch argument mapping.  */
       8  
       9  int
      10  main (int argc, char **argv)
      11  {
      12    int a[256], b[256], c[256], d[256], e[256], f[256];
      13    int i;
      14    int n;
      15  
      16    /* 48 is the size of the mappings for the first parallel construct.  */
      17    n = sysconf (_SC_PAGESIZE) / 48 - 1;
      18  
      19    i = 0;
      20  
      21    for (i = 0; i < n; i++)
      22      {
      23        #pragma acc parallel copy (a, b, c, d)
      24  	{
      25  	  int j;
      26  
      27  	  for (j = 0; j < 256; j++)
      28  	    {
      29  	      a[j] = j;
      30  	      b[j] = j;
      31  	      c[j] = j;
      32  	      d[j] = j;
      33  	    }
      34  	}
      35      }
      36  
      37  #pragma acc parallel copy (a, b, c, d, e, f)
      38    {
      39      int j;
      40  
      41      for (j = 0; j < 256; j++)
      42        {
      43  	a[j] = j;
      44  	b[j] = j;
      45  	c[j] = j;
      46  	d[j] = j;
      47  	e[j] = j;
      48  	f[j] = j;
      49        }
      50    }
      51  
      52    for (i = 0; i < 256; i++)
      53     {
      54       if (a[i] != i) abort();
      55       if (b[i] != i) abort();
      56       if (c[i] != i) abort();
      57       if (d[i] != i) abort();
      58       if (e[i] != i) abort();
      59       if (f[i] != i) abort();
      60     }
      61  
      62    exit (0);
      63  }