Commit 1a5afd10 authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

Merge branch 'master' of https://github.com/ornl-qci/qcor

parents 6925b2e1 a7e3e068
Loading
Loading
Loading
Loading
Loading
+99 −1
Original line number Diff line number Diff line
@@ -19,4 +19,102 @@ http://CADES-IP:8080

## IDE Docker set-up

- Add `.ibm_config` and `.ionq_config`
 No newline at end of file
- Add `.ibm_config`, `.ionq_config`, and `.qlm_config`

- Install:

```
python3 -m pip install qiskit --user
python3 -m pip install qlmaas --user
```

- Notes:
 
`-print-csp-source`: print CSP output

`-print-final-submission`: print final IR submission (NISQ) or apply (FTQC)

`-print-opt-stats`: print runtime pass execution info

# Demo1: 

- No opt: print-final-submission to show final XACC IR tree for backend submission

```
qcor simple_circuit.cpp -print-final-submission
```

- Opt: level 1

```
qcor -opt 1 simple_circuit.cpp -print-final-submission
```

- With opt stats:

```
qcor -opt 1 simple_circuit.cpp -print-final-submission -print-opt-stats
```


- Trotter example:

```
qcor trotter_decompose.cpp -print-final-submission 
```

```
./a.out -dt 0.05 -steps 10
```

```
qcor -opt 1 trotter_decompose.cpp -print-final-submission 
```

```
qcor -opt 2 trotter_decompose.cpp -print-final-submission 
```


# Demo2: 

- Simulator
```
qcor -qpu qpp ghz.cpp 
```

- IBMQ
```
qcor -qpu ibm:ibm_lagos ghz.cpp
```

```
qcor -qpu aer:ibm_lagos ghz.cpp
```

- IonQ: 
```
qcor -qpu ionq ghz.cpp
```

```
qcor -qpu ionq:qpu ghz.cpp
```

- Atos QLM:
```
qcor -qpu atos-qlm ghz.cpp
```
(25-q max)


# Demo3: 

```
qcor -qrt ftqc iqpe_ftqc.cpp
```

Show FTQC apply:
```
qcor -qrt ftqc iqpe_ftqc.cpp -print-final-submission
```
 No newline at end of file
+13 −12
Original line number Diff line number Diff line
@@ -14,20 +14,21 @@ int main(int argc, char **argv) {
  auto qbits = qalloc(2);
  // Multi-term Hamiltonian
  auto H = X(0) * X(1) + Z(0) + Z(1);
  // Default params:
  double dt = 0.01;
  int nbSteps = 100;

  // Parse user-supplied params (if any)
  std::vector<std::string> arguments(argv + 1, argv + argc);
  for (int i = 0; i < arguments.size(); i++) {
    if (arguments[i] == "-dt") {
      dt = std::stod(arguments[i + 1]);
    }
    if (arguments[i] == "-steps") {
      nbSteps = std::stoi(arguments[i + 1]);
    }
  }
  // dt: Trotter time step size
  // steps: number of steps
  argparse::ArgumentParser program(argv[0]);
  program.add_argument("-dt").default_value(0.01).action(
      [](const std::string &value) { return std::stod(value); });
  program.add_argument("-steps").default_value(100).action(
      [](const std::string &value) { return std::stoi(value); });
  program.parse_args(argc, argv);

  // Get runtime params (if any)
  const double dt = program.get<double>("-dt");
  const int nbSteps = program.get<int>("-steps");

  std::cout << "Trotter for dt = " << dt << "; steps = " << nbSteps << "\n";
  trotter_evolve(qbits, H, dt, nbSteps);
}
 No newline at end of file