def nvcc_kernel(name, params, body):
 paramstr = ', '.join(params)
 def flatbody():
  for b in body:
   if isinstance(b, (list, tuple)):
    for bb in b:
     (yield bb)
   else:
    (yield b)
 bodystr = ';\n'.join(flatbody())
 return ('KERNEL void %(name)s (%(paramstr)s)\n    {\n        %(bodystr)s;\n    }\n    ' % locals())

def nvcc_kernel ( name , params , body ) : paramstr = ', ' . join ( params ) def flatbody ( ) : for b in body : if isinstance ( b , ( list , tuple ) ) : for bb in b : ( yield bb ) else : ( yield b ) bodystr = ';\n' . join ( flatbody ( ) ) return ( 'KERNEL void %(name)s (%(paramstr)s)\n    {\n        %(bodystr)s;\n    }\n    ' % locals ( ) )
return the c code of a kernel function .