-
Notifications
You must be signed in to change notification settings - Fork 368
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
Migrate ODE function solver to C++ #442
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…(just a basic scaffolding)
… files Moving forward...
Debugging :)
Add functionality to helpers
…hon's OrderedDict)
Tests are passing (some intermittent crashes due to bad inherited code).
…fig param: use_cpp_ode_func
code - Tunning examples to run faster so we can measure speed ups way easier - Adding the linux static version of MuparserX library
- Reorganizing code
atilag
changed the title
[WIP] Migrate ODE function solver to C++
Migrate ODE function solver to C++
Dec 4, 2019
- Add muparserx windows static version of the library
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the plan to maintain both the runtime compiled cython as well as this new parsing library?
chriseclectic
pushed a commit
to chriseclectic/qiskit-aer
that referenced
this pull request
Jan 23, 2020
* Calling c++ implementation of the numeric integrator solver function (just a basic scaffolding) * Adding C++ and helpers code (still not building) * Adding tests for the C++ helpers on Python C API * Adding my ordered_map to guarantee order insertion iteration (ala Python's OrderedDict) * Adding muparserx library for parsing hamiltonian math expressions * Now we can use both Cython and C++ func ODE solver depending on a config param: use_cpp_ode_func * Disabling Pulse simulator related tests for Python 3.5
chriseclectic
pushed a commit
to chriseclectic/qiskit-aer
that referenced
this pull request
Jan 23, 2020
* Calling c++ implementation of the numeric integrator solver function (just a basic scaffolding) * Adding C++ and helpers code (still not building) * Adding tests for the C++ helpers on Python C API * Adding my ordered_map to guarantee order insertion iteration (ala Python's OrderedDict) * Adding muparserx library for parsing hamiltonian math expressions * Now we can use both Cython and C++ func ODE solver depending on a config param: use_cpp_ode_func * Disabling Pulse simulator related tests for Python 3.5
chriseclectic
pushed a commit
to chriseclectic/qiskit-aer
that referenced
this pull request
Jan 23, 2020
* Calling c++ implementation of the numeric integrator solver function (just a basic scaffolding) * Adding C++ and helpers code (still not building) * Adding tests for the C++ helpers on Python C API * Adding my ordered_map to guarantee order insertion iteration (ala Python's OrderedDict) * Adding muparserx library for parsing hamiltonian math expressions * Now we can use both Cython and C++ func ODE solver depending on a config param: use_cpp_ode_func * Disabling Pulse simulator related tests for Python 3.5
chriseclectic
pushed a commit
to chriseclectic/qiskit-aer
that referenced
this pull request
Jan 23, 2020
* Calling c++ implementation of the numeric integrator solver function (just a basic scaffolding) * Adding C++ and helpers code (still not building) * Adding tests for the C++ helpers on Python C API * Adding my ordered_map to guarantee order insertion iteration (ala Python's OrderedDict) * Adding muparserx library for parsing hamiltonian math expressions * Now we can use both Cython and C++ func ODE solver depending on a config param: use_cpp_ode_func * Disabling Pulse simulator related tests for Python 3.5
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Now the Scipy ODE solver will use an static function built with C++, so there's no compilation on the flight nor the need for the user to have a specific set of toolchain nor files laying around.
Details and comments
I haven't benchmarked anything yet, because I focused on making it work instead of having best performance (things should go faster though for small simulations, longer simulations should not at the moment).
There's a flag in the rutime config:
use_cpp_ode_func
that can be enabled to use the C++ version of the solver or the Cyhton one. I want to keep both for a while just in case the C++ version is buggy. Cyhton one will be removed eventually.About the code
The main files are:
- numeric_integrator.cpp: Here is where all the logic resides. It's a direct translation of the algorithm that was being generated dynamically, plus some changes to generalize it (or be able to make it static)
- python_to_cpp.hpp: A set of function helpers to wrap Python C API with C++ containers (some STL and some defined by me).
- jlog.hpp: This is not being used in the code at the moment, but are a bunch of convinient functions for logging complex structures
TODO
(We may want to address some of these items in following PRs)