3

The cudaMalloc() documentation says

The allocated memory is suitably aligned for any kind of variable.

But...

  • What affects the actual aligment? Compute capability? CUDA driver version? The specific kind of card? The allocation size?
  • Can I determine the minimum / typical allocation alignment as a function of these parameters?
einpoklum
  • 118,144
  • 57
  • 340
  • 684

1 Answers1

1

You can un-safely assume it's at least cudaDeviceProp::textureAlignment
(i.e. 256 on Fermi, 512 on Kepler, Maxwell).

@sgarizvi reports that, from his experimentation on multiple devices, that the alignment of allocated blocks of device memory is no less than the texture alignment field of the device properties ( cudaDeviceProp::textureAlignment). For Kepler and Maxwell devices this is 512 bytes.

Of course, like @talonmies notes, this is not actually guaranteed nor is it documented.

einpoklum
  • 118,144
  • 57
  • 340
  • 684