README.md 1.16 KB
Newer Older
1
2
3
4
5
6
7
8
Noting this here:

clang++ -std=c++11 -Xclang -load -Xclang compiler/clang/libqcor-ast-plugin.so -Xclang -add-plugin -Xclang -enable-quantum test.cpp

with args

clang++-9 -std=c++11 -Xclang -load -Xclang compiler/clang/libqcor-ast-plugin.so -Xclang -add-plugin -Xclang enable-quantum -Xclang -plugin-arg-enable-quantum -Xclang test -Xclang -v test.cpp

Mccaskey, Alex's avatar
Mccaskey, Alex committed
9
10
11
12
13
14
15
16
17
18
A better example

clang++-9 -std=c++11 -Xclang -load -Xclang compiler/clang/libqcor-ast-plugin.so
    -Xclang -add-plugin -Xclang enable-quantum
    -Xclang -plugin-arg-enable-quantum -Xclang accelerator
    -Xclang -plugin-arg-enable-quantum -Xclang tnqvm
    -Xclang -plugin-arg-enable-quantum -Xclang transform
    -Xclang -plugin-arg-enable-quantum -Xclang circuit-optimizer
    test.cpp

19
20
21
test.cpp looks like this

#include <stdio.h>
Mccaskey, Alex's avatar
Mccaskey, Alex committed
22
#include "qcor.hpp"
23

Mccaskey, Alex's avatar
Mccaskey, Alex committed
24
void foo() {
25
26
27

  printf("hi\n");

Mccaskey, Alex's avatar
Mccaskey, Alex committed
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  qcor::submit([&](qcor::qpu_handler& qh){
    qh.vqe([&](double t0){
      X(0);
      Ry(t0,0);
      CX(1,0);
    }, 1, 1);
  });

 auto future = qcor::submit([&](qcor::qpu_handler& qh){
    qh.execute([&](double t0){
      X(2);
      Ry(t0,1);
      CX(1,2);
    });
  });

  printf("hi %d\n", future.get());
45
46
47
}

int main() {
Mccaskey, Alex's avatar
Mccaskey, Alex committed
48
    foo();
49
}