Using Printf in CUDA kernels with PyCUDA
(only runs on Fermi devices) [[!table header="no" class="mointable" data=""" License of this example: | Public Domain Date: | 2010-09-21 PyCUDA version: | 0.94 """]]
#!python
import pycuda.driver as cuda
import pycuda.autoinit
from pycuda.compiler import SourceModule
mod = SourceModule("""
#include <stdio.h>
__global__ void say_hi()
{
printf("I am %d.%d\\n", threadIdx.x, threadIdx.y);
}
""")
func = mod.get_function("say_hi")
func(block=(4,4,1))