Change specific values in a CUDA array ?

Hello,

Is it possible to change only a few values at different locations in a CUDA array (in GPU memory) without running a kernel through the whole array ?
If yes, how ?

Thanks

up

Sure, you can address specific elements of your array with cudaMemcpy. Or you could just use thrust::device_vector for memory management:

#include <thrust/device_vector.h>

int main(void)

{

  thrust::device_vector<int> v(100);

v[50] = 13;

std::cout << "element 50 is: " << v[50] << std::endl;

}