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

Migrate ODE function solver to C++ #442

Merged
merged 64 commits into from
Dec 22, 2019

Conversation

atilag
Copy link
Member

@atilag atilag commented Nov 13, 2019

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)

  • Fix the linter
  • Fix a crash that exists in both versions running some Pulse tests
  • Restructure files in the project
  • Remove unccessary cython files
  • Linux support
  • Windows support

atilag added 30 commits November 1, 2019 17:04
Debugging :)
Add functionality to helpers
Tests are passing (some intermittent crashes due to bad inherited code).
code
- Tunning examples to run faster so we can measure speed ups way easier
- Adding the linux static version of MuparserX library
@atilag atilag changed the title [WIP] Migrate ODE function solver to C++ Migrate ODE function solver to C++ Dec 4, 2019
Copy link
Member

@chriseclectic chriseclectic left a 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?

qiskit/providers/aer/backends/pulse_simulator.py Outdated Show resolved Hide resolved
qiskit/providers/aer/openpulse/qobj/digest.py Outdated Show resolved Hide resolved
@atilag atilag merged commit b8e5ae3 into Qiskit:openpulse-sim Dec 22, 2019
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
@atilag atilag deleted the remove-dynamic-cython branch June 1, 2020 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PulseSimulator Issues related to (future) pulse simulator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants