Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python: Create pybind11 wrapper for C #111

Open
frothga opened this issue Oct 5, 2020 · 0 comments
Open

Python: Create pybind11 wrapper for C #111

frothga opened this issue Oct 5, 2020 · 0 comments

Comments

@frothga
Copy link
Collaborator

frothga commented Oct 5, 2020

There are two general options for a Python backend: generate pure Python code or wrap compiled C code so it can be accessed from Python. It seems that pybind11 can provide access to nearly every variable and function of the generated C code, so this appears to be the better option. It may be a little more complicated to use, but will provide faster code and better parallelization. In this approach, the main use of Python is as a scripting wrapper, perhaps to integrate the simulation with other software. We should also add some callback hooks in the main simulator loop so that each step can controlled from the script interface.

The Python backend will include a code generator that extends the C generator. It will add the pybind11 statements, then compile a shared library. It will also generate a simple Python scripts that imports and runs the simulation. These files can go in a job directory, and the Python backend will support actually running the simulation as usual. The files could also be exported to an arbitrary location.

@frothga frothga added this to the Release 1.3 milestone Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant