Commit 6661429b authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

syncing up latest, added readme with build instructions


Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent c1883de0
Pipeline #43867 passed with stages
in 2 minutes and 16 seconds
# QCOR
QCOR is a C++ language extension and associated compiler implementation
for variational quantum computation on near-term, noisy devices.
## Dependencies
Compiler (C++11): GNU 5+, Clang 3+
CMake 3.9+
XACC: see https://xacc.readthedocs.io/en/latest/install.html#building-xacc
## Build instructions
For CMake 3.9+, do not use the apt-get installer, instead use `pip`, and
ensure that `/usr/local/bin` is in your PATH:
```bash
$ python -m pip install --upgrade cmake
$ export PATH=$PATH:/usr/local/bin
```
On Ubuntu 16+, install latest clang and llvm libraries and headers (you may need sudo)
```bash
$ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
$ add-apt-repository "deb http://apt.llvm.org/jessie/ llvm-toolchain-jessie main"
$ apt-get update
$ apt-get install libclang-9-dev llvm-9-dev clang-9
$ ln -s /usr/bin/llvm-config-9 /usr/bin/llvm-config
```
Note that, for now, developers must clone QCOR manually:
``` bash
$ git clone https://code.ornl.gov/qci/qcor
$ cd qcor
$ mkdir build && cd build
$ cmake .. -DXACC_DIR=~/.xacc (or wherever you installed XACC)
$ make install
```
......@@ -4,20 +4,16 @@ file(GLOB SRC *.cpp)
add_library(${LIBRARY_NAME} SHARED ${SRC})
target_include_directories(${LIBRARY_NAME}
PUBLIC .
${XACC_INCLUDE_DIRS}
)
target_include_directories(${LIBRARY_NAME} PUBLIC . ${XACC_INCLUDE_DIRS})
target_link_libraries(${LIBRARY_NAME} PUBLIC xacc)
#qcor_enable_rpath(${LIBRARY_NAME})
# qcor_enable_rpath(${LIBRARY_NAME})
if(QCOR_BUILD_TESTS)
#add_subdirectory(tests)
# add_subdirectory(tests)
endif()
file(GLOB HEADERS *.hpp)
#install(TARGETS ${LIBRARY_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/plugins)
# install(TARGETS ${LIBRARY_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/plugins)
......@@ -9,6 +9,13 @@ using namespace xacc;
namespace qcor {
void Initialize(int argc, char** argv) {
xacc::Initialize(argc,argv);
}
void Initialize(std::vector<std::string> argv) {
xacc::Initialize(argv);
}
const std::string persistCompiledCircuit(std::shared_ptr<Function> function) {
std::function<char()> randChar = []() -> char {
const char charset[] = "0123456789"
......
......@@ -16,7 +16,9 @@ namespace qcor {
class qpu_handler;
using HandlerLambda = std::function<void(qpu_handler &)>;
void Initialize(int argc, char** argv);
void Initialize(std::vector<std::string> argv);
// Persist the given function to file, return
// the file name
......@@ -26,6 +28,7 @@ const std::string persistCompiledCircuit(std::shared_ptr<Function> function);
std::shared_ptr<Function> loadCompiledCircuit(const std::string &fileName);
// Submit an asynchronous job to the QPU
using HandlerLambda = std::function<void(qpu_handler &)>;
std::future<std::shared_ptr<AcceleratorBuffer>> submit(HandlerLambda &&);
} // namespace qcor
......
......@@ -25,6 +25,8 @@ public:
template <typename QuantumKernel>
void vqe(QuantumKernel &&kernel, double observable, double optimizer) {
xacc::info("[qcor] Executing vqe! :)");
}
template <typename QuantumKernel> void execute(QuantumKernel &&kernel) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment