Dearl all.
I came acrosss the connections betewen cudaMallocArray and cuArrayCreate.
As arguments, there are
struct cudaChannelFormatDesc {
int x, y, z, w;
enum cudaChannelFormatKind f;
};
in cudaMallocArray, and
typedef struct
{
// dimensions
unsigned int Width;
unsigned int Height;
// format
CUarray_format Format;
// channels per array element
unsigned int NumChannels;
} CUDA_ARRAY_DESCRIPTOR;, with
// array formats
//
typedef enum CUarray_format_enum {
CU_AD_FORMAT_UNSIGNED_INT8 = 0x01,
CU_AD_FORMAT_UNSIGNED_INT16 = 0x02,
CU_AD_FORMAT_UNSIGNED_INT32 = 0x03,
CU_AD_FORMAT_SIGNED_INT8 = 0x08,
CU_AD_FORMAT_SIGNED_INT16 = 0x09,
CU_AD_FORMAT_SIGNED_INT32 = 0x0a,
CU_AD_FORMAT_HALF = 0x10,
CU_AD_FORMAT_FLOAT = 0x20
} CUarray_format;
First I would like make sure the CUDA_ARRAY_DESCRIPTOR is corresponding to cudaChannelFormatDesc in runtime API.
Thus for given Runtime API:
cudaMallocArray ( array, desc, width, height),
the following drvier API do the same thing.
struct CUDA_ARRAY_DESCRIPTOR cu_desc;
and
cuArrayCreate(pHandle, cu_desc).
At this time how the field x, y, z, w of cudaChannelFormatDesc are used in making cu_desc?
And I would like to ask the following correspondences are right.
Runtime API --------- Driver API
cudaChannelFormatKindSigned ------ CU_AD_FORMAT_SIGNED_XXX
cudaChannelFormatKindUnsigned ------ CU_AD_FORMAT_UNSIGNED_XXX
cudaChannelFormatKindFloat ------ CU_AD_FORMAT_FLOAT
Thanks for reading and replying in advance.
S.