Swapping in CUDA

Hello everyone,

iam New in CUDA,and iam doing some projects in CUDA.

in the some of codes it required to implement swapping concept in parallel
to reduce the execution time.so is there any function can i use
it for that?

void swap(int *p,int *q) {
   int t;
   
   t=*p; 
   *p=*q; 
   *q=t;
}

Thanks

https://thrust.github.io/doc/group__copying.html

There’s a function on that page, “swap_ranges” that might be what you’re looking for.