You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/computing/quantum-computing/helmi/fiqci-partition.md
+6-8Lines changed: 6 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,14 +19,10 @@ need to apply for quantum resources in addition to CPU, GPU, and storage.
19
19
20
20
## The FiQCI partition `q_fiqci`
21
21
22
-
!!! success "Users can now query Helmi Figures of Merit"
23
-
To get the latest figures of merit: Use `helmi-info -h` for more details!
24
-
For a description of the figures see [here](../helmi/running-on-helmi.md#figures-of-merit).
25
-
26
22
Access to Helmi is only available through the FiQCI partition on LUMI, which provides a direct connection between a LUMI-C
27
23
node (with 128 cores and 256 GB RAM) and Helmi.
28
24
29
-
*[Further details on LUMI nodes](https://docs.lumi-supercomputer.eu/hardware/lumic/)
25
+
*[Further details on LUMI nodes](https://docs.lumi-supercomputer.eu/hardware/)
30
26
31
27
There is one queue in the Helmi partition corresponding to FiQCI projects: `q_fiqci`.
32
28
Currently, the maximum run time of a quantum job is 15 minutes.
@@ -50,16 +46,18 @@ The Helmi partition uses the same storage policies as LUMI.
50
46
* Your project persistent storage is used to share data amongst the members of a project and is located at `/project/project_<project-number>`. **The project persistent directory is purged once the project expires.**
51
47
* Your project scratch is intended as temporary storage for input, output or checkpoint data of your application. Please remove the files that are no longer needed by your project on a regular basis.
52
48
49
+
*[Further details on LUMI Storage](https://docs.lumi-supercomputer.eu/storage/)
50
+
53
51
## Usage and Billing
54
52
55
53
Quantum computing projects work similarly to the regular LUMI system. The main differences are:
56
54
57
55
1. FiQCI projects use the `--partition=q_fiqci` partition instead of the regular LUMI-C `--partition=standard` and `--partition=small`.
58
56
2. The maximum job walltime is **15 mins**.
59
-
3. Usage is billed as QPU minutes**QPUm** in `q_fiqci`.
60
-
4. The LUMI-Helmi software stack has to be loaded separately. See [Running on Helmi](../running-on-helmi/) for details.
57
+
3. Usage is billed as QPU seconds**QPUs** in `q_fiqci`.
58
+
4. The LUMI-Helmi computing environment has to be loaded separately. See [Running on Helmi](../running-on-helmi/) for details.
61
59
62
-
Presently, running through the `q_fiqci` queue will consume QPU minutes for the amount of wall-time spent running in the `q_fiqci` queue.
60
+
Presently, running through the `q_fiqci` queue will consume QPU seconds for the amount of wall-time spent running in the `q_fiqci` queue.
63
61
64
62
!!! success "Querying your used QPUs"
65
63
You can check your used QPUs using the `lumi-allocations` tool.
Copy file name to clipboardExpand all lines: docs/computing/quantum-computing/helmi/first-quantum-job.md
+77-64Lines changed: 77 additions & 64 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,88 +29,94 @@ The next step is to create your quantum circuit! Here a simple bell state will b
29
29
`module load lumi-workspaces` and
30
30
`lumi-workspaces`
31
31
32
-
Let us first create our python file with `nano my-first-quantum-job.py`. Here we use `nano` but if you are comfortable you can also use `vim` or `emacs`. This will bring up the `nano` text editor, the useful commands are at the bottom, to save and exit CTRL-X + Y.
32
+
Let us first create our python file with `nano first_quantum_job.py`. Here we use `nano` but if you are comfortable you can also use `vim` or `emacs`. This will bring up the `nano` text editor, the useful commands are at the bottom, to save and exit CTRL-X + Y.
33
33
34
34
### Importing the libraries
35
35
36
36
First let's import the right python libraries
37
37
38
38
```python
39
-
import qiskit
40
-
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
41
-
from qiskit.compiler import transpile
42
-
import numpy as np
43
-
from csc_qu_tools.qiskit import Helmi
39
+
import os
40
+
from qiskit import QuantumCircuit, QuantumRegister
41
+
from qiskit import execute
42
+
from qiskit_iqm import IQMProvider
44
43
```
45
44
46
45
### Creating the circuit
47
46
48
-
The quantum circuit is created by defining our`QuantumRegister`and our `ClassicalRegister`which hold our qubits and classical bits respectively. As this circuit only requires 2 qubits we only create a `QuantumRegister` of size 2. We will be measuring the outcome on each qubit and turning our quantum information into classical information, therefore we need a `ClassicalRegister` to hold this.
47
+
The quantum circuit is created by defining a`QuantumRegister` which hold our qubits and classical bits respectively. As this circuit only requires 2 qubits we only create a `QuantumRegister` of size 2. The number of shots is also defined here. The number of shots is the number of times a quantum circuit is executed. We do this because quantum computers are probabilistic machines and by repeating the experiment many times we can get close to a deterministic result to be able to draw conclusions from. A good number of shots for your first quantum job is `shots = 1000`. Increasing the shots will increase the precision of your results.
49
48
50
49
```python
50
+
51
+
shots =10000# Number of repetitions of the Quantum Circuit
Now we actually add some gates to the circuit. Here a Hadamard gate is added to the first qubit or the first qubit in the quantum register. Then a Controlled-X gate is added with two arguments as it is a two qubit gate.
57
+
Now we actually add some gates to the circuit. Here a Hadamard gate is added to the first qubit or the first qubit in the quantum register. Then a controlled-x gate is added with two arguments as it is a two qubit gate.
57
58
58
59
```python
59
-
circuit.h(qreg[0])
60
-
circuit.cx(qreg[1], qreg[0])
61
-
circuit.measure(range(2), range(2))
60
+
circuit.h(qreg[0])# Hadamard gate on the first qubit in the Quantum Register
61
+
circuit.cx(qreg[1], qreg[0])# Controlled-X gate between the second qubit and first qubit
62
+
circuit.measure_all() # Measure all qubits in the Quantum Register.
62
63
```
63
64
65
+
Note that [`measure_all()`](https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.measure_all.html) creates it's own [`ClassicalRegister`](https://qiskit.org/documentation/stubs/qiskit.circuit.ClassicalRegister.html)!
66
+
64
67
Now the circuit is created! If you wish you can see what your circuit looks like by adding a print statement `print(circuit.draw())` and quickly running the python script.
65
68
66
-
### Decomposing the circuit
69
+
##Setting the backend
67
70
68
-
The next step is to decompose the quantum circuit you've just created into it's *basis gates*. These basis gates are the actual quantum gates on the quantum computer. The process of decomposition involves turning the above Hadamard and Controlled-X gates into something that can be physically run on the quantum computer. Helmi's basis gates are the two-qubit Control-Z and a the one-qubit rotational gate around the x-y plane. In Qiskit these are defined by `basis_gates = ['r', 'cz']`.
71
+
First we need to set our provider and backend. The provider is the service which gives an interface to the quantum computer and the backend provides the tools necessary to submitting the quantum job. The `HELMI_CORTEX_URL` is the endpoint to reach Helmi and is only reachable inside the `q_fiqci` partition. This environment variable is set automatically when loading the `helmi_qiskit` module.
raiseValueError("Environment variable HELMI_CORTEX_URL is not set")
77
+
78
+
provider = IQMProvider(HELMI_CORTEX_URL)
79
+
backend = provider.get_backend()
80
+
```
81
+
### Decomposing the circuit (*Optional*)
82
+
83
+
The next step is optional and where the quantum circuit into you've just created into it's *basis gates*. These basis gates are the actual quantum gates on the quantum computer. The process of decomposition involves turning the above Hadamard and controlled-x gates into something that can be physically run on the quantum computer. Helmi's basis gates are the two-qubit controlled-z and a the one-qubit rotational gate around the x-y plane. In Qiskit these are defined in the backend and can be printed with `backend.operation_names`.
You can also print your circuit like before with `print(circuit_decomposed.draw())` to see what it looks like!
75
89
76
-
### Qubit Mapping
90
+
### *Optional*Qubit Mapping
77
91
78
-
There is one more key piece of information that the Quantum Computer needs before being able to run. The Qubit Mapping. This is a python dictionary which simply states which *virtual* qubit should be mapped to which *real* qubit. The virtual qubits are the qubit's we've been using up until now, the real qubits are the ones on the quantum computer.
92
+
This is an optional step but may be useful to extracting the best out of the quantum computer. This is a python dictionary which simply states which qubits in the Quantum register should be mapped to which *physical* qubit.
79
93
80
94
```python
81
-
virtual_qubits = circuit_decomposed.qubits
82
95
qubit_mapping = {
83
-
virtual_qubits[0]: "QB1",
84
-
virtual_qubits[1]: "QB3",
96
+
qreg[0]: 0,
97
+
qreg[1]: 2,
85
98
}
86
99
```
87
100
88
-
The virtual qubits are obtained from our decomposed circuit. The qubit mapping is defined via a python dictionary. Here we are mapping the first virtual qubit to the first of Helmi's qubits, QB1. The second qubit is then mapped to QB3. This is where we have made use of Helmi's topology.
101
+
Here we are mapping the first qubit in the quantum register to the first of Helmi's qubits, QB1, located at the zeroth location due to Qiskit's use of zero-indexing. The second qubit is then mapped to QB3. This is where we have made use of Helmi's topology.
The two qubit Controlled-X gate we implemented in our circuit is currently on the second of our two virtual qubits, `virtual_qubits[1]`. Due to Helmi's topology this needs to be mapped to QB3 on Helmi. The 1 qubit Hadamard gate can be mapped to any of the *outer* qubits, QB1, QB2, QB4, QB5, here we choose QB1.
108
+
The two qubit Controlled-X gate we implemented in our circuit is currently on the second of our two qubits in the Quantum register, `qreg[1]`. Due to Helmi's topology this needs to be mapped to QB3 on Helmi. The 1 qubit Hadamard gate can be mapped to any of the *outer* qubits, QB1, QB2, QB4, QB5, here we choose QB1.
96
109
97
-
Now we're ready to submit it to the Quantum Computer!
110
+
Note that this step is entirely optional. Using the `execute` function automatically does the mapping based on the information stored in the backend. Inputting the qubit mapping simply gives more control to the user.
98
111
99
112
### Submitting the job
100
113
101
-
First we need to set our provider and backend. The provider is the service which gives an interface to the quantum computer and the backend provides the tools necessary to submitting the quantum job.
102
-
103
-
```python
104
-
provider = Helmi()
105
-
backend = provider.set_backend()
106
-
```
107
-
108
-
Before submitting the job there is one last thing we need to do: define the number of *shots*. The number of shots is the number of repetition of a quantum circuit. We do this because quantum computers are probabilistic machines and by repeating the result many times we can get close to a deterministic result to be able to draw conclusions from. A good number of shots for accurate results is `shots = 1000`.
@@ -135,7 +141,7 @@ Once you've made your first quantum program remember to save! CTRL+X then Y to s
135
141
To run your quantum programme on LUMI you will need to submit the job through the SLURM batch scheduler on LUMI. Accessing Helmi is done through the `q_fiqci` partition. In the same directory where you have saved your quantum program, you can submit the job to SLURM using:
@@ -158,7 +164,7 @@ This submits the job *interactively* meaning that the output will be printed str
158
164
module use /appl/local/quantum/modulefiles
159
165
module load helmi_qiskit
160
166
161
-
python -u my-first-quantum-job.py
167
+
python -u first_quantum_job.py
162
168
```
163
169
This can be submitted with `sbatch batch_script.sh` in the same directory as your python file. Jobs in the SLURM queue can be monitored through `squeue -u username` and after the job has completed your results can be found in the `helmijob.oxxxxx` file. This can be printed to the terminal with `cat`.
164
170
@@ -170,40 +176,47 @@ Congratulations! You have just run your first job on Helmi.
170
176
The full python script can be found below.
171
177
172
178
```python
173
-
import qiskit
174
-
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
175
-
from qiskit.compiler import transpile
176
-
import numpy as np
177
-
from csc_qu_tools.qiskit import Helmi
179
+
import os
178
180
179
-
qreg = QuantumRegister(2, "qB")
180
-
creg = ClassicalRegister(2, "c")
181
-
circuit = QuantumCircuit(qreg, creg)
181
+
from qiskit import QuantumCircuit, QuantumRegister
0 commit comments