Skip to content
This repository was archived by the owner on Jun 9, 2023. It is now read-only.

qiskitexamples: run examples on remote server & also on local simulator #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

indisoluble
Copy link
Contributor

What

qiskitexamples mostly run the examples on IBM Quantum Experience remote simulator and ibmqx2. With the changes in this PR, we can also run the examples on the local simulator in our computer.

Why

As mentioned in issue #8, I am working with the owners of the QISKit SDK Python project to deploy the C++ QASM simulator as a Debian package. Once this is done, I would like to prepare a new PR to make use of this simulator in the Swift framework and then, I will need a way to show it is working as expected. My intention is to modify qiskitexamples to let the user decide which local simulator he/she wants to use.

How

qiskitexamples now exposes a new option: --local

Usage: qiskitexamples [options] [input]
Options:
--help                     Shows usage
--token <token>            Specifies IBM Quantum Experience Token
--local                    Run examples on local simulator
Input:
None                       Runs all examples
ghz|qft|rippleadd|teleport Runs specified example

If instead of --token <token>, you specify --local; the program will not try to connect to the server, instead it will run the test on your local simulator (backend local_qasm_simulator).

Of all the changes the most interesting is the new class I have introduced named CommandLineOption. It holds the token (in case there is any) and defines an enumerated typed with the different backends the program uses. At this moment, it might not seem specially useful but, later on, when we can choose between the current local simulator and the C++ QASM simulator, I intend to limit to this class the necessary changes to allow this functionality; the resulting code should be cleaner (or at least, I hope so :) )

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant