我試圖執行內核乳寧的Gabor濾波器和我得到這個錯誤無效的設備功能時執行的內核
/Gabor_Cuda/gaborMax.cu(2387) : getLastCudaError() CUDA error : convolutionColumnGaborMaxGPU() execution failed : (8) invalid device function
此文件「gaborMax.cu」線「2387」:getLastCudaError (「convolutionColumnGaborMaxGPU()執行失敗\ n」);
,它指的內核是這樣一個:convolutionGaborMaxGPU < < >>(d_Input,d_Result0,d_Result1,d_Result2,d_Result3,d_Result4,d_Result5,d_Result6,d_Result7,d_Result8,d_Result9,d_Result10,d_Result11,d_Result12,d_Result13, d_Result14,d_Result15,DATA_W,DATA_H,loadsPerThread,loadsPerThread);
我徘徊,如果我應該發佈或不是內核的代碼,因爲它是一個更多的1500年代碼行我認爲它會更好我發佈文件「gaborMax.cu」但無論如何這是內核
全球無效convolutionGaborMaxGPU( 浮動* d_Input, 浮動* d_Result0, 浮動* d_Result1, 浮動* d_Result2, 浮動* d_Result3, 浮動* d_Result4, 浮動* d_Result5, 的代碼float * d_Result6, float * d_R esult7, 浮子* d_Result8, 浮子* d_Result9, 浮子* d_Result10, 浮子* d_Result11, 浮子* d_Result12, 浮子* d_Result13, 浮子* d_Result14, 浮子* d_Result15, INT DATAW, INT dataH, INT loadsPerThreadX, INT loadsPerThreadY ){
const int smemSize = SUBPICW * SUBPICW;
const int smemYOffset = IMUL(threadIdx.y, SUBPICW);
const int smemYBlockOffset = IMUL(blockDim.y, SUBPICW);
const int yOffset = IMUL(threadIdx.y, dataW);
const int localYBlockOffset = IMUL(blockDim.y, dataW);
const int globalYBlockOffset = IMUL(blockIdx.y, blockDim.y * dataW);
const int xBlockOffset = IMUL(blockIdx.x, blockDim.x);
//const int apronOffset = (APRON0 * dataW) - APRON0;
__shared__ float data[SUBPICW*SUBPICW];
int currentXIdx = 0;
int smemPos = 0;
int smemPosData = 0;
int gmemPos = 0;
int gmemPosData = 0;
for (int k = 0; k < loadsPerThreadY; k++)
{
for (int l = 0; l < loadsPerThreadX; l++)
{
currentXIdx = threadIdx.x + (l*blockDim.x);
if (currentXIdx < SUBPICW)
{
smemPos = currentXIdx + smemYOffset + (k * smemYBlockOffset);
if (smemPos < smemSize)
{
gmemPos = currentXIdx + xBlockOffset;
if (gmemPos - APRON0 >= dataW)
{
gmemPos = dataW + APRON0;
}
else if (gmemPos < APRON0) {
gmemPos = APRON0;
}
gmemPos+= (yOffset + globalYBlockOffset + (k * localYBlockOffset) - (APRON0 * dataW) - APRON0);
if (gmemPos < APRON0)
{
gmemPos = APRON0;
}
else if (gmemPos >= dataW*dataH)
{
gmemPos = dataW*dataH - 1;
}
data[smemPos] = d_Input[gmemPos];
}
}
}
}
__syncthreads();
smemPosData = threadIdx.x + smemYOffset + APRON0 + (APRON0 * SUBPICW);
//smemPosData = threadIdx.x + ((threadIdx.y) * SUBPICW);
gmemPosData = threadIdx.x + xBlockOffset
+ yOffset + globalYBlockOffset;
///////////////////////////////// //////////////////////////////////////////////// calculate 1st卷積濾波器
float sum0 = 0;
#ifdef UNROLL_INNER
sum0 = convolutionGaborMax18<2 * KERNEL_RADIUS0>(data + smemPosData, d_Kernel0);
#else
for (int k = -KERNEL_RADIUS0; k <= KERNEL_RADIUS0; k++) {
sum0 += data[smemPosData -18 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 -18)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData -17 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 -17)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData -16 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 -16)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData -15 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 -15)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData -14 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 -14)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData -13 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 -13)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData -12 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 -12)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData -11 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 -11)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData -10 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 -10)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData -9 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 -9)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData -8 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 -8)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData -7 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 -7)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData -6 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 -6)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData -5 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 -5)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData -4 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 -4)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData -3 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 -3)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData -2 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 -2)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData -1 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 -1)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData +1 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 +1)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData +2 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 +2)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData +3 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 +3)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData +4 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 +4)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData +5 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 +5)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData +6 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 +6)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData +7 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 +7)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData +8 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 +8)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData +9 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 +9)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData +10 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 +10)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData +11 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 +11)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData +12 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 +12)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData +13 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 +13)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData +14 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 +14)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData +15 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 +15)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData +16 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 +16)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData +17 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 +17)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
sum0 += data[smemPosData +18 + (k*SUBPICW)]
* d_Kernel0[(KERNEL_RADIUS0 +18)
+ ((KERNEL_RADIUS0 + k)*KERNEL_W0)];
}
ENDIF
sum0 /= 18;
d_Result0[gmemPosData] = sum0;
d_Result1[gmemPosData] = sum1;
d_Result2[gmemPosData] = sum2;
d_Result3[gmemPosData] = sum3;
d_Result4[gmemPosData] = sum4;
d_Result5[gmemPosData] = sum5;
d_Result6[gmemPosData] = sum6;
d_Result7[gmemPosData] = sum7;
d_Result8[gmemPosData] = sum8;
d_Result9[gmemPosData] = sum9;
d_Result10[gmemPosData] = sum10;
d_Result11[gmemPosData] = sum11;
d_Result12[gmemPosData] = sum12;
d_Result13[gmemPosData] = sum13;
d_Result14[gmemPosData] = sum14;
d_Result15[gmemPosData] = sum15;
}
我做的所有15人在同一計算濾波器卷積,我從中 SUM1,.....,sum15
有什麼可以幫助解決問題的。我在32位上運行我的代碼,並不知道代碼是否需要在64位計算機上執行。但我不明白這個錯誤的意思。
THX任何幫助