Commit 55c113cb authored by Murali's avatar Murali
Browse files

Merge branch 'qiskit1.0-port' of code.ornl.gov:olcf-qcfd/qlsa into qiskit1.0-port

Updated README and merging
parents 1a3269fc 1560014f
Loading
Loading
Loading
Loading
+58 −45
Original line number Diff line number Diff line
@@ -44,42 +44,18 @@ All developments were done on [OLCF Andes](https://docs.olcf.ornl.gov/systems/an
      ```
      </details>

      * Since the QLSA circuit generator ([HHL](https://github.com/anedumla/quantum_linear_solvers)) uses an older qiskit version requiring qiskit-terra, we need to make two envs: (1) to generate the circuit and (2) to run the circuit using qiskit 1.0
      1. Install libraries to generate circuit
            * Make custom conda env
            ```
      conda create --name env_custom python=3.9
      conda activate env_custom
      ```
      * Install qiskit
      ```
      pip install -r requirements.txt --no-cache-dir
      ```
    * **NOTE:** Make sure to test the installation with the sample codes provided: 
      1. Test qiskit installation: [`test_qiskit_installation.py`](test_qiskit_installation.py)

            ```
            python test_qiskit_installation.py -backtyp ideal
            conda create --name qlsa-circuit python=3.11
            conda activate qlsa-circuit
            ```

            <details><summary>Sample output from the test code:</summary>

            * Install qiskit and [linear solver](https://github.com/anedumla/quantum_linear_solvers) package
            ```
            Backend: QasmSimulator('qasm_simulator')
            Job status is JobStatus.DONE

            Total count for 00 and 11 are: {'00': 494, '11': 506}
                ┌───┐     ┌─┐   
            q_0:┤ H ├──■──┤M├───
                └───┘┌─┴─┐└╥┘┌─┐
            q_1:─────┤ X ├─╫─┤M├
                     └───┘ ║ └╥┘
            c:2/═══════════╩══╩═
                           0  1 
            pip install -r requirements_circuit.txt --no-cache-dir
            ```
            </details>

            * Change `-backtyp` for different backends.
            * **NOTE:** To run using IBM Provider, you need to add your IBM Quantum Computing API KEY and instance to the `keys.sh` file and source activate it.
      2. Test [linear solver package](https://github.com/anedumla/quantum_linear_solvers): [`test_linear_solver.py`](test_linear_solver.py)
            * Test [linear solver package](https://github.com/anedumla/quantum_linear_solvers): [`test_linear_solver.py`](test_linear_solver.py)

            ```
            python test_linear_solver.py -nq 2
@@ -144,6 +120,43 @@ All developments were done on [OLCF Andes](https://docs.olcf.ornl.gov/systems/an
            ```
            </details>
      
      2. Install libraries to run the circuit
            * Make custom conda env
            ```
            conda create --name qlsa-solver python=3.11
            conda activate qlsa-solver
            ```
            * Install qiskit and [linear solver](https://github.com/anedumla/quantum_linear_solvers) package
            ```
            pip install -r requirements_solver.txt --no-cache-dir
            ```

            * Test qiskit installation: [`test_qiskit_installation.py`](test_qiskit_installation.py)

            ```
            python test_qiskit_installation.py -backtyp ideal
            ```

            <details><summary>Sample output from the test code:</summary>

            ```
            Backend: QasmSimulator('qasm_simulator')
            Job status is JobStatus.DONE

            Total count for 00 and 11 are: {'00': 494, '11': 506}
                ┌───┐     ┌─┐   
            q_0:┤ H ├──■──┤M├───
                └───┘┌─┴─┐└╥┘┌─┐
            q_1:─────┤ X ├─╫─┤M├
                     └───┘ ║ └╥┘
            c:2/═══════════╩══╩═
                           0  1 
            ```
            </details>

            * Change `-backtyp` for different backends.
            * **NOTE:** To run using IBM Provider, you need to add your IBM Quantum Computing API KEY and instance to the `keys.sh` file and source activate it.

2. Install GPU version of Aer simulator (skip for Frontier):

    ```
@@ -246,9 +259,9 @@ All developments were done on [OLCF Andes](https://docs.olcf.ornl.gov/systems/an
      ```
      * Change `nq` to change size of system of equations
  
3. Run generalized QLSA script for various use-cases: [`linear_solver.py`](linear_solver.py)
3. Run QLSA circuit generator script for various use-cases: [`circuit_HHL.py`](circuit_HHL.py)
    ```
    srun -N1 -n1 -c2 python linear_solver.py -case [case-name] -casefile [case-var-file] -s [#-shots]  --savedata[optional but recommended]
    srun -N1 -n1 -c2 python circuit_HHL.py -case [case-name] -casefile [case-var-file] --savedata
    ```
      <details><summary>Sample output for Hele-Shaw flow, solving for pressure:</summary>