我对这个基本的CUDA代码感到烦恼.
我有一个char**平面的2d密码数组,我目前的实现是CUDA只是迭代这个列表并显示密码.但是,当我去显示它们时,我只是得到"(NULL)".我不太清楚为什么会这样.有人可以解释它发生了什么吗?
主要:
char ** pwdAry;
pwdAry = new char *[numberOfPwd];
//pwdAry given some values (flat 2d array layout)
const int pwdArySize = sizeof(pwdAry);
dim3 grid(gridSize,gridSize);
dim3 block(blockSize,blockSize);
searchKeywordKernel << <grid, block >> >(pwdAry);
return EXIT_SUCCESS;
Run Code Online (Sandbox Code Playgroud)
CUDA:
__global__ void searchKeywordKernel(char **passwordList)
{
int x = threadIdx.x + blockIdx.x * blockDim.x;
int y = threadIdx.y + blockIdx.y * blockDim.y;
int pitch = blockDim.x * gridDim.x;
int idx = x + y * pitch;
int tidy = idx / pitch; …Run Code Online (Sandbox Code Playgroud)