Cargando…
PyROOT: Seamless Melting of C++ and Python
<!--HTML-->With ROOT it's possible to use any C++ library from Python without writing any bindings nor dictionaries: loading the library and injecting the relevant headers in the ROOT C++ interpreter is enough to guarantee interactive usage from within Python. Just in time (JIT) compilati...
Autor principal: | |
---|---|
Lenguaje: | eng |
Publicado: |
2016
|
Materias: | |
Acceso en línea: | http://cds.cern.ch/record/2157239 |
_version_ | 1780950709033762816 |
---|---|
author | Mato Vila, Pere |
author_facet | Mato Vila, Pere |
author_sort | Mato Vila, Pere |
collection | CERN |
description | <!--HTML-->With ROOT it's possible to use any C++ library from Python without writing any bindings nor dictionaries: loading the library and injecting the relevant headers in the ROOT C++ interpreter is enough to guarantee interactive usage from within Python. Just in time (JIT) compilation of C++ code and immediate utilisation of C++ entities from within Python is also supported.
Thanks to the ROOT type system and C++ interpreter and JIT compiler, complete Python/C++ interoperability is achieved. In this contribution we explain how this mechanism is general enough to make any library written in C or C++ usable from within Python and how concepts such as template metaprogramming are mapped in Python. We review the basics of the JIT compilation capabilities provided by the Clang based ROOT interpreter, Cling, and the way in which some of the information of the Abstract Syntax Tree (AST) built by Clang is stored by the ROOT type system. The way in which ROOT manages the automatic loading of libraries and parsing of necessary headers is also described.
We illustrate from the programming model point of view the simplicity of the invocation of the C++ entities from within the Python world through concrete examples.
Live demos are provided whenever possible to grant the audience an enhanced experience. |
id | cern-2157239 |
institution | Organización Europea para la Investigación Nuclear |
language | eng |
publishDate | 2016 |
record_format | invenio |
spelling | cern-21572392022-11-02T22:10:26Zhttp://cds.cern.ch/record/2157239engMato Vila, PerePyROOT: Seamless Melting of C++ and Python2nd Developers@CERN ForumDevelopers@CERN Forum<!--HTML-->With ROOT it's possible to use any C++ library from Python without writing any bindings nor dictionaries: loading the library and injecting the relevant headers in the ROOT C++ interpreter is enough to guarantee interactive usage from within Python. Just in time (JIT) compilation of C++ code and immediate utilisation of C++ entities from within Python is also supported. Thanks to the ROOT type system and C++ interpreter and JIT compiler, complete Python/C++ interoperability is achieved. In this contribution we explain how this mechanism is general enough to make any library written in C or C++ usable from within Python and how concepts such as template metaprogramming are mapped in Python. We review the basics of the JIT compilation capabilities provided by the Clang based ROOT interpreter, Cling, and the way in which some of the information of the Abstract Syntax Tree (AST) built by Clang is stored by the ROOT type system. The way in which ROOT manages the automatic loading of libraries and parsing of necessary headers is also described. We illustrate from the programming model point of view the simplicity of the invocation of the C++ entities from within the Python world through concrete examples. Live demos are provided whenever possible to grant the audience an enhanced experience.oai:cds.cern.ch:21572392016 |
spellingShingle | Developers@CERN Forum Mato Vila, Pere PyROOT: Seamless Melting of C++ and Python |
title | PyROOT: Seamless Melting of C++ and Python |
title_full | PyROOT: Seamless Melting of C++ and Python |
title_fullStr | PyROOT: Seamless Melting of C++ and Python |
title_full_unstemmed | PyROOT: Seamless Melting of C++ and Python |
title_short | PyROOT: Seamless Melting of C++ and Python |
title_sort | pyroot: seamless melting of c++ and python |
topic | Developers@CERN Forum |
url | http://cds.cern.ch/record/2157239 |
work_keys_str_mv | AT matovilapere pyrootseamlessmeltingofcandpython AT matovilapere 2nddeveloperscernforum |