我在带有 GPU GTX465 1 GB 的 MS VS2005 上使用 CUDA SDK 3.1。我有这样一个核函数:
__global__ void CRT_GPU_2(float *A, float *X, float *Y, float *Z, float *pIntensity, float *firstTime, float *pointsNumber)
{
int holo_x = blockIdx.x*20 + threadIdx.x;
int holo_y = blockIdx.y*20 + threadIdx.y;
float k=2.0f*3.14f/0.000000054f;
if (firstTime[0]==1.0f)
{
pIntensity[holo_x+holo_y*MAX_FINAL_X]=0.0f;
}
for (int i=0; i<pointsNumber[0]; i++)
{
pIntensity[holo_x+holo_y*MAX_FINAL_X]=pIntensity[holo_x+holo_y*MAX_FINAL_X]+A[i]*cosf(k*sqrtf(pow(holo_x-X[i],2.0f)+pow(holo_y-Y[i],2.0f)+pow(Z[i],2.0f)));
}
__syncthreads();
}
这是调用内核函数的函数:
extern "C" void go2(float *pDATA, float *X, float *Y, float *Z, float *pIntensity, float *firstTime, float *pointsNumber)
{
dim3 blockGridRows(MAX_FINAL_X/20,MAX_FINAL_Y/20);
dim3 threadBlockRows(20, 20);
CRT_GPU_2<<<blockGridRows, threadBlockRows>>>(pDATA, X, Y, Z, pIntensity,firstTime, pointsNumber);
CUT_CHECK_ERROR("multiplyNumbersGPU() execution failed\n");
CUDA_SAFE_CALL( cudaThreadSynchronize() );
}
我正在循环中加载该函数的所有参数(例如,在一次循环迭代中每个参数有 4096 个元素)。总的来说,我想在所有循环迭代之后为每个参数制作 32768 个元素的内核。
MAX_FINAL_X 为 1920,MAX_FINAL_Y 为 1080。
当我开始算法时,第一次迭代非常快,经过一两次迭代后,我得到了有关 CUDA 超时错误的信息。我在 GPU gtx260 上使用了这个算法,据我记得它做得更好......
你能帮我..也许我在这个算法中根据新的费米拱门犯了一些错误?