Assign a scalar variable to multiple GPU


I am wondering if i can assign a global scalar variable to different GPU’s (with differents values on each):

__constant__ int a_dev;

int main()
 for (int i_GPU = 0; i_GPU < GPUNumber; i_GPU++)
   int a_host = i_GPU;
   cudaMemcpyToSymbolAsync(a_dev, &a_host, sizeof(int), 0, cudaMemcpyHostToDevice);

Will it work as wanted?


Never mind. I just found a constructive response from Robert through StackOverflow (