Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/160.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ cudaTextureObject_t texFetch1D不';不编译_C++_Cuda_Textures - Fatal编程技术网

C++ cudaTextureObject_t texFetch1D不';不编译

C++ cudaTextureObject_t texFetch1D不';不编译,c++,cuda,textures,C++,Cuda,Textures,此代码不会在visual studio 2013中计算能力设置为5.2的gtx 980上的cuda toolkit 7.5中编译 __global__ void a_kernel(cudaTextureObject_t texObj) { int thread_id = blockIdx.x * blockDim.x + threadIdx.x; int something = tex1Dfetch(texObj, thread_id); } 这里是错误 error : mor

此代码不会在visual studio 2013中计算能力设置为5.2的gtx 980上的cuda toolkit 7.5中编译

__global__ void a_kernel(cudaTextureObject_t texObj)
{
    int thread_id = blockIdx.x * blockDim.x + threadIdx.x;
    int something = tex1Dfetch(texObj, thread_id);
}
这里是错误

error : more than one instance of overloaded function "tex1Dfetch" matches the argument list:
这段代码也不会编译

__global__ void another_kernel(cudaTextureObject_t texObj)
{
    int thread_id = blockIdx.x * blockDim.x + threadIdx.x;
    float something = tex1Dfetch<float>(texObj, thread_id);
}
根据此示例和注释,以上所有操作都应有效:


如果您需要其他信息,请告诉我,我想不出还能提供什么。

由于缺少模板类型参数,您的第一个内核无法编译。这将汇编:

__global__ void a_kernel(cudaTextureObject_t texObj)
{
    int thread_id = blockIdx.x * blockDim.x + threadIdx.x;
    int something = tex1Dfetch<int>(texObj, thread_id);
}
\uuuuu全局\uuuuuu无效内核(cudaTextureObject\u t texObj)
{
int thread_id=blockIdx.x*blockDim.x+threadIdx.x;
int something=tex1Dfetch(texObj,线程id);
}

您的第二个内核是正确的,对于我尝试的每个计算功能(sm_30到sm_52),它都使用VS2012和CUDA 7.0工具包为我编译。

由于缺少模板类型参数,您的第一个内核无法编译。这将汇编:

__global__ void a_kernel(cudaTextureObject_t texObj)
{
    int thread_id = blockIdx.x * blockDim.x + threadIdx.x;
    int something = tex1Dfetch<int>(texObj, thread_id);
}
\uuuuu全局\uuuuuu无效内核(cudaTextureObject\u t texObj)
{
int thread_id=blockIdx.x*blockDim.x+threadIdx.x;
int something=tex1Dfetch(texObj,线程id);
}

您的第二个内核是正确的,对于我尝试的每一种计算功能(sm_30到sm_52),它都使用VS2012和CUDA 7.0工具包为我编译。

我重新安装了CUDA工具包,现在第二段代码(另一个内核)编译完毕。根据第一个答案,第一段代码首先是不正确的。W.r.t.重新安装cuda工具包,是因为我之前肯定在sdk中删除了一些东西,我相信是texture_indirect_functions.h.

我重新安装了cuda工具包,现在第二段代码(另一个_内核)编译完成了。根据第一个答案,第一段代码首先是不正确的。W.r.t.重新安装cuda工具包,是因为我之前肯定在sdk中删除了一些东西,我相信是texture_indirect_functions.h.

您需要显示一段代码来重现错误。就像你链接的代码一样,你需要显示一个代码来重现你的错误。就像你链接的一样,代码是关于你如何处理内核和如何创建Tex obj的。