stl vectors

Hi,

How should I pass a stl vector to device. Maybe not pass but share. I want to map given vector to device that I could access to this vector from kernel. I was trying sth like this:

[codebox]

int * wskvec=&image[0];

cudaSetDevice(0);

cudaSetDeviceFlags(cudaDeviceMapHost);

cudaHostAlloc((void**)&wskvec,imgbyte,cudaHostAllocMapped | cudaHostAllocWriteCombined | cudaHostAllocPortable);

err=cudaHostGetDevicePointer ((void**)&in,wskvec, 0);

dim3 block(blsize,1,1);

dim3 grid(image.size()/(block.x*H)+1,1,1);

go<<<grid,block>>>(in,out,degree,thre,W,H);

[/codebox]

But this code provides to run-time error that “vector is out of range” while accessing to vector.

err has value of 5.

thanks for answer.