ORNL-QCI / xacc

XACC - eXtreme-scale Accelerator programming framework
https://xacc.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Add "minimal" build mode #17

Closed sethrj closed 4 months ago

sethrj commented 4 months ago

There are a number of 5+ year old dependencies from numerous projects built into XACC. Many of these fail to compile on modern Clang compilers due to use of deleted C++ functions.

There would be two big advantages to adding a CMake switch that disables everything except, for example, the Aer simulator:

  1. It would enable support for more machines because there's less probability of build failures due to out-of-date code that we can't afford to maintain.
  2. Building less code means we could add a minimal build to the CI for QIR-EE, allowing us to ensure that the XACC components are minimally functional.

cc @wongey

sethrj commented 4 months ago

@danclaudino Is this feasible to do without much effort? I could help with the cmake necessary to inject a compile-time constant that would let you #ifdef XACC_MINIMAL to disable inactive code regions...

danclaudino commented 4 months ago

@sethrj I'll work on it today. This should be straightforward, but will let you know if I need help. Also for @wongey, if there's anything other than Aer that should be part of this minimal build, let me know.

sethrj commented 4 months ago

Awesome! Thanks a bunch @danclaudino .

wongey commented 4 months ago

@danclaudino I would say keeping at least one vendor plugin in the build would be helpful for qir-ee testing purposes. I am currently testing with Honeywell and IonQ (but I think Honeywell would be a better choice if we only want to pick one). Adding another simulator like qpp might also be useful to compare results with aer (but if that is too much, I can use Honeywell's emulator instead).

danclaudino commented 4 months ago

Would you guys be able to test the minimal build with this https://github.com/danclaudino/xacc/tree/qiree_build before I merge it? Be sure to cmake with -DQIREE_MINIMAL_BUILD=ON.

sethrj commented 4 months ago

@danclaudino It builds! 🎉 All that's needed to fix is removing an invalid header (perhaps a rogue insertion from include-what-you-use):

diff --git a/quantum/observable/pauli/PauliOperator.cpp b/quantum/observable/pauli/PauliOperator.cpp
index 198f1d2a..771a591c 100644
--- a/quantum/observable/pauli/PauliOperator.cpp
+++ b/quantum/observable/pauli/PauliOperator.cpp
@@ -13,7 +13,6 @@
 #include "PauliOperator.hpp"
 #include "CompositeInstruction.hpp"
 #include "IRProvider.hpp"
-#include <bits/c++config.h>
 #include <cassert>
 #include <cmath>
 #include <memory>
danclaudino commented 4 months ago

@seth That crept in a recent commit. Thanks for catching it. I went ahead and removed some other redundant/unnecessary includes from PauliOperator.cpp.

wongey commented 4 months ago

@danclaudino We are good to go here! Build was much quicker and smooth (minus usual warnings, which I happily mute). The aer hiccup still persists if I use the parallel build option, but this is now expected and only happens once at the beginning.

I tested this with my current 'working' version of qiree and all simulators and vendor plugins work perfectly. Question: do we really need to try to search for qrack in this build? It is never found but everything still works fine. Maybe we can leave that out too?

danclaudino commented 4 months ago

Closing this issue as it has been addressed by #22.