作者:gaoyong0713 | 来源:互联网 | 2023-01-29 19:45
cudaCreateChannelDesc(int x,int y,int z,int w,枚举cudaChannelFormatKind f);
现在我有一个示例代码:cudaCreateChannelDesc(32,0,0,0,cudaChannelFormatKindFloat);
我不知道为什么x = 32,y = z = w = 0。有人可以帮助我吗?
1> Jonathan Ols..:
该功能有一个单独的C和C ++ API(C ++ API重载)。
对于C API函数,这些是每个通道的位数。这些可以是颜色通道或空间尺寸,也可以是您想要使用它们的任何东西。您复制的示例仅使用标量值。32位适用于float数据类型。
__host__ ?cudaChannelFormatDesc cudaCreateChannelDesc ( int x, int y, int z, int w, cudaChannelFormatKind f )
From the cuda docs, "Returns a channel descriptor with format f and number of bits of each component x, y, z, and w."
The C++ API is overloaded and looks like this...
If you are compiling on windows with visual studio or g++ for a .cu file you should use this form. For c files, use the above.
__inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void)
__inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void)
__inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void)
etc.