Using Printf in CUDA kernels with PyCUDA
(only runs on Fermi devices)
License of this example: |
Public Domain |
Date: |
2010-09-21 |
PyCUDA version: |
0.94 |
1 import pycuda.driver as cuda
2 import pycuda.autoinit
3 from pycuda.compiler import SourceModule
4
5 mod = SourceModule("""
6 #include <stdio.h>
7
8 __global__ void say_hi()
9 {
10 printf("I am %d.%d\\n", threadIdx.x, threadIdx.y);
11 }
12 """)
13
14 func = mod.get_function("say_hi")
15 func(block=(4,4,1))
