title: cudaMalloc3D - Simple Example
body: <p>I'm just trying to compile a very easy example from the Nvidia Programming Guide which shows how to use cudaMalloc3D to allocate 3D data on the device.</p>
  
  <p>This is the code I'm using, which gets compiled without any errors. Also <code>cuda-memcheck</code> runs without errors. I'm using a graphics card with CC 3.0.</p>
  
  <p>This is the code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdio.h&gt;
  
  typedef float PixelType;
  
  __global__ void extract_patches_from_image_data(cudaPitchedPtr devicePitchedPointer,     dim3 image_dimensions)
  {
      // Test
      printf("HELLO - PLEASE PRINT THIS\n");
  
      // Check image dimensions
      printf("Current x: %d\n", image_dimensions.x);
      printf("Current y: %d\n", image_dimensions.y);
      printf("Current z: %d\n", image_dimensions.z);
  
      // Get attributes from device pitched pointer
      char     *devicePointer  =   (char *)devicePitchedPointer.ptr;
      size_t    pitch          =   devicePitchedPointer.pitch;
      size_t    slicePitch     =   pitch * image_dimensions.y;
  
      // Loop over image data
      for(int z = 0; z &lt; image_dimensions.z; ++z)
      {
           char *current_slice = devicePointer + z * slicePitch;
  
  
          for(int y = 0; y &lt; image_dimensions.y; ++y)
          {
              PixelType *current_row = (PixelType *)(current_slice + y * pitch);
  
              for(int x = 0; x &lt; image_dimensions.x; ++x)
              {
                  PixelType current_element = current_row[x];
  
                  printf("Current element: %d\n", current_element);
              }
          }
      }
  }
  
  int main(void)
  {
      // Set up test data
      PixelType image_data[3][3][3] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26};
      dim3  image_dimensions = dim3(32, 32, 32);
  
      // Allocate 3D memory on the device
      cudaExtent volumeSizeBytes = make_cudaExtent(sizeof(PixelType) * image_dimensions.x, image_dimensions.y, image_dimensions.z);
      cudaPitchedPtr devicePitchedPointer;
      cudaMalloc3D(&amp;devicePitchedPointer, volumeSizeBytes);
  
      // Kernel Launch Configuration
      dim3 threads_per_block = dim3(32, 32, 1);
      dim3 blocks_per_grid = dim3(32, 1, 1);
      extract_patches_from_image_data&lt;&lt;&lt;blocks_per_grid, threads_per_block&gt;&gt;&gt;(devicePitchedPointer, image_dimensions);
  }
  </code></pre>
  
  <p>My question now is: Why is there no output written to the console? It appears that the kernel is never called, but I cannot figure out why.
  I tried using Eclipse Nsight, and also writing my own makefile which looks like this: </p>
  
  <pre><code>main: main.cu Makefile
  nvcc -arch=sm_20 -o main main.cu --ptxas-options=-v --use_fast_math --compiler-options -Wall 
  </code></pre>