Efficient and Accurate Automatic Python Bindings with cppyy Cling

04/05/2023
by   Baidyanath Kundu, et al.
0

The simplicity of Python and the power of C++ force stark choices on a scientific software stack. There have been multiple developments to mitigate language boundaries by implementing language bindings, but the impedance mismatch between the static nature of C++ and the dynamic one of Python hinders their implementation; examples include the use of user-defined Python types with templated C++ and advanced memory management. The development of the C++ interpreter Cling has changed the way we can think of language bindings as it provides an incremental compilation infrastructure available at runtime. That is, Python can interrogate C++ on demand, and bindings can be lazily constructed at runtime. This automatic binding provision requires no direct support from library authors and offers better performance than alternative solutions, such as PyBind11. ROOT pioneered this approach with PyROOT, which was later enhanced with its successor, cppyy. However, until now, cppyy relied on the reflection layer of ROOT, which is limited in terms of provided features and performance. This paper presents the next step for language interoperability with cppyy, enabling research into uniform cross-language execution environments and boosting optimization opportunities across language boundaries. We illustrate the use of advanced C++ in Numba-accelerated Python through cppyy. We outline a path forward for re-engineering parts of cppyy to use upstream LLVM components to improve performance and sustainability. We demonstrate cppyy purely based on a C++ reflection library, InterOp, which offers interoperability primitives based on Cling and Clang-Repl.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
10/26/2017

Fast Linear Transformations in Python

This paper introduces a new free library for the Python programming lang...
research
10/28/2021

retworkx: A High-Performance Graph Library for Python

Network and graph analysis is a widely applicable field of research, and...
research
10/28/2022

System Demo: Tool and Infrastructure for Offensive Language Error Analysis (OLEA) in English

The automatic detection of offensive language is a pressing societal nee...
research
01/29/2013

PyXNAT: XNAT in Python

As neuroimaging databases grow in size and complexity, the time research...
research
03/03/2023

Using a DSL to read ROOT TTrees faster in Uproot

Uproot reads ROOT TTrees using pure Python. For numerical and (singly) j...
research
12/20/2022

Graalvisor: Virtualized Polyglot Runtime for Serverless Applications

Serverless is a new attractive computing model that offers great scalabi...
research
02/20/2019

Optimizing and Evaluating Transient Gradual Typing

Gradual typing enables programmers to combine static and dynamic typing ...

Please sign up or login with your details

Forgot password? Click here to reset