qiskit-advocate / qamp-spring-22

Qiskit advocate mentorship program (QAMP) spring 22 cohort (Mar - Jun 2022)
13 stars 1 forks source link

Issues in qiskit-alt: a Julia backend for Qiskit. #16

Open jlapeyre opened 2 years ago

jlapeyre commented 2 years ago

Description

qiskit-alt is a high-performance Julia backend for Qiskit with a Python frontend. It is quite new and experimental. It is not distributed as part of Qiskit. The main application is computing a qubit Hamiltonian from the specification of an electronic structure problem.

There are a number of projects available, small and large. The appropriate project depends on the experience of the mentee. There are a number of issues in the qiskit-alt repo. But, the project is divided into several other repos, most of which are hosted here. These repos have their own issues. A major part of the effort is improving deployment options of Julia with the Python project. These issues are in julia_project

Note that much of the work happens on the Python side. So, if you know some Python, but don't yet know Julia, you can still contribute.

Deliverables

Open a pull request that closes an issue and work through getting it merged. Alternatively, start by opening a new issue; for instance as a sub-issue of a more open ended one.

Mentors details

Number of mentees

2

Type of mentees

gunchamalik commented 2 years ago

@jlapeyre I have basic knowledge pf python, but no knowledge of Julia. I am interested in learning and contributing to this project.

jlapeyre commented 2 years ago

Hi @gunchamalik, thanks for reaching out! We will contact you very soon.

jlapeyre commented 2 years ago

Here is one possible topic:

There are two separate ways for Julia and Python to communicate dynamically. One is via PyCall.jl / pyjulia. The other (more recent) is via PythonCall.jl / juliacall. It would be great if a single candidate were the clear winner. It's not clear that one way is better than the other; they do have different features.

We need to find out whether to support one way or the other, or both, and if so how. A good bit of infrastructure for investigating this is in place. (I need to push some changes today or tomorrow to make this visible)

I'll refer to the communication methods as PyCall.jl and PythonCall.jl which are the Julia modules, but the corresponding Python modules are implied.

Some possibilities are

I will follow up here with a link to the latest version of qiskit_alt, which is set up for investigating the topics above.

rafal-pracht commented 2 years ago

# 16 Julia - Qiskit.pdf

gunchamalik commented 2 years ago

Julia Backend for Qiskit - Checkpoint 1.pdf

saharbenrached commented 2 years ago

#16 Issues in qiskit-alt: a Julia backend for Qiskit.pdf

MozammilQ commented 2 years ago

This is my checkpoint-1's small presentation: #16 Issues in qiskit-alt: a Julia backend for Qiskit.pdf

rafal-pracht commented 2 years ago

The work on Julia-powered quantum library QuantumCircuits (https://github.com/Adgnitio/QuantumCircuits.jl) is going very well. image

There is now 5 Contributor in the library who created and merged 24 pull requests and by that closed 21 issues (https://github.com/Adgnitio/QuantumCircuits.jl/issues?q=is%3Aissue+is%3Aclosed). image

During these works, we focused on fixing the performance issue and did some code cleaning: image

Four issues were marked as "good first issues" so anyone who would like to help us is more than welcome.

But there is a lot of the work to do. We have to move from Qiskit-style circuit creation to a more Julia idiomatic way that uses the macro to create domain-specific language dedicated to quantum operation. The other thing we should do is avoid converting the circuit to a Qiskit object during the draw procedure. So there is a lot of task before us :)

saharbenrached commented 2 years ago

The modue qiskit-alt can be used to compute the fermionic operator of a molecule and convert it to a Pauli operator using the Jordan-Wigner transformation. This would later serve as an input to run molecular simulation algorithms from Qiskit Nature module. We are adding tutorials to demonstrate the use of the qiskit-alt module for users to run molecular simulation tasks. For the first tutorial, we are running the Variational Quantum Eigensolver to simulate the ground state energy of the Hygrogen molecule. In the first part, instead of using qiskit-nature, we use qiskit-alt features to describe the Fermionic operator and convert it to a Pauli operator with the Jordan-Wigner transform. The operator is then mapped to a quantum circuit and will be the input to the VQE method from Qiskit. molecule-description We compute the ground state energy of the Hydrogen molecule running-VQE However, the output result is not precise. Our main goal for the next stage of this project is to improve the computation accuracy. We are still investigating at which level the error is caused. We will continue fixing issues and creating more tutorials for the simulation of more complex molecule models (if possible) and other chemistry simulation algorithms such as computing higher state energies.

MozammilQ commented 2 years ago

After Checkpoint 1 I focused on the issue: https://github.com/Qiskit-Extensions/qiskit-alt/issues/27

In qiskit-alt/docker_tests, there is a shell file ./run_dockerfiles.sh Basically, this is a shell script that has purposes like building a docker image, running a docker container, and then running different tests for qiskit-alt package, other functionality includes like logging into the shell, etc in all these most of the variables like image name of the docker container its tag and other information was hardcoded along with this the functionality/job/behavior of the script depends on the command line argument. Implementing this group of functionality with this set of variables was good enough for a small scale but these were not easy to use, and, were not scalable to more number of other functionality.

I implemented a Python Command Line Tool which would use its command-line argument to take different variables like names of the docker images, its tag name, etc along with the behavior/functionality to execute. The good thing about this was the scalable numbers of variables and functionalities/behavior that can be implemented with the neatness of Python. The CLI Tool is named ./run_dockerfile.py and it exists in the same directory as its shell counterpart.

./run_dockerfile.py –help

gets us this output: image_1

As an example

./run_dockerfile.py –action=run

gets us this output: image_2

Here is the Pull Request: https://github.com/Qiskit-Extensions/qiskit-alt/pull/30

Just during the checkpoint 1, I was working on this issue: https://github.com/Qiskit-Extensions/qiskit-alt/issues/21

After,

pip install qiskit-alt

The Python Code:

import qiskit_alt
qiskit_alt.project.ensure_init()

should provide us with julia installed and qiskit_alt ready to accept commands but this terminated with this error: image_3

The issue was in a python package called find_julia: https://github.com/jlapeyre/find_julia It’s purpose is to make sure julia is present if not then install it.

After the issue was fixed, the output looked like this: image_4

This was the Pull Request: https://github.com/jlapeyre/find_julia/pull/3

rafal-pracht commented 2 years ago

Checkpoint3-#16.pdf

MozammilQ commented 2 years ago

Final Presentation: https://youtu.be/bjz3FKpm744