Martin Kempf
MSE-seminar: Program Analysis and Transformation, 2011



   author={Kempf, Martin},



Download Download (PDF)   View View   Source Source   Source codes Source codes




The C/C++ metaprogramming toolkit for Python [16], CodePy [2], is analysed according to its source code generation possibility and its way to generate extension modules for Python. The combination of both results in generating C code in a Python script and executing it from within the same script. Insights are given on how this roundtrip is achieved using the Boost Python [1] library. It is outlined why Boost Python simplifies this roundtrip and with Instant Python [8] another toolkit is introduced that also enables to call a C function that is former described in a Python string. The analysis of the code generation capability of CodePy includes a comparison of the syntax tree building approach, as CodePy’s way to describe the target code, with the approach of using the Mako [10] template engine. The advantages of Python in combination with machine code compiled libraries are outlined as well as the advantages of code generation at runtime. With PyCUDA [15] a project is introduced which makes use of these advantages by combining Python and CUDA [3], and it is shown how CodePy can be used in conjunction with PyCUDA.
No votes yet.
Please wait...

* * *

* * *

HGPU group © 2010-2021 hgpu.org

All rights belong to the respective authors

Contact us: