title: How to define constant arrays of dim3 structs in CUDA
body: <p>I am writing some CUDA code to run on the device. The code will use two lookup tables of constant values. The first of these is an array of 256 unsigned ints and I declare it as :</p>
  
  <pre><code>__constant__ 
  uint16_t edgeTable[256]={
     0x000,
     0x019,
     ... etc.
  };
  </code></pre>
  
  <p>And this seems to compile fine.</p>
  
  <p>The second is a fixed size array of dim3 and I tried this:</p>
  
  <pre><code>__constant__
  dim3 offsets[8] = {
      {0, 0, 0}, {0, 0, 1}, {0, 1, 0},
      ... etc 
  };
  </code></pre>
  
  <p>Which the compiler objects to. with the error message:</p>
  
  <pre><code>error: dynamic initialization is not supported for __device__, __constant__ and __shared__ variables.
  </code></pre>
  
  <p>Perhaps I misunderstand dynamic initialisation but it seems to me that this is static initialisation, the compiler can work out the sizes of everything and all values are provided. </p>
  
  <p>What am I missing here ?</p>
  
  <p>How can I achieve what I'm trying to do ?</p>
  
  <p>Thanks</p>
  
  <p>I'm using CUDA7.5 toolkit on Ubuntu 14.04 with gcc 4.8.4</p>