CudaResourceDesc Members

The description of CudaResourceDesc given in the Runtime API reference (http://docs.nvidia.com/cuda/cuda-runtime-api/structcudaResourceDesc.html#structcudaResourceDesc) is clearly incorrect. The programming guide gives correct usage, but does not provide a complete list of members, leaving one to find the definition in the CUDA headers to find the correct usage. Based on the list of members given in the Runtime API reference, I attempted to create a surface object using the following code:

cudaResourceDesc desc;
	memset(&desc, 0, sizeof(desc));
	desc.resType = cudaResourceTypeArray;
	desc.array = d_texOut;
	check(cudaArrayGetInfo(&(desc.desc), &size, nullptr, d_texOut));
	desc.height = size.height;
	desc.width = size.width;

	check(cudaCreateSurfaceObject(&m_surfObj, &desc));

This produces the following errors:

simulator-dyn.cu(340): error: class "cudaResourceDesc" has no member "array"

simulator-dyn.cu(341): error: class "cudaResourceDesc" has no member "desc"

simulator-dyn.cu(342): error: class "cudaResourceDesc" has no member "height"

simulator-dyn.cu(343): error: class "cudaResourceDesc" has no member "width"

This should be corrected in the documentation.

1 Like