Skip to content

Commit 096c084

Browse files
committed
Update "getting started" documentation and fix bugs in CLI client to match the documentation
1 parent ee7f1ba commit 096c084

2 files changed

Lines changed: 103 additions & 75 deletions

File tree

docs/GettingStarted.rst

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,30 @@ Setup
66
-----
77

88
SimulaQron requires `Python 3.12 <https://python.org/>`_ along with the packages *netqasm*, *twisted*, *numpy*, *scipy*,
9-
*networkx*, *click* and *daemons*.
9+
*networkx*, *click* and *daemons*. By following the installation instructions in the following sections, you will install
10+
SimulaQron with all the required packages.
1011

1112
^^^^^^^^^^^^^^^^^^^^^^
1213
Installation using pip
1314
^^^^^^^^^^^^^^^^^^^^^^
1415

15-
The easiest way to install SimulaQron is using pip (requires MacOS or Linux). Start by creating and activating a
16-
python virtual environment::
16+
The easiest way to install SimulaQron is using pip. SimulaQron has been tested working in Linux, and WSL (under windows).
17+
For installation on macOS, please use a Linux virtual machine to install SimulaQron.
18+
19+
Before proceeding with the installation, you need to install Python 3.12. For Debian-based distributions (like Ubuntu)
20+
you can install the *deadsnakes* repository to gain access to some specific python versions::
21+
22+
sudo add-apt-repository -y "ppa:deadsnakes/ppa"
23+
24+
After adding the repository, you can install the *full* version of python, including the development package and the ::
25+
26+
sudo apt-get install python3.12-full python3.12-dev
27+
28+
Additionally, you will need the `build-essential` package, to install tools used when building some SimulaQron dependencies::
29+
30+
sudo apt-get install build-essential cmake vim linux-headers-generic
31+
32+
To install SimulaQron, start by creating and activating a python virtual environment::
1733

1834
python3.12 -m venv simulaqron-venv
1935
source simulaqron-venv/bin/activate
@@ -22,6 +38,10 @@ Now, we can install SimulaQron by simply typing::
2238

2339
pip3 install simulaqron
2440

41+
It is also recommended that you can also install optional dependencies to enable full support of qubit engines::
42+
43+
pip3 install simulaqron\[opt\]
44+
2545
You can then make use of SimulaQron using the command ``simulaqron`` in the terminal. For more information on how
2646
to use this command see below or type::
2747

@@ -31,12 +51,6 @@ To make sure you have the version compatible with this documentation type::
3151

3252
simulaqron version
3353

34-
If you want to make sure that everything has been installed properly you can start run the unittests. Open an
35-
interactive python console by typing `python3` and the::
36-
37-
import simulaqron
38-
simulaqron.tests()
39-
4054
------------------------
4155
Testing a simple example
4256
------------------------
@@ -52,20 +66,21 @@ We will here illustrate how to use SimulaQron with the NetQASM library.
5266
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5367
Starting the SimulaQron backend
5468
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
69+
5570
By default SimulaQron uses the five nodes Alice, Bob, Charlie, David and Eve on your local computers. In this example
5671
there will be three processes for each node listening to incoming messages on a certain port number. These make up
5772
the simulation backend, the NetQASM server and the classical communication server. To start the processes and thus
5873
the backend of SimulaQron simply type::
5974

6075
simulaqron start
6176

62-
.. warning:: Running ``simulaqron start`` will be default start up servers on localhost (i.e., your own computer),
77+
.. warning:: Running ``simulaqron start`` will by default start up servers on localhost (i.e., your own computer),
6378
using port numbers between 8000 and 9000, to form the simulated quantum internet hardware. SimulaQron does not
6479
provide any access control to its simulated hardware, so you are responsible to securing access should this be
6580
relevant for you. You can also run the different simulated nodes on different computers. We do not take any
6681
responsibility for problems caused by SimulaQron.
6782

68-
For more information on what ``./cli/SimulaQron start`` does, how to change the nodes and the ports of the network,
83+
For more information on what ``simulaqron start`` does, how to change the nodes and the ports of the network,
6984
the topology etc, see `Configuring the Network <ConfNodes.rst>`_.
7085

7186
To stop the backend, simply type::
@@ -77,7 +92,7 @@ makes SimulaQron think that the network is still running. To reset this you can
7792

7893
simulaqron reset
7994

80-
Note that this also kills any currently running network and resets any settings or configurations.
95+
Note that this also kills any currently running network and resets any local settings or configurations.
8196

8297
^^^^^^^^^^^^^^^^^^^
8398
Running a protocol
@@ -117,9 +132,12 @@ going on here? Let us first look at how we will realize the example by making an
117132
While the task we want to realize here is completely trivial, the addition of step 3 does however already highlight a
118133
range of choices on how to realize step 3 and the need to find good abstractions to allow easy application development.
119134
One way to realize step 3 would be to hardwire Alice's and Bob's measurements: if the hardware can identify the
120-
correct qubits from the entanglement generation, then we could instruct it to measure it immediately without asking for a notification from the entanglement generation process. It is clear that in a network that is a bit larger than our tiny three node setup, identifying the right setup requires a link between the underlying qubits and classical control information: this is the objective of the classical/quantum combiner.
135+
correct qubits from the entanglement generation, then we could instruct it to measure it immediately without asking
136+
for a notification from the entanglement generation process. It is clear that in a network that is a bit larger than
137+
our tiny three node setup, identifying the right setup requires a link between the underlying qubits and classical
138+
control information: this is the objective of the classical/quantum combiner.
121139

122-
The script run.sh executes the following two python scripts::
140+
The script ``run.sh`` executes the following two python scripts::
123141

124142
#!/bin/sh
125143

@@ -132,7 +150,7 @@ We first create a ``NetQASMConnection`` which handles all communication with the
132150
An ``EPRSocket`` is used to create or receive entangled qubit pairs with a remote node.
133151
The key pattern is: queue operations, call ``flush()`` to execute them, then read results with ``int(m)``.
134152

135-
The core of aliceTest.py is::
153+
The core of ``aliceTest.py`` is::
136154

137155
epr_socket = EPRSocket("Bob")
138156

@@ -153,7 +171,7 @@ The core of aliceTest.py is::
153171
m1_val = int(m1)
154172
sim_conn.close()
155173

156-
Similarly the core of bobTest.py is::
174+
Similarly the core of ``bobTest.py`` is::
157175

158176
epr_socket = EPRSocket("Alice")
159177

@@ -189,15 +207,14 @@ To set a setting, for example to use the projectQ backend, type::
189207
This will create a file named ``simulaqron_settings.json`` in the current folder. This new file contains a full set of
190208
simulaqron configuration, including the setting that was just configured (using the `projectq` backend, in the example).
191209

192-
It is also possible to manually create this file::
210+
It is also possible to manually create this` `simulaqron_settings.json`` file with any text editor::
193211

194212
{
195213
"backend": "projectq",
196214
"log_level": 10
197215
}
198216

199-
which would set the backend to be use ProjectQ and the log-level to be debug (10). Any setting in this file will
200-
override the settings set in the CLI.
217+
which would set the backend to be use ProjectQ and the log-level to be debug (10).
201218

202219
Is is also possible to create a configuration file that contains all the default configurations::
203220

@@ -214,7 +231,7 @@ This command will create a file with the following configuration::
214231
"recv_retry_time": 0.1,
215232
"recv_max_retries": 10,
216233
"log_level": 30,
217-
"sim_backend": "stabilizer",
234+
"sim_backend": "qutip",
218235
"noisy_qubits": false,
219236
"max_app_waiting_time": -1.0,
220237
"t1": 1.0

0 commit comments

Comments
 (0)