title: Multi-dimensional array copy OpenACC
body: <p>I have a 2D matrix SIZE x SIZE, which I'm trying to copy to the GPU. </p>
  
  <p>I allocate the matrix this way: </p>
  
  <pre><code>#define SIZE 1024
  float (*a)(SIZE) = (float(*)[SIZE]) malloc(SIZE * SIZE * sizeof(float));
  </code></pre>
  
  <p>And I have this on my ACC region: </p>
  
  <pre><code>void mmul_acc(restrict float a[][SIZE],
                restrict float b[][SIZE],
                restrict float c[][SIZE]) {
  #pragma acc data copyin(a[0:SIZE][0:SIZE], b[0:SIZE][0:SIZE]) \
      copyout c[0:SIZE][0:SIZE])
  {
    ... code here...
  }
  </code></pre>
  
  <p>When compiling with the PGI compiler, using -Minfo=acc, the compiler tells me: </p>
  
  <pre><code>Generating copyin(a[0:1024][0:])
  </code></pre>
  
  <p>What does a[0:1024][0:] mean? Why not a[0:1024][0:1024] ???</p>
  
  <p>If instead of declaring matrices I declare arrays with size SIZE*SIZE, doing</p>
  
  <pre><code>#pragma acc copyin(a[0:SIZE*SIZE])
  </code></pre>
  
  <p>Generates the following compiler message</p>
  
  <pre><code>Generating copyin(a[0:16777216])
  </code></pre>
  
  <p>The code actually works the same way, same performance, same result.</p>
  
  <p>Apparently in both ways the compiler generates the same code, as it should be, but the message is not straightforward.</p>
  
  <p>I'm using the PGI accelerator 12.8, in a Linux64 machine. I'm compiling with -Minfo=acc</p>
  
  <p>Note: this question was edited and now it doesn't really make much sense, but maybe it can useful to more people.</p>