-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add support for external installations of key dependencies #24
Conversation
Build is good for this PR on my end (but was not necessarily faster and still takes time to download the files during cmake). Also works well with qiree. |
@wongey Cool. If you use spack (or if you use dnf or some other utility) to install the prereqs separately and enable |
@sethrj Could you share how you handle the dependencies through the |
My build script is: cmake \
-DQIREE_MINIMAL_BUILD=ON \
-DXACC_DEPS_EXTERNAL=ON \
-DXACC_BUILD_TESTS=OFF \
-DXACC_BUILD_EXAMPLES=OFF \
.. The main benefit for our use case of installing dependencies externally is that if you make a new build of xacc you don't have to redownload and reinstall these every time. This is particularly potent for CI builds which is the primary driver. The second benefit is that it means you can play nicely with other software frameworks: if QIREE wants to link another software project built with JSON, we can do so without nasty ODR violations. One final benefit is that you can build XACC as debug but still use optimized versions of the upstream utilities. |
@sethrj @danclaudino I used the above spack environment together with your build script. The environment setup was unfortunately quite slow (~30 minutes). It was also sidetracked by an incompatible gcc version (which added additional minutes on my end to figure out). In the end, I would say using the environment overall did not improve the original cmake time significantly (at least for me). Also, I had to add In any case, both minimal builds (with or without spack) were successful and works with |
Ah, I forgot to mention one key step that shortens build time: running Here, all the @wongey If you had to add that flag then something's not right... |
With @sethrj's new commits in this PR, the xacc build in the spack environment is smooth for me with gcc@11.4.0. I did not have to make further modifications. Normal cmake is fine is as well. |
Thanks for the verification @wongey ! |
@danclaudino Would you mind merging this as soon as possible? It seems like we're stepping on each others' change sets which results in a fair bit of extra work for conflict resolution. I'll pull in the upstream changes and perhaps @wongey could give it a final once over if you're ready to merge? Thanks! |
And also the merge/diff process is significantly complicated by the re-indentation of parameters in CMake files. add_library(xacc SHARED
xacc.cpp
accelerator/AcceleratorBuffer.cpp
utils/Utils.cpp
utils/CLIParser.cpp
utils/heterogeneous.cpp
ir/IRBuilder.cpp
service/ServiceRegistry.cpp
service/xacc_service.cpp
accelerator/remote/RemoteAccelerator.cpp) to file(GLOB SOURCES
xacc.cpp
accelerator/AcceleratorBuffer.cpp
utils/Utils.cpp
utils/CLIParser.cpp
utils/heterogeneous.cpp
ir/IRBuilder.cpp
service/ServiceRegistry.cpp
service/xacc_service.cpp) means changing every single line, whereas file(GLOB HEADERS
xacc.hpp
ir/*.hpp
compiler/Compiler.hpp
accelerator/*.hpp
utils/*.hpp
service/*.hpp
algorithm/*.hpp
optimizer/*.hpp
) means that changes will only affect a single line and new list elements can be inserted at the end. |
Thanks @danclaudino ! |
Allowing external dependencies rather than "vendoring" them (by downloading and building inline) is a best practice for scientific software stacks. It prevents errors if a downstream client wants to also link to those dependencies (or if they use another app that links against them), and it also reduces the overhead in a edit-compile-debug cycle, especially on CI systems.
This is the first step in that direction. It allows several packages to work with already built externals:
The following spack environment lets XACC use the externals:
cc @wongey
UPDATE: the one problem I'm seeing is that something very screwy is going on with the xacc dependencies. The first configure, everything builds find. After reconfiguring, the
eigen
include directory simply disappears from thebuild.ninja
file line. However the default "unix makefiles" option seems to work fine, so this may be related to ninja-build/ninja#1251 or something else weird...