Commit 9487a334 authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

updates to aideqc demo

parent 81cbc8c7
Loading
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ __qpu__ void qpe(qreg q, QPEOracleSignature oracle) {
  auto counting_qubits = q.extract_range({0, 3});
  // could also do this...
  // auto counting_qubits = q.extract_qubits({0,1,2});
  auto state_qubit = q[3];
  auto state_qubit = q[3]; // or q.tail();

  // Put it in |1> eigenstate
  X(state_qubit);
@@ -45,6 +45,8 @@ __qpu__ void oracle(qubit q) { T(q); }

int main(int argc, char **argv) {
  auto q = qalloc(4);
  // could also provide lambda
  // auto oracle = qpu_lambda([](qubit q) { T(q);});
  qpe(q, oracle);
  q.print();
}
+67 −0
Original line number Diff line number Diff line
OPENQASM 3;
include "stdgates.inc";

const n_qubits = 50;
const n_layers = 12;
qubit q[n_qubits];

// Run by: mpiexec -n <N> ./a.out -qrt nisq -qpu tnqvm -qpu-config tnqvm.ini 

// Loop over layers
float[64] theta = 1.234;
for i in [0:n_layers] {
    // Single qubit layers:
    for j in [0:n_qubits] {
        rx(theta) q[j];
    }

    // For demonstration purposes, just change the 
    // angle in each layer by adding 1.0.~
    theta += 1.0;
    // Entanglement layers:
    for j in [0:n_qubits - 1] {
        cx q[j], q[j+1];
    }
}
// 4 Ranks
// real    8m44.685s
// user    68m45.740s
// sys     0m14.613s
// Result Buffer:
// {
//     "AcceleratorBuffer": {
//         "name": "",
//         "size": 50,
//         "Information": {
//             "amplitude-imag": 6.013328501808246e-9,
//             "amplitude-real": -9.093254149661334e-9
//         },
//         "Measurements": {}
//     }
// }
//  Number of Flops processed    :      0.12953981373440D+13
//  Number of Flops processed    :      0.12953981373440D+13
//  Average GEMM GFlop/s rate    :      0.34592207040862D+01
//  Average GEMM GFlop/s rate    :      0.33989965113118D+01
//  Number of Bytes permuted     :      0.13790950400000D+11
//  Average permute GB/s rate    :      0.46258781869063D-01
//  Number of Bytes permuted     :      0.13790950400000D+11
//  Average contract GFlop/s rate:      0.15991027746986D+01
//  Average permute GB/s rate    :      0.45411628655322D-01
// #END_MSG
//  Average contract GFlop/s rate:      0.15672632853478D+01
// #END_MSG
// #MSG(TAL-SH::CP-TAL): Statistics on CPU:
//  Number of Flops processed    :      0.12953981373440D+13
//  Average GEMM GFlop/s rate    :      0.34815246662248D+01
//  Number of Bytes permuted     :      0.13790950400000D+11
//  Average permute GB/s rate    :      0.45497061206249D-01
//  Average contract GFlop/s rate:      0.15932956878495D+01
// #END_MSG
// #MSG(TAL-SH::CP-TAL): Statistics on CPU:
//  Number of Flops processed    :      0.12953981373440D+13
//  Average GEMM GFlop/s rate    :      0.34580808710314D+01
//  Number of Bytes permuted     :      0.13790950400000D+11
//  Average permute GB/s rate    :      0.46148523562615D-01
//  Average contract GFlop/s rate:      0.15968730806935D+01
// #END_MSG
 No newline at end of file
+3 −0
Original line number Diff line number Diff line
tnqvm-visitor=exatn:float
exatn-buffer-size-gb=2
bitstring=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
 No newline at end of file
+5 −1
Original line number Diff line number Diff line
@@ -22,3 +22,7 @@
* In particular, show that we can integrate BQSKit qsearch as a circuit optimizer
* Run with verbose on, see circuit reductions
* Show Python, note that we can use 3rd party libs for Operators

# Python demos
![dcirc](deuteron_n3_ansatz.png)
![d2circ](deuteron_n2_ansatz.png)
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ ground_energy, opt_params = optimizer.optimize(opt_function, 1)
print("Energy: ", ground_energy)

H = operatorTransform('qubit-tapering', H)

@qjit
def one_qubit_ansatz(qq:qreg, theta :float, phi:float):
  q = qq.head()
Loading