| 1 |
|
| 2 |
__global__ void kernel_1() |
| 3 |
{ |
| 4 |
unsigned int x = blockIdx.x*blockDim.x + threadIdx.x; |
| 5 |
unsigned int y = blockIdx.y*blockDim.y + threadIdx.y; |
| 6 |
} |
| 7 |
|
| 8 |
__global__ void kernel_2(int i) |
| 9 |
{ |
| 10 |
unsigned int x = blockIdx.x*blockDim.x + threadIdx.x; |
| 11 |
unsigned int y = blockIdx.y*blockDim.y + threadIdx.y; |
| 12 |
} |
| 13 |
|
| 14 |
int main() |
| 15 |
{ |
| 16 |
dim3 blockDim(16, 16, 1); |
| 17 |
dim3 gridDim(8, 8, 1); |
| 18 |
// CUDA follows |
| 19 |
kernel_2<<< gridDim, blockDim, 0 >>>(); |
| 20 |
kernel_1< gridDim, blockDim, 0 >(); |
| 21 |
f(); |
| 22 |
return 0; |
| 23 |
} |
| 24 |
|