notes-ing2/gpu/tp1/c/src/ex2.cu
2024-03-10 21:31:32 +01:00

17 lines
329 B
Text

#include <cstdio>
// step 02
__global__ void prints_hello() {
printf("Hello World bloc=%d thread=%d\n", blockIdx.x, threadIdx.x);
}
int main() {
// step 03
prints_hello<<<1, 1>>>();
cudaDeviceSynchronize();
return 0;
}
// # Question 2
// Avec 4 blocs de 32 threads, le message apparaitra 4*32 = 128 fois.