Python 从主机获取变量时出现奇怪的值

Python 从主机获取变量时出现奇怪的值,python,numpy,pycuda,Python,Numpy,Pycuda,我的内核如下所示: # compile device.cu mod = SourceModule(''' #include<stdio.h> __global__ void test(unsigned int* tab, unsigned int compteurInit) { unsigned int gID = threadIdx.x + blockDim.x * (threadIdx.y + blockDim.y * (blockIdx.x + blockI

我的内核如下所示:

# compile device.cu
    mod = SourceModule('''
  #include<stdio.h>
__global__ void test(unsigned int* tab, unsigned int compteurInit)
{
    unsigned int gID = threadIdx.x + blockDim.x * (threadIdx.y + blockDim.y * (blockIdx.x + blockIdx.y * gridDim.x));
    tab[gID] = compteurInit;
    printf("%d ",tab[gID]);
}''',
            nvcc='/opt/cuda65/bin/nvcc',
           )
当我打印结果时,我得到了一些奇怪的值

像这样:

[42949672970 42949672970 42949672970 ...,           0           0
           0]
但是当我检查内核中的打印值时,它看起来很好

[42949672970 42949672970 42949672970 ...,           0           0
           0]