Closed ryanmrichard closed 11 months ago
I don't have a solution, but I want to share some profiling info that can help us reduce the import time. Based on the profile on my laptop most of time is spent on the following:
cppyy.include('_deps/tensorwrapper-src/include/tensorwrapper/diis/diis.hpp')
cppyy.include('_deps/parallelzone-src/include/parallelzone/archive_wrapper.hpp')
cppyy.include('_deps/simde-src/include/simde/simde.hpp')
cppyy.cppdef("""#define thread_local ...""")
import cppyy
These top 5 items take about 75% of the import time. I haven't profiled separately but I'd guess most of the time is spent in the header only external dependencies such as Eigen in diis.hpp
and Cereal in archive_wrapper.hpp
. I don't think we need the serialization functions for the Python API, so it might be easy to get rid of that one. I am not also sure if we need to include Eigen explicitly, but that might be more involved.
I'll close this issue since the focus shifted to PyBind11 bindings and import times are not significant anymore.
On my computer the Python script:
takes about 7.5s to run. As far as I can tell, this overhead occurs every time I run the script. While not an issue on the scale of coupled-cluster it is somewhat annoying. For now I'm okay developing with a 7s overhead, so I wouldn't consider this a high priority issue.
This is a known issue, and I am simply creating this issue for the sake of generating a complete list of Python tasks. I'm not 100% sure what repo to put this issue in, i.e., I'm not sure if this is a problem with how we use Cppyy (in which case it should go in .github) or if there's something to be done on the SimDE side (and presumably on the side of other repos as well). IIRC the working hypothesis was this is an issue with how we use Cppyy so I put this issue in .github. We should move the issue as appropriate.