Hi,
I'm getting an error trying to run a codepy sample from the documentation:
http://documen.tician.de/pycuda/metaprog.html#metaprogramming-using-codepy

from codepy.cgen.cuda import CudaGlobalmod = Module([
    Typedef(POD(dtype, "value_type")),
    FunctionBody(
        CudaGlobal(FunctionDeclaration(
            Value("void", "add"),
            [Pointer(POD(dtype, name)) for name in ["result", "op1", "op2"]])),
        Block([
            Initializer(
                POD(numpy.int32, "idx"),
                "threadIdx.x + %d*blockIdx.x" % (thread_block_size*block_size)),
            ]+[
            Assign("result[idx+%d]" % (o*thread_block_size),
                "op1[idx+%d] + op2[idx+%d]" % (
                    o*thread_block_size,
                    o*thread_block_size))
            for o in range(block_size)
            ])
        )
    ])
from pycuda.compiler import SourceModulemod = SourceModule(mod)



I'm receiving the following error:
In [3]: mod = Module([
   ...:     Typedef(POD(dtype, "value_type")),
   ...:     FunctionBody(
   ...:         CudaGlobal(FunctionDeclaration(
   ...:             Value("void", "add"),
   ...:             [Pointer(POD(dtype, name)) for name in ["result", "op1",
"op2"]])),
   ...:         Block([
   ...:             Initializer(
   ...:                 POD(numpy.int32, "idx"),
   ...:                 "threadIdx.x + %d*blockIdx.x" %
(thread_block_size*block_size)),
   ...:             ]+[
   ...:             Assign("result[idx+%d]" % (o*thread_block_size),
   ...:                 "op1[idx+%d] + op2[idx+%d]" % (
   ...:                     o*thread_block_size,
   ...:                     o*thread_block_size))
   ...:             for o in range(block_size)
   ...:             ])
   ...:         )
   ...:     ])
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)

/home/prigor/projects/pycuda/pycuda-0.93/test/<ipython console> in
<module>()

*NameError: name 'dtype' is not defined*


Has anyone gotten this to work?
Thanks,
Paul

-- 
Paul Rigor
http://www.paulrigor.net/
http://www.ics.uci.edu/~prigor
_______________________________________________
PyCUDA mailing list
[email protected]
http://tiker.net/mailman/listinfo/pycuda_tiker.net

Reply via email to