title: Why is cudaMalloc giving me an error when I know there is sufficient memory space?
body: <p>I have a Tesla C2070 that is supposed to have 5636554752 bytes of memory.</p>
  
  <p>However, this gives me an error:</p>
  
  <pre><code>int *buf_d = NULL;
  
  err = cudaMalloc((void **)&amp;buf_d, 1000000000*sizeof(int));
  
  if( err != cudaSuccess)
  {
       printf("CUDA error: %s\n", cudaGetErrorString(err));
       return EXIT_ERROR;
  }
  </code></pre>
  
  <p>How is this possible? Does this have something to do with the maximum memory pitch? Here are the GPU's specs:</p>
  
  <pre><code>Device 0: "Tesla C2070" 
  CUDA Driver Version:    3.20 
  CUDA Runtime Version:   3.20 
  CUDA Capability Major/Minor version number: 2.0 
  Total amount of global memory:  5636554752 bytes 
  Multiprocessors x Cores/MP = Cores: 14 (MP) x 32 (Cores/MP) = 448 (Cores) 
  Total amount of constant memory:    65536 bytes Total amount of shared memory per block:    49152 bytes Total number of registers available per block: 32768 Warp size: 32 
  Maximum number of threads per block:    1024 
  Maximum sizes of each dimension of a block: 1024 x 1024 x 64 
  Maximum sizes of each dimension of a grid:  65535 x 65535 x 1
  Maximum memory pitch: 2147483647 bytes
  </code></pre>
  
  <p>As for the machine I'm running on, it has 24 Intel® Xeon® Processor X565, with the Linux distribution Rocks 5.4 (Maverick).</p>
  
  <p>Any ideas? Thanks!</p>