thrust::device_ptr< int> thrust::system::system_error

recently i got a problem

thrust::device_ptr< int> dev_beginSM_ptr(d_beginsm);
thrust::device_ptr<int> dev_endSM_ptr(d_endsm);

for(int i=0;i<number;i++)
{
for(int k=0;k<tgridnum;k++)
{

int ibegin  = dev_beginSM_ptr[k];
    int iend = dev_endSM_ptr[k];

  i = 924 and k = 2 it will crush Microsoft C++ 异常: 内存位置 0x006ff188 处的 thrust::system::system_error。
 but I copy the content to host  from device  the number in h_beginsm is ok

}