Hello,
I’m fighting with CUDA Driver API to create an image. I’m trying to use the following code:
int width = 1024;
int height = 512;
CUDA_TEXTURE_DESC texDesc;
memset(&texDesc, 0, sizeof(texDesc));
// Basic propertise of the texture
texDesc.addressMode[0] = CU_TR_ADDRESS_MODE_CLAMP;
texDesc.addressMode[1] = CU_TR_ADDRESS_MODE_CLAMP;
texDesc.addressMode[2] = CU_TR_ADDRESS_MODE_CLAMP;
texDesc.filterMode = CU_TR_FILTER_MODE_LINEAR;
//texDesc.flags = CU_TRSF_NORMALIZED_COORDINATES;
CUDA_RESOURCE_DESC m_format;
memset(&m_format, 0, sizeof(CUDA_RESOURCE_DESC));
m_format.resType = CU_RESOURCE_TYPE_ARRAY;
m_format.flags = 0;
CUDA_ARRAY_DESCRIPTOR desc;
desc.Width = width;
desc.Height = height;
desc.Format = CU_AD_FORMAT_UNSIGNED_INT8;
desc.NumChannels = 1;
element_size = sizeof(unsigned char);
err = cuArrayCreate(&m_format.res.array.hArray, &desc);
err = cuTexObjectCreate(&(image->tex), &m_format, &texDesc, NULL);
err = cuSurfObjectCreate(&image->surf, &m_format);
But the cuTexObjectCreate return with 999 CUDA_ERROR_UNKNOWN and I have no clue why.
I’m on Ubuntu 14.04, having a Quadro 2000M GPU, using CUDA 6.5. Other CUDA commands such as kernel executions, and buffer creation works fine.
Any help is highly appreciated !
Thanks,
Gergely