QuTech-Delft / OpenQL

OpenQL: A Portable Quantum Programming Framework for Quantum Accelerators. https://dl.acm.org/doi/10.1145/3474222
https://openql.readthedocs.io
Other
99 stars 44 forks source link

Slow compilation due to inclusion of Eigen #317

Closed anneriet closed 2 years ago

anneriet commented 4 years ago

Because the complete Eigen library is included as a submodule, building OpenQL has become very slow. While this is not necessary, because only some of the header files of Eigen are needed for unitary decomposition and other algorithms.

jvansomeren commented 4 years ago

A make of the OpenQL from scratch on my old Linux CentOS work station takes about 20 minutes. That takes too long so I'm looking for ways to reduce that.

You @anneriet wrote that the complete Eigen library is included but that only some of the header files are needed for unitary decomposition in the OpenQL compiler. Could you try to update making unitary decomposition so that it doesn't use the complete Eigen library?

anneriet commented 4 years ago

I'm working on it, when only the necessary parts of the eigen library are included, the compilation time is about halved, so that would be 10 mins for you. That's better but still too long, so I am looking into other things (like pre-compilation), I'll open a pull-request once I've got something that is a significant enough improvement.

jvansomeren commented 4 years ago

I'm involving Jeroen @jvanstraten in this issue since, if I remember well, also did some update to make unitary decomposition be compiled separately. I propose you both exchange ideas and do the update and keep us @razvnane and @jvansomeren posted.

jvanstraten commented 4 years ago

See #325. It's for the modular branch, but it should be easy to backport. It just takes the entire ql::unitary class and sticks it in a separate compile unit, so only it needs to depend on Eigen at all, leaving a wrapper in its place. Of course that does nothing to reduce the compilation time of that compile unit, but because Eigen is taken out of the header file, all the other compile units don't have to compile Eigen as well, so overall it's much faster. Also, when nothing changes in unitary.cc or the headers it depends on, incremental recompilation can skip it entirely.

Anything you've done so far to reduce compile times of the unitary decomposition code itself should compound of course; halving what's left after #325's changes would be great.

wvlothuizen commented 2 years ago

Seems to be solved in 0.10.0