Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cuda_runtime.h>
- #include <iostream>
- __global__ void kernel() {
- __shared__ volatile bool looped;
- __shared__ volatile bool done;
- if (!threadIdx.x) {
- looped = false;
- done = false;
- }
- while (true) {
- if ((threadIdx.x == 0) && looped)
- done = true;
- if (done)
- return;
- if (threadIdx.x == 0)
- looped = true;
- }
- }
- int main() {
- kernel<<<dim3(1), dim3(2)>>>();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement