cudaCreateChannelDesc fails for long type


It appears that cudaCreateChannelDesc returns {0, 0, 0, 0, cudaChannelKindFormatNone} for long types
For example:

  1 #include <cuda_runtime.h>
  2 #include <stdio.h>
  4 int main() {
  5     cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc<long>();
  7     printf("x: %d\n", channelDesc.x);
  8     printf("y: %d\n", channelDesc.y);
  9     printf("z: %d\n", channelDesc.z);
 10     printf("w: %d\n", channelDesc.w);
 11     printf("f: %d\n", channelDesc.f);
 13     return 0;
 14 }

Looking at channel_descriptor.h the template specialization for long types are enclosed in
#if !defined(LP64). Could someone please explain what may be the reason of not computing a descriptor for LP64?

LP64 means that long and pointers are 64-bit types. That is typical for Linux environments, whereas in Windows, long is a 32-bit type as it uses the LLP64 convention: long long and pointers are 64-bit types. As far as I know, there is no support for 64-bit channels in the hardware; 32 bit is the maximum size.

Because long is specified differently in different host environments, and CUDA uses the host environment’s specification for seamless host/device code interaction, I would strongly advise against the use of long anywhere in CUDA software.