Skip to content

Commit ce0f0b3

Browse files
committed
Update documentation for native examples
1 parent 389dd2e commit ce0f0b3

8 files changed

Lines changed: 189 additions & 32 deletions

File tree

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Correlated Random Number Generator
2+
3+
In this example, we have only two nodes: Alice and Bob.
4+
5+
Alice and Bob will locally connect to their virtual nodes. The classical control communication is done by
6+
letting Alice run a client and Bob a server. Alice generates the EPR pair, and sends half to Bob. She subsequently
7+
performs the teleportation operation. She informs Bob of the outcome of the teleportation measurement, as well as the
8+
identity of the virtual qubit he received (assumed to be unknown to Bob here).
9+
10+
Bob proceeds to recover the teleported qubit.
11+
12+
In this example, we simply print out the initial state to be teleported, as well as the final state received by
13+
Bob to check whether the teleportation worked correctly.
14+
15+
16+
# How to run
17+
18+
To run this example, first make sure that the python virtual environment is activated. You can easily check this
19+
with the terminal command prompt, which shows the active python virtual environment in parentheses:
20+
```
21+
(simulaqron) user@machine_name:~$
22+
```
23+
If you don't see the name of the virtual environment, please check the SimulaQron README file to know how to
24+
create and activate it.
25+
26+
Once the environment is active, we need to start the simulaqron network:
27+
```bash
28+
simulaqron start --nodes=Alice,Bob --network-config-file classicalNet.json
29+
```
30+
31+
This will read the JSON configuration files and start the SimulaQron virtual nodes for nodes `Alice` and `Bob`.
32+
33+
After this, you can simply run the example by using the `run` script:
34+
```bash
35+
./run.sh
36+
```
37+
38+
# How to stop the execution in case the test execution stalls.
39+
40+
To fully stop the execution, you can use the `terninate` script:
41+
```bash
42+
./terminate.sh
43+
```
44+
45+
Us you want to terminate the current execution and start a new one, you can use the `doNew` script. This will stop
46+
the current execution and run the example once again:
47+
```bash
48+
./doNew.sh
49+
```
50+
51+
52+
# Troubleshooting
53+
54+
## Trying to start the network gives "Network with name <name> is already running" message
55+
56+
This usually happens when you stopped the network "manually" by killing processes (`kill -9`). If this happens,
57+
please make sure that you kill all related processes (use `ps aux | grep python` to search) and then delete the
58+
PID file for the running network. This file is located in `~/simulaqron_pids` and it is called
59+
`simulaqron_network_<network_name>.pid`:
60+
```bash
61+
rm ~/simulaqron_pids/simulaqron_network_<network_name>.pid
62+
```
63+
64+
After this, you can try to start the network again.

examples/nativeMode/corrRNG/README.txt

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Extended GHZ states
2+
3+
TODO
4+
5+
# How to run
6+
7+
To run this example, first make sure that the python virtual environment is activated. You can easily check this
8+
with the terminal command prompt, which shows the active python virtual environment in parentheses:
9+
```
10+
(simulaqron) user@machine_name:~$
11+
```
12+
If you don't see the name of the virtual environment, please check the SimulaQron README file to know how to
13+
create and activate it.
14+
15+
Once the environment is active, we need to start the simulaqron network:
16+
```bash
17+
simulaqron start --nodes=Alice,Bob,Charlie --network-config-file classicalNet.json
18+
```
19+
20+
This will read the JSON configuration files and start the SimulaQron virtual nodes for nodes `Alice`, `Bob` and
21+
`Charlie`.
22+
23+
After this, you can simply run the example by using the `run` script:
24+
```bash
25+
./run.sh
26+
```
27+
28+
# How to stop the execution in case the test execution stalls.
29+
30+
To fully stop the execution, you can use the `terninate` script:
31+
```bash
32+
./terminate.sh
33+
```
34+
35+
Us you want to terminate the current execution and start a new one, you can use the `doNew` script. This will stop
36+
the current execution and run the example once again:
37+
```bash
38+
./doNew.sh
39+
```
40+
41+
42+
# Troubleshooting
43+
44+
## Trying to start the network gives "Network with name <name> is already running" message
45+
46+
This usually happens when you stopped the network "manually" by killing processes (`kill -9`). If this happens,
47+
please make sure that you kill all related processes (use `ps aux | grep python` to search) and then delete the
48+
PID file for the running network. This file is located in `~/simulaqron_pids` and it is called
49+
`simulaqron_network_<network_name>.pid`:
50+
```bash
51+
rm ~/simulaqron_pids/simulaqron_network_<network_name>.pid
52+
```
53+
54+
After this, you can try to start the network again.
55+

examples/nativeMode/extendGHZ/run.sh

100644100755
File mode changed.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Distributed Graph States
2+
3+
In this example Alice, Bob, Charlie and David generate a graph state and transform this into a
4+
GHZ-like state and measure their qubits to achieve correlated outcomes. For a complete description
5+
of this example, see the description in the documentation under:
6+
* Examples
7+
* Programming via SimulaQron's native Python Twisted Interface (specific to SimulaQron)
8+
* Distributing a graph state
9+
10+
# How to run
11+
12+
To run this example, first make sure that the python virtual environment is activated. You can easily check this
13+
with the terminal command prompt, which shows the active python virtual environment in parentheses:
14+
```
15+
(simulaqron) user@machine_name:~$
16+
```
17+
If you don't see the name of the virtual environment, please check the SimulaQron README file to know how to
18+
create and activate it.
19+
20+
Once the environment is active, we need to start the simulaqron network:
21+
```bash
22+
simulaqron start --nodes=Alice,Bob,Charlie,David --network-config-file classicalNet.json --simulaqron-config-file simulaqron_settings.json
23+
```
24+
25+
This will read the JSON configuration files and start the SimulaQron virtual nodes for nodes `Alice`, `Bob`,
26+
`Charlie` and `David`.
27+
28+
After this, you can simply run the example by using the `run` script:
29+
```bash
30+
./run.sh
31+
```
32+
33+
# How to stop the execution in case the test execution stalls.
34+
35+
To fully stop the execution, you can use the `terninate` script:
36+
```bash
37+
./terminate.sh
38+
```
39+
40+
Us you want to terminate the current execution and start a new one, you can use the `doNew` script. This will stop
41+
the current execution and run the example once again:
42+
```bash
43+
./doNew.sh
44+
```
45+
46+
47+
# Troubleshooting
48+
49+
## Trying to start the network gives "Network with name <name> is already running" message
50+
51+
This usually happens when you stopped the network "manually" by killing processes (`kill -9`). If this happens,
52+
please make sure that you kill all related processes (use `ps aux | grep python` to search) and then delete the
53+
PID file for the running network. This file is located in `~/simulaqron_pids` and it is called
54+
`simulaqron_network_<network_name>.pid`:
55+
```bash
56+
rm ~/simulaqron_pids/simulaqron_network_<network_name>.pid
57+
```
58+
59+
After this, you can try to start the network again.
60+

examples/nativeMode/graphState/README.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ create and activate it.
2525

2626
Once the environment is active, we need to start the simulaqron network:
2727
```bash
28-
siumulaqron start --nodes Alice,Bob
28+
simulaqron start --nodes Alice,Bob
2929
```
3030

3131
This will read the JSON configuration files and start the SimulaQron virtual nodes for nodes `Alice` and `Bob`.
@@ -37,8 +37,13 @@ After this, you can simply run the example by using the `run` script:
3737

3838
# How to stop the execution in case the test execution stalls.
3939

40-
To fully stop the execution, you can use the `doNew` script. This will stop the current execution and run the
41-
example once again:
40+
To fully stop the execution, you can use the `terninate` script:
41+
```bash
42+
./terminate.sh
43+
```
44+
45+
Us you want to terminate the current execution and start a new one, you can use the `doNew` script. This will stop
46+
the current execution and run the example once again:
4247
```bash
4348
./doNew.sh
4449
```
@@ -56,4 +61,4 @@ PID file for the running network. This file is located in `~/simulaqron_pids` an
5661
rm ~/simulaqron_pids/simulaqron_network_<network_name>.pid
5762
```
5863

59-
After this, you can try to start the network again
64+
After this, you can try to start the network again.

examples/nativeMode/template/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Each one of those nodes defines 3 entries:
2525
## Adding new nodes
2626

2727
To add a new node named "Eva", follow these steps:
28-
1. Open the config.json file in a text editor.
28+
1. Open the `network_config.json` file in a text editor.
2929
2. Locate the "nodes" array inside the "default" object.
3030
3. Add a new object to the "nodes" array for "Eva". The structure should match the existing nodes:
3131
```json
@@ -40,8 +40,6 @@ To add a new node named "Eva", follow these steps:
4040
Replace PORT_NUMBER with unique port numbers for each socket type (e.g., 8851, 8852, 8853). The result should
4141
look like:
4242
```json
43-
Copy
44-
4543
{
4644
"name": "default",
4745
"nodes": [

0 commit comments

Comments
 (0)