Программы на C++. Форум разработчиков
Anonymous
CUDA tex2D: в шаблоне: нет соответствующей функции для вызова «__nv_tex_surf_handler».
Сообщение
Anonymous » 05 ноя 2024, 10:28
Я пытаюсь выполнить билинейную интерполяцию с текстурированием cuda. Однако Clion всегда напоминает мне об ошибке в tex2D:
Код: Выделить всё
In template: no matching function for call to '__nv_tex_surf_handler' error occurred here.
Вот мое ядро:
Код: Выделить всё
__global__ void interpolationBilinearKernel(float* output,
cudaTextureObject_t texObj,
int width, int height, int frames) {
unsigned int x = blockIdx.x * blockDim.x + threadIdx.x;
unsigned int y = blockIdx.y * blockDim.y + threadIdx.y;
unsigned int z = blockIdx.z;
auto f01 = tex2D(texObj, x, y); // error occurs here!
auto f11 = tex2D(texObj, x + 1, y);
auto f00 = tex2D(texObj, x, y + 1);
auto f10 = tex2D(texObj, x + 1, y + 1);
float n11 = f01 * 0.5 + f11 * 0.5;
float n00 = f00 * 0.5 + f01 * 0.5;
float n10 = f00 * 0.25 + f10 * 0.25 + f01 * 0.25 + f11 * 0.25;
output[z * width * height * 4 + x * 4 + y * 2] = f01;
output[z * width * height * 4 + x * 4 + y * 2 + 1] = n11;
output[z * width * height * 4 + x * 4 + (y + width) * 2] = n00;
output[z * width * height * 4 + x * 4 + (y + width) * 2 + 1] = n10;
}
Если я настаиваю на выполнении этого кода, генерируется следующая ошибка
Код: Выделить всё
[1/3] Building CXX object CMakeFiles\testCUDAversion2.dir\execution.cpp.obj
FAILED: CMakeFiles/testCUDAversion2.dir/execution.cpp.obj
C:\PROGRA~2\MICROS~4\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx86\x64\cl.exe /nologo /TP -DUSE_CUDA -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include" -I"C:\Program Files\libTinyTIFF\include" /DWIN32 /D_WINDOWS /EHsc /Ob0 /Od /RTC1 -std:c++20 -MDd -Zi /showIncludes /FoCMakeFiles\testCUDAversion2.dir\execution.cpp.obj /FdCMakeFiles\testCUDAversion2.dir\ /FS -c D:\code\OpenSourceLib\cpp\testCUDAversion2\execution.cpp
D:\code\OpenSourceLib\cpp\testCUDAversion2\main.cu(16): error C3861: “tex2D”: Cannot find identifier
D:\code\OpenSourceLib\cpp\testCUDAversion2\main.cu(17): error C3861: “tex2D”: Cannot find identifier
D:\code\OpenSourceLib\cpp\testCUDAversion2\main.cu(18): error C3861: “tex2D”: Cannot find identifier
D:\code\OpenSourceLib\cpp\testCUDAversion2\main.cu(19): error C3861: “tex2D”: Cannot find identifier
D:\code\OpenSourceLib\cpp\testCUDAversion2\main.cu(89): error C2059: syntax error:“
Подробнее здесь: [url]https://stackoverflow.com/questions/79155472/cuda-tex2d-in-template-no-matching-function-for-call-to-nv-tex-surf-handler[/url]
1730791734
Anonymous
Я пытаюсь выполнить билинейную интерполяцию с текстурированием cuda. Однако Clion всегда напоминает мне об ошибке в tex2D: [code]In template: no matching function for call to '__nv_tex_surf_handler' error occurred here. [/code] Вот мое ядро: [code]__global__ void interpolationBilinearKernel(float* output, cudaTextureObject_t texObj, int width, int height, int frames) { unsigned int x = blockIdx.x * blockDim.x + threadIdx.x; unsigned int y = blockIdx.y * blockDim.y + threadIdx.y; unsigned int z = blockIdx.z; auto f01 = tex2D(texObj, x, y); // error occurs here! auto f11 = tex2D(texObj, x + 1, y); auto f00 = tex2D(texObj, x, y + 1); auto f10 = tex2D(texObj, x + 1, y + 1); float n11 = f01 * 0.5 + f11 * 0.5; float n00 = f00 * 0.5 + f01 * 0.5; float n10 = f00 * 0.25 + f10 * 0.25 + f01 * 0.25 + f11 * 0.25; output[z * width * height * 4 + x * 4 + y * 2] = f01; output[z * width * height * 4 + x * 4 + y * 2 + 1] = n11; output[z * width * height * 4 + x * 4 + (y + width) * 2] = n00; output[z * width * height * 4 + x * 4 + (y + width) * 2 + 1] = n10; } [/code] Если я настаиваю на выполнении этого кода, генерируется следующая ошибка [code][1/3] Building CXX object CMakeFiles\testCUDAversion2.dir\execution.cpp.obj FAILED: CMakeFiles/testCUDAversion2.dir/execution.cpp.obj C:\PROGRA~2\MICROS~4\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx86\x64\cl.exe /nologo /TP -DUSE_CUDA -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include" -I"C:\Program Files\libTinyTIFF\include" /DWIN32 /D_WINDOWS /EHsc /Ob0 /Od /RTC1 -std:c++20 -MDd -Zi /showIncludes /FoCMakeFiles\testCUDAversion2.dir\execution.cpp.obj /FdCMakeFiles\testCUDAversion2.dir\ /FS -c D:\code\OpenSourceLib\cpp\testCUDAversion2\execution.cpp D:\code\OpenSourceLib\cpp\testCUDAversion2\main.cu(16): error C3861: “tex2D”: Cannot find identifier D:\code\OpenSourceLib\cpp\testCUDAversion2\main.cu(17): error C3861: “tex2D”: Cannot find identifier D:\code\OpenSourceLib\cpp\testCUDAversion2\main.cu(18): error C3861: “tex2D”: Cannot find identifier D:\code\OpenSourceLib\cpp\testCUDAversion2\main.cu(19): error C3861: “tex2D”: Cannot find identifier D:\code\OpenSourceLib\cpp\testCUDAversion2\main.cu(89): error C2059: syntax error:“ Подробнее здесь: [url]https://stackoverflow.com/questions/79155472/cuda-tex2d-in-template-no-matching-function-for-call-to-nv-tex-surf-handler[/url]