Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jlapeyre opened this issue Feb 9, 2022 · 12 comments
Open

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

jlapeyre opened this issue Feb 9, 2022 · 12 comments

Comments

@jlapeyre
Copy link

jlapeyre commented Feb 9, 2022

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

  • Mentor 1
    • Name: John Lapeyre
    • GitHub ID: @jlapeyre
    • What they do: Qiskit development
  • Mentor 2
    • Name: Jim Garrison
    • GitHub ID: @garrison
    • What they do: Qiskit applications development

Number of mentees

2

Type of mentees

  • Mentee *
    • Required:
      • Some coding and github skills.
      • Desire to contribute to an open-source project.
    • Nice to have:
      • Python experience
      • Julia experience
      • Quantum computing knowledge
@jlapeyre jlapeyre changed the title Issues in qiskit-alt a Julia backend for Qiskit. Issues in qiskit-alt: a Julia backend for Qiskit. Feb 9, 2022
@gunchamalik
Copy link

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

@jlapeyre
Copy link
Author

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

@HuangJunye HuangJunye moved this from To do to Pairing in progress in Mentor-mentee pairing Mar 7, 2022
@jlapeyre
Copy link
Author

jlapeyre commented Mar 8, 2022

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

  • Support both PyCall.jl and PythonCall.jl as backends to a single user-facing API. This is probably not a good idea. The semantics of the two systems are sufficiently different to require a fair amount of complexity to handle this. All future additions to the Julia code in qiskit_alt would have to support this.
  • Support both PyCall.jl and PythonCall.jl, but in parallel. That is, some code would use one backend and some the other. This might be confusing because the semantics and coding styles might be different and cause lack of clarity in the code base. The user need not see this because it shouldn't be difficult to provide a uniform pure-python interface.
    However, more importantly, the two systems handle wrapping and converting data differently. So they can't always interact transparently without yet more conversion.
  • Support only one of the two PyCall.jl or PythonCall.jl. This requires some implementation and benchmarking (and thinking!) to inform the decision for one system or the other.

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

@HuangJunye HuangJunye moved this from Pairing in progress to Paired in Mentor-mentee pairing Mar 10, 2022
@rafal-pracht
Copy link

# 16 Julia - Qiskit.pdf

@gunchamalik
Copy link

Julia Backend for Qiskit - Checkpoint 1.pdf

@saharbenrached
Copy link

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

@MozammilQ
Copy link

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

@rafal-pracht
Copy link

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

  • We changed the code so that we don't do the unnecessary memory allocation.
  • We used the cis method instead of exp for the complex number exponential function and by that, we gain on performance.
  • We deleted unneeded functions such as toString and dagger.
  • We changed the types of functions arguments to a more generic way.

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
Copy link

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
Copy link

After Checkpoint 1 I focused on the issue: qiskit-community/qiskit-alt#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: qiskit-community/qiskit-alt#30

Just during the checkpoint 1, I was working on this issue: qiskit-community/qiskit-alt#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: jlapeyre/find_julia#3

@rafal-pracht
Copy link

Checkpoint3-#16.pdf

@MozammilQ
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment