2

这是我编写的两个内核函数——完整的代码没有编译错误,但有警告。

该程序是关于生物学序列比对的。在内核一中,矩阵s0是使用gpu_sample和计算的gpu_data,在内核二中,与内核一gpu_s0中的相同gpu_s0gpu_sgpu_s0和 自己计算。这是代码和警告:

__global__ void myKernel1( char** gpu_sample, char** gpu_data, float **gpu_s0)   
{
    dim3 dimGrid1;
    dim3 dimBlock1;
    dimBlock1.x = dimBlock1.y = BLOCK_SIZE;
    dimGrid1.x = dimGrid1.y = GRID_SIZE;

    int i1 = threadIdx.x + blockIdx.x * dimBlock1.x;
    int j1 = threadIdx.y + blockIdx.y * dimBlock1.y;

    if( i1 > N || j1 > M ) return;
    while ( j1 < (M+1) && i1 < (N+1) )
    {
        if(gpu_sample[0][j1] == gpu_data[i1][0])    // here is the warning part.
        {

            gpu_s0[i1+1][j1+1] = 5;
        }
        else 

            gpu_s0[i1+1][j1+1] = -3;

    i1 += blockDim.x * gridDim.x;
    j1 += blockDim.y * gridDim.y;
    }
}

__global__ void myKernel2( float **gpu_s0, float **gpu_s )
{
    dim3 dimGrid2;
    dim3 dimBlock2;
    dimBlock2.x = dimBlock2.y = BLOCK_SIZE;
    dimGrid2.x = dimGrid2.y = GRID_SIZE;

    float w = -4;                                   
    float zero = 0;


    __shared__ float shared[ threadsPerBlock ][threadsPerBlock]; 
    int i2 = threadIdx.x + blockIdx.x * dimBlock2.x;
    int j2 = threadIdx.y + blockIdx.y * dimBlock2.y;

    while( j2 < (M+1) && i2 < (N+1) )
    {
      shared[threadIdx.x][threadIdx.y] = gpu_s0[i2][j2];      // here is the warning.

      i2 += blockDim.x * gridDim.x;
      j2 += blockDim.y * gridDim.y;
    }

    __syncthreads();


    if( j2 < (M+1) && i2 < (N+1) )
    gpu_s[i2][0] = gpu_s[0][j2] = 0;


    /*if ( j2 < (M+1) && i2 < (N+1) )
    sTemp0[threadIdx.x][threadIdx.y] = gpu_s0[i2][j2]; //????????
    __syncthreads();*/


    if( i2 > N || j2 > M ) return;
    while ( j2 < (M+1) && i2 < (N+1) )
    {

        gpu_s[i2][j2] = max(gpu_s[i2-1][(j2-1)] + shared[threadIdx.x][threadIdx.y], //?????????
                          gpu_s[i2][(j2-1)] + w, 
                          gpu_s[(i2-1)][j2] + w, 
                          zero);     // here is the warning.
        i2 += blockDim.x * gridDim.x;
        j2 += blockDim.y * gridDim.y;
    }

}

警告:

./test_10_15_2012.cu(155): Warning: Cannot tell what pointer points to, assuming global memory space
./test_10_15_2012.cu(155): Warning: Cannot tell what pointer points to, assuming global memory space
./test_10_15_2012.cu(155): Warning: Cannot tell what pointer points to, assuming global memory space
./test_10_15_2012.cu(186): Warning: Cannot tell what pointer points to, assuming global memory space
./test_10_15_2012.cu(208): Warning: Cannot tell what pointer points to, assuming global memory space
./test_10_15_2012.cu(208): Warning: Cannot tell what pointer points to, assuming global memory space
./test_10_15_2012.cu(208): Warning: Cannot tell what pointer points to, assuming global memory space
./test_10_15_2012.cu(208): Warning: Cannot tell what pointer points to, assuming global memory space

有人可以帮我解决这个问题,或者给我一些建议吗?

4

0 回答 0