Please briefly describe your example here.

If you like, you may put your contact info here.

License of this example:

Sugeerth Murugesan sugeerth@gmail.com

Date:

4th September,2013

PyCUDA version:

   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 %dth thread in threadIdx.x:%d.threadIdx.y:%d  blockIdx.:%d blockIdx.y:%d blockDim.x:%d blockDim.y:%d\\n",(threadIdx.x+threadIdx.y*blockDim.x+(blockIdx.x*blockDim.x*blockDim.y)+(blockIdx.y*blockDim.x*blockDim.y)),threadIdx.x, threadIdx.y,blockIdx.x,blockIdx.y,blockDim.x,blockDim.y);
  11     }
  12     """)
  13 
  14 func = mod.get_function("say_hi")
  15 func(block=(4,4,1),grid=(2,2,1))

PyCuda/Examples/ThreadsAndBlocks (last edited 2013-09-05 04:11:58 by AndreasKloeckner)