{"id":6847,"date":"2012-01-06T19:56:12","date_gmt":"2012-01-06T17:56:12","guid":{"rendered":"http:\/\/hgpu.org\/?p=6847"},"modified":"2012-01-06T19:56:12","modified_gmt":"2012-01-06T17:56:12","slug":"codepy","status":"publish","type":"post","link":"https:\/\/hgpu.org\/?p=6847","title":{"rendered":"CodePy"},"content":{"rendered":"<p>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&#8217;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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":351,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[11,89,3],"tags":[215,1782,14,20,176,513],"class_list":["post-6847","post","type-post","status-publish","format-standard","hentry","category-computer-science","category-nvidia-cuda","category-paper","tag-code-generation","tag-computer-science","tag-cuda","tag-nvidia","tag-package","tag-python"],"views":2316,"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/hgpu.org\/index.php?rest_route=\/wp\/v2\/posts\/6847","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hgpu.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hgpu.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hgpu.org\/index.php?rest_route=\/wp\/v2\/users\/351"}],"replies":[{"embeddable":true,"href":"https:\/\/hgpu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6847"}],"version-history":[{"count":0,"href":"https:\/\/hgpu.org\/index.php?rest_route=\/wp\/v2\/posts\/6847\/revisions"}],"wp:attachment":[{"href":"https:\/\/hgpu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6847"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hgpu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6847"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hgpu.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6847"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}