diff --git a/docs/accounts/billing.md b/docs/accounts/billing.md index 89ac148b81..95b864c1de 100644 --- a/docs/accounts/billing.md +++ b/docs/accounts/billing.md @@ -18,7 +18,6 @@ at research.csc.fi. data stored in Allas is billed. * [Pouta billing](../cloud/pouta/accounting.md) * [Rahti billing](../cloud/rahti/billing.md) -* [Kvasi billing](../computing/quantum-computing/kvasi/kvasi-billing.md) * [SD Connect and SD Desktop billing](../data/sensitive-data/sd-use-case-new-user-project-manager.md#sd-connect-bu-consumption) diff --git a/docs/accounts/index.md b/docs/accounts/index.md index 415c1a6415..0a7c1bda02 100644 --- a/docs/accounts/index.md +++ b/docs/accounts/index.md @@ -14,7 +14,7 @@ The Project Manager is typically a leader of a research team or other senior res * **Billing Units** (BUs) are used to allocate resources to users' projects. You can apply for Billing Units in [MyCSC](https://my.csc.fi) portal and CSC grants BUs to projects. [Usage consumes billing units](billing.md) but **no actual payment** is required. However, the amount of billing units must always remain positive. -* **LUMI projects** used to manage access to LUMI and the resources provided by it. LUMI projects are restricted to LUMI environment only (LUMI-C, LUMI-G etc.). Finnish LUMI projects are fixed in time and resources, and the total resources must be defined already in the project application. Lumi projects are also used for [Helmi quantum computer](../computing/quantum-computing/helmi/helmi-from-lumi.md). For further information please see [these instructions](https://www.lumi-supercomputer.eu/get-started-2021/users-in-finland/){:target="_blank"}. +* **LUMI projects** used to manage access to LUMI and the resources provided by it. LUMI projects are restricted to LUMI environment only (LUMI-C, LUMI-G etc.). Finnish LUMI projects are fixed in time and resources, and the total resources must be defined already in the project application. Lumi projects are also used for [FiQCI quantum computers](../computing/quantum-computing/access.md). For further information please see [these instructions](https://www.lumi-supercomputer.eu/get-started-2021/users-in-finland/){:target="_blank"}. * **My.csc.fi portal** MyCSC is the self-service CSC customer portal for research and education customers and end-users. MyCSC is also available for any other CSC customer or end-user, if they have CSC user accounts according to the CSCID policies. MyCSC portal offers users the functionality for registering CSC user accounts, creating computing or data projects, adding members to projects, and applying resources for projects. Users can also manage their projects and project lifecycles through MyCSC, and they can see the resources consumption and amount of stored data there. diff --git a/docs/apps/cirq-on-iqm.md b/docs/apps/cirq-on-iqm.md index ddd7b4cc83..7337700b68 100644 --- a/docs/apps/cirq-on-iqm.md +++ b/docs/apps/cirq-on-iqm.md @@ -14,8 +14,8 @@ catalog: # Cirq-on-iqm Cirq on IQM is an open-source cirq adapter for IQM quantum computers. It is -installed as `fiqci-vtt-cirq` on LUMI. It is used for running quantum circuits on -[Helmi](../computing/quantum-computing/helmi/running-on-helmi.md). +installed as `fiqci-vtt-cirq` on LUMI. It is used for running quantum circuits on the +[quantum computers](../computing/quantum-computing/running-quantum-jobs.md). ## Available @@ -23,7 +23,7 @@ Currently supported [cirq-on-iqm](https://iqm-finland.github.io/cirq-on-iqm/) ve | Version | Module | LUMI | Notes | |:--------|:-------------------------------------|:-----:|-----------------| -| 15.2 | `fiqci-vtt-cirq/15.2` | X | | +| 16.2 | `fiqci-vtt-cirq/16.2` | X | | All modules are based on Tykky using LUMI-container-wrapper. @@ -61,14 +61,14 @@ module avail fiqci-vtt-cirq ### Example batch script -Example batch script for running a quantum job on Helmi: +Example batch script for running a quantum job: ```bash title="LUMI" #!/bin/bash -l -#SBATCH --job-name=helmijob # Job name -#SBATCH --output=helmijob.o%j # Name of stdout output file -#SBATCH --error=helmijob.e%j # Name of stderr error file +#SBATCH --job-name=quantumjob # Job name +#SBATCH --output=quantumjob.o%j # Name of stdout output file +#SBATCH --error=quantumjob.e%j # Name of stderr error file #SBATCH --partition=q_fiqci # Partition (queue) name #SBATCH --ntasks=1 # One task (process) #SBATCH --cpus-per-task=1 # Number of cores (threads) @@ -79,6 +79,9 @@ Example batch script for running a quantum job on Helmi: module use /appl/local/quantum/modulefiles module load fiqci-vtt-cirq +export DEVICES=("Q5") #export DEVICES=("Q5" "Q50") to use Helmi and Q50 +source $RUN_SETUP + python -u quantum_job.py ``` @@ -87,4 +90,4 @@ Submit the script with `sbatch .sh`. ## More information - [Cirq-IQM documentation](https://iqm-finland.github.io/cirq-on-iqm/user_guide.html) -- [Quantum-Computing](../computing/quantum-computing/helmi/running-on-helmi.md) +- [Quantum-Computing](../computing/quantum-computing/running-quantum-jobs.md) diff --git a/docs/apps/qiskit-on-iqm.md b/docs/apps/qiskit-on-iqm.md index 0e6ed07892..6c71325b99 100644 --- a/docs/apps/qiskit-on-iqm.md +++ b/docs/apps/qiskit-on-iqm.md @@ -14,8 +14,8 @@ catalog: # Qiskit-on-iqm Qiskit on IQM is an open-source qiskit adapter for IQM quantum computers. It is -installed as `fiqci-vtt-qiskit` on LUMI. It is used for running quantum circuits on -[Helmi](../computing/quantum-computing/helmi/running-on-helmi.md). +installed as `fiqci-vtt-qiskit` on LUMI. It is used for running quantum circuits on the +[quantum computers](../computing/quantum-computing/running-quantum-jobs.md). ## Available @@ -25,7 +25,7 @@ versions: | Version | Module | LUMI | Notes | |:--------|:-------------------------------------|:-----:|-----------------| -| 15.5 | `fiqci-vtt-qiskit/15.5` | X | | +| 17.8 | `fiqci-vtt-qiskit/17.8` | X | | All modules are based on Tykky using LUMI-container-wrapper. Wrapper scripts have been provided so that common commands such as `python`, @@ -62,14 +62,14 @@ module avail fiqci-vtt-qiskit ### Example batch script -Example batch script for running a quantum job on Helmi: +Example batch script for running a quantum job: ```bash title="LUMI" #!/bin/bash -l -#SBATCH --job-name=helmijob # Job name -#SBATCH --output=helmijob.o%j # Name of stdout output file -#SBATCH --error=helmijob.e%j # Name of stderr error file +#SBATCH --job-name=quantumjob # Job name +#SBATCH --output=quantumjob.o%j # Name of stdout output file +#SBATCH --error=quantumjob.e%j # Name of stderr error file #SBATCH --partition=q_fiqci # Partition (queue) name #SBATCH --ntasks=1 # One task (process) #SBATCH --cpus-per-task=1 # Number of cores (threads) @@ -79,7 +79,8 @@ Example batch script for running a quantum job on Helmi: module use /appl/local/quantum/modulefiles module load fiqci-vtt-qiskit - +export DEVICES=("Q5") #export DEVICES=("Q5" "Q50") to use Helmi and Q50 +source $RUN_SETUP python -u quantum_job.py ``` @@ -88,4 +89,4 @@ Submit the script with `sbatch .sh`. ## More information - [Qiskit-IQM documentation](https://iqm-finland.github.io/qiskit-on-iqm/) -- [Quantum-Computing](../computing/quantum-computing/helmi/running-on-helmi.md) +- [Quantum-Computing](../computing/quantum-computing/running-quantum-jobs.md) diff --git a/docs/apps/qiskit.md b/docs/apps/qiskit.md index 09068c0a9c..edec2f51b6 100644 --- a/docs/apps/qiskit.md +++ b/docs/apps/qiskit.md @@ -17,8 +17,8 @@ catalog: Qiskit is an open-source software for working with quantum computers at the level of circuits, pulses, and algorithms. This page contains information in regard to running Quantum simulations using qiskit inside of a singularity container. -For information pertaining to running jobs on Helmi using qiskit please refer to this documentation: -[Running on Helmi](../computing/quantum-computing/helmi/running-on-helmi.md). +For information pertaining to running jobs on the physical quantum computers using qiskit please refer to this documentation: +[Running quantum jobs](../computing/quantum-computing/running-quantum-jobs.md). !!! info "News" **19.02.2025** Installed `qiskit/1.3.2` in a singularity container on LUMI with all major Qiskit packages and diff --git a/docs/computing/available-systems.md b/docs/computing/available-systems.md index a0270ff7b0..6663fc19f4 100644 --- a/docs/computing/available-systems.md +++ b/docs/computing/available-systems.md @@ -1,7 +1,7 @@ # Systems CSC's computing environment consists of supercomputers Puhti and -Mahti, and the quantum learning machine Kvasi. Puhti and Mahti have a +Mahti. Puhti and Mahti have a fairly similar compute environment, and there is a wide range of workloads that can utilize both efficiently. At the same time their hardware is different, and this makes some worklods uniquely suitable diff --git a/docs/computing/quantum-computing/access.md b/docs/computing/quantum-computing/access.md new file mode 100644 index 0000000000..745b9d2282 --- /dev/null +++ b/docs/computing/quantum-computing/access.md @@ -0,0 +1,20 @@ +# Setting up a LUMI project and accounts for accessing the Quantum computers + +This page outlines the steps to set up a LUMI account and project for accessing the **Helmi(VTT Q5)** and **VTT Q50** quantum computers. It is assumed that you have some knowledge of supercomputing systems. If you're new, start with the [overview of CSC supercomputers](../../computing/index.md). + +To access Helmi or Q50, you must first create a LUMI project with quantum computing resources: [Quantum Projects on LUMI](projects.md). + +Once the project is created, the **Principal Investigator (PI)** can invite other users: [How to add members to project](../../accounts/how-to-add-members-to-project.md) + +The project PI is responsible for ensuring that the [Helmi Terms of Use](https://a3s.fi/FiQCI/Helmi-Terms-of-Use-2022.pdf) or [Q50 Terms of Use](https://a3s.fi/FiQCI/VTT_Quantum_Academic_Use_EULA.pdf) are followed. + +## Connect to LUMI + +Follow the official instructions to connect to the LUMI system: [Connecting to LUMI – Official Documentation](https://docs.lumi-supercomputer.eu/firststeps/). + +Details for running jobs on the quantum computers through LUMI can found in the [Running quantum jobs](running-quantum-jobs.md) page. + +## Support channels + +For support with access via LUMI, contact the [CSC Service Desk](../../support/contact.md), reachable at servicedesk@csc.fi. + diff --git a/docs/computing/quantum-computing/fiqci-partition.md b/docs/computing/quantum-computing/fiqci-partition.md new file mode 100644 index 0000000000..e75697f2ec --- /dev/null +++ b/docs/computing/quantum-computing/fiqci-partition.md @@ -0,0 +1,49 @@ +# Specific instructions for the FiQCI partition on LUMI + +The FiQCI partition within LUMI provides access to quantum processing units (QPUs) for users belonging to projects with allocated QPU resources. In addition to executing quantum workloads via LUMI, users can leverage the full LUMI infrastructure, including its software stack and quantum simulators, for development, testing, and hybrid quantum-classical workflows. + +!!! info "View status of the quantum computers" + You can check the status of the connection here: [https://fiqci.fi/status](https://fiqci.fi/status) + + +## LUMI Quantum Computing projects vs. regular LUMI projects + +Quantum computing projects are slightly different from standard LUMI projects. The main difference is, that you will +need to apply for quantum resources in addition to CPU, GPU, and storage. + + +## The FiQCI partition `q_fiqci` + +Access to the quantum computers is only available through the FiQCI partition on LUMI, which provides a direct connection between a [LUMI-C +node](https://docs.lumi-supercomputer.eu/hardware/lumic/) and the Fiqci quantum computers. + +* [Further details on LUMI nodes](https://docs.lumi-supercomputer.eu/hardware/) + +There is one queue in the LUMI partition corresponding to FiQCI projects: `q_fiqci`. +Currently, the maximum run time of a quantum job is 2 hours. + +| Name | Max walltime | Max jobs | +| --------- | ------------ | -------- | +| _q_fiqci_ | _2 hours_ | _64_ | + + +## Storage areas + +The `q_fiqci` partition uses the same storage policies as LUMI. You can find [further details on LUMI Storage here](https://docs.lumi-supercomputer.eu/storage/). + +## Usage and Billing + +Quantum computing projects work similarly to the regular LUMI system. The main differences are: + +1. FiQCI projects use the `--partition=q_fiqci` partition instead of the regular LUMI-C `--partition=standard` and `--partition=small`. +2. The maximum job walltime is **2 hours**. +3. Usage is billed as QPU seconds **QPUs** in `q_fiqci`. +4. The LUMI-Fiqci computing environment has to be loaded separately. See [Running on quantum jobs](./running-quantum-jobs.md) for details. + +Presently, running through the `q_fiqci` queue will consume QPU seconds for the amount of wall-time spent running in the `q_fiqci` queue. + +!!! success "Querying your used QPUs" + You can check your used QPUs using the `lumi-allocations` tool. + + +Support can be reached via the [CSC Service Desk](../../support/contact.md). Note that presently, user support is limited to technical issues. diff --git a/docs/computing/quantum-computing/first-quantum-job.md b/docs/computing/quantum-computing/first-quantum-job.md new file mode 100644 index 0000000000..55383db17e --- /dev/null +++ b/docs/computing/quantum-computing/first-quantum-job.md @@ -0,0 +1,430 @@ +# Running your first quantum computing job on the Quantum computers through LUMI + +If you've applied for a project, been accepted, setup your ssh keys and gained access to LUMI, then the next step is to run your first quantum computing job on a real quantum computer! This is a guide for exactly how to do that. The only thing you need to know is your project number! + +## Configuring the environment + +The first step after you have logged into LUMI (via `ssh lumi` on your terminal) is to configure the environment. The base environment when first logging into LUMI does not provide the necessary tools to submit quantum jobs, therefore a quantum software stack has been created which sets up the correct python virtual environments and the correct environment variables. This is accessed through the LMOD system on LUMI using *modules*. + +To use the quantum software stack you first need to load the Quantum module tree. + +```bash +module use /appl/local/quantum/modulefiles +``` + +Alternatively, you can achieve the same result by loading the Local-quantum module. + +```bash +module load Local-quantum +``` + +You can then see the list of available *modules* with `module avail`. The quantum modules should be at the top! In this walkthrough Qiskit will be used, therefore the next step is to load the module into our current environment with + +```bash +module load fiqci-vtt-qiskit +``` + +## Creating your first quantum program + +The next step is to create your quantum circuit! Here a simple bell state will be created between two qubits, demonstrating entanglement between them! For this we will be using Qiskit but the steps are very similar for Cirq. It is good practice to work in your projects scratch directory, which you can navigate to with `cd /scratch/project_xxx`, inserting your project number. + +!!! info "Tip!" + + You can quickly see your LUMI workspaces with + `lumi-workspaces` + +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. + +### Importing the libraries + +First let's import the right python libraries + +```python +import os +from qiskit import QuantumCircuit, QuantumRegister, transpile +from iqm.qiskit_iqm import IQMProvider +``` + +### Creating the circuit + +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. + +```python +shots = 1000 # Number of repetitions of the Quantum Circuit + +qreg = QuantumRegister(2, "qB") +circuit = QuantumCircuit(qreg, name='Bell pair 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. + +```python +circuit.h(qreg[0]) # Hadamard gate on the first qubit in the Quantum Register +circuit.cx(qreg[1], qreg[0]) # Controlled-X gate between the second qubit and first qubit +circuit.measure_all() # Measure all qubits in the Quantum Register. +``` + +Note that [`measure_all()`](https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.html#qiskit.circuit.QuantumCircuit.measure_all) creates it's own [`ClassicalRegister`](https://qiskit.org/documentation/stubs/qiskit.circuit.ClassicalRegister.html)! + +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. + +## Setting the backend + +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(the 5 qubit machine) and is only reachable inside the `q_fiqci` partition, while the `Q50_CORTEX_URL`is the endpoint to reach Q50(the 50 qubit machine). This environment variable is set automatically when loading any of the Quantum computing modules such as the `fiqci-vtt-qiskit` module. + +=== "Helmi" + ```python + # Accessing Helmi + + HELMI_CORTEX_URL = os.getenv('HELMI_CORTEX_URL') + provider_helmi = IQMProvider(HELMI_CORTEX_URL) + backend_helmi = provider_helmi.get_backend() + ``` + +=== "Q50" + ```python + # Accessing Q50 + + Q50_CORTEX_URL = os.getenv('Q50_CORTEX_URL') + provider_q50 = IQMProvider(Q50_CORTEX_URL) + backend_q50 = provider_q50.get_backend() + ``` + +=== "Multiple backends" + ```python + # It is possible to simultaneously run jobs on multiple backends + + HELMI_CORTEX_URL = os.getenv('HELMI_CORTEX_URL') + provider_helmi = IQMProvider(HELMI_CORTEX_URL) + backend_helmi = provider.get_backend() + + Q50_CORTEX_URL = os.getenv('Q50_CORTEX_URL') + provider_q50 = IQMProvider(Q50_CORTEX_URL) + backend_q50 = provider_q50.get_backend() + ``` + +### Transpiling the circuit + +This next step is where the quantum circuit you've just created is decomposed (transpiled) 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. For Helmi and Q50, the basis gates are the entangling gate controlled-z and the one-qubit phased-rx gate. In Qiskit these are defined in the backend and can be printed with `backend.operation_names`. For more on the specs see [Topology Overview](specs.md) + +```python +circuit_decomposed = transpile(circuit, backend=backend) +``` +You can also print your circuit like before with `print(circuit_decomposed.draw())` to see what it looks like! + +### *Optional* Qubit Mapping + +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. + +```python +qubit_mapping = { + qreg[0]: 0, + qreg[1]: 2, + } +``` + +As an example, 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 same process can be applied to other quantum computers e.g. Q50. + +
!["Helmi's node mapping"](../../img/helmi_mapping.png)
+ + +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. + +Note that this step is entirely optional. Using the `transpile` function automatically does the mapping based on the information stored in the backend. Inputting the qubit mapping manually simply gives more control to the user. + +To transpile a circuit using the specified qubit mapping you can do the following: + +```python +circuit_decomposed = transpile(circuit, backend=backend, initial_layout=qubit_mapping) +``` + +### Submitting the job + +Now we can run our quantum job! + +```python +job = backend.run(circuit_decomposed, shots=shots) +``` + +### Viewing the status of your job + +You can view the status of your job with + +```python +job.status() +``` + +### Results + +Before submitting we need to ensure we can get some results! The quantum job will return what are called **counts**. Counts are the accumulation of results from the 1000 times the circuit is submitted to the QPU. Each time the circuit is submitted a binary *state* is returned, this is then added to the tally. In this case as we are submitting a 2 qubit circuit there are 4 possible resulting states: `00, 11, 01, 10`. The expected results should be that approximately 50% of the counts should be in state `00` and 50% in state `11`. The states of the qubits are thus entangled: if one of the qubits is measured to be in state |0>, the other one will immediately also collapse to the same state, and vice versa. As real quantum computers are not perfect, you will most likely also see that some measurements find the states |01> and |10>. + +To print your results add: + +```python +counts = job.result().get_counts() +print(counts) +``` + +You can also print the entirety of `job.result()` which will contain all the information about your jobs results. + +## Save your file + +Once you've made your first quantum program remember to save! CTRL+X then Y to save your file. + +## Running the job through LUMI + +To run your quantum programme on LUMI you will need to submit the job through the SLURM batch scheduler on LUMI. Accessing the quantum computers (Helmi, Q50) 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: + +```bash +module use /appl/local/quantum/modulefiles +module --ignore_cache load "fiqci_vtt_qiskit" +export DEVICES=("Q50") +srun --account project_xxx -t 00:15:00 -c 1 -n 1 --partition q_fiqci bash -c "source $RUN_SETUP && python -u first_quantum_job.py" +``` + +Remember to add your own project account! + +This submits the job *interactively* meaning that the output will be printed straight to the terminal screen. If you wish you can also submit it using `sbatch` using this skeleton batch script. Using `nano` as before create the script `batch_script.sh`. + + +=== "Helmi" + ```bash + #!/bin/bash -l + + #SBATCH --job-name=quantumjob # Job name + #SBATCH --output=quantumjob.o%j # Name of stdout output file + #SBATCH --error=quantumjob.e%j # Name of stderr error file + #SBATCH --partition=q_fiqci # Partition (queue) name + #SBATCH --ntasks=1 # One task (process) + #SBATCH --mem-per-cpu=2G # memory allocation + #SBATCH --cpus-per-task=1 # Number of cores (threads) + #SBATCH --time=00:05:00 # Run time (hh:mm:ss) + #SBATCH --account=project_xxx # Project for billing + + module use /appl/local/quantum/modulefiles + module load fiqci-vtt-qiskit + + export DEVICES=("Q5") + + source $RUN_SETUP + + python -u first_quantum_job.py + ``` + +=== "Q50" + ```bash + #!/bin/bash -l + + #SBATCH --job-name=quantumjob # Job name + #SBATCH --output=quantumjob.o%j # Name of stdout output file + #SBATCH --error=quantumjob.e%j # Name of stderr error file + #SBATCH --partition=q_fiqci # Partition (queue) name + #SBATCH --ntasks=1 # One task (process) + #SBATCH --mem-per-cpu=2G # memory allocation + #SBATCH --cpus-per-task=1 # Number of cores (threads) + #SBATCH --time=00:05:00 # Run time (hh:mm:ss) + #SBATCH --account=project_xxx # Project for billing + + module use /appl/local/quantum/modulefiles + module load fiqci-vtt-qiskit + + export DEVICES=("Q50") + + source $RUN_SETUP + + python -u first_quantum_job.py + ``` + +=== "Multiple backends" + ```bash + #!/bin/bash -l + + #SBATCH --job-name=quantumjob # Job name + #SBATCH --output=quantumjob.o%j # Name of stdout output file + #SBATCH --error=quantumjob.e%j # Name of stderr error file + #SBATCH --partition=q_fiqci # Partition (queue) name + #SBATCH --ntasks=1 # One task (process) + #SBATCH --mem-per-cpu=2G # memory allocation + #SBATCH --cpus-per-task=1 # Number of cores (threads) + #SBATCH --time=00:05:00 # Run time (hh:mm:ss) + #SBATCH --account=project_xxx # Project for billing + + module use /appl/local/quantum/modulefiles + module load fiqci-vtt-qiskit + + export DEVICES=("Q5" "Q50") + + source $RUN_SETUP + + python -u first_quantum_job.py + ``` + +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 `quantumjob.oxxxxx` file. This can be printed to the terminal with `cat`. +To run on both Helmi and Q50 or Q50 alone you will need to specify the devices that you require. Here `Q5` represents Helmi and `Q50`represents the 50 qubit machine. + + +## Congratulations! + +Congratulations! You have just run your first job on a quantum computer. + +The full python script can be found below. + +=== "Helmi" + ```python + import os + + from qiskit import QuantumCircuit, QuantumRegister, transpile + from iqm.qiskit_iqm import IQMProvider + + shots = 1000 + + qreg = QuantumRegister(2, "QB") + circuit = QuantumCircuit(qreg, name='Bell pair circuit') + + circuit.h(qreg[0]) + circuit.cx(qreg[0], qreg[1]) + circuit.measure_all() + + # Uncomment if you wish to print the circuit + # print(circuit.draw()) + + HELMI_CORTEX_URL = os.getenv('HELMI_CORTEX_URL') + + provider_helmi = IQMProvider(HELMI_CORTEX_URL) + backend_helmi = provider_helmi.get_backend() + + # Retrieving backend information + # print(f'Native operations: {backend_helmi.operation_names}') + # print(f'Number of qubits: {backend_helmi.num_qubits}') + # print(f'Coupling map: {backend_helmi.coupling_map}') + + transpiled_circuit = transpile(circuit, backend_helmi) + + job = backend.run(transpiled_circuit, shots=shots) + result = job.result() + + # You can retrieve the job at a later date with backend.retrieve_job(job_id) + # Uncomment the following lines to get more information about your submitted job + # print("Job ID: ", job.job_id()) + # print(result.request.circuits) + # exp_result = job.result()._get_experiment(circuit) + # print("Calibration Set ID: ", exp_result.calibration_set_id) + # print(result.request.qubit_mapping) + # print(result.request.shots) + + counts = result.get_counts() + print(counts) + ``` + +=== "Q50" + ```python + import os + + from qiskit import QuantumCircuit, QuantumRegister, transpile + from iqm.qiskit_iqm import IQMProvider + + shots = 1000 + + qreg = QuantumRegister(2, "QB") + circuit = QuantumCircuit(qreg, name='Bell pair circuit') + + circuit.h(qreg[0]) + circuit.cx(qreg[0], qreg[1]) + circuit.measure_all() + + # Uncomment if you wish to print the circuit + # print(circuit.draw()) + + Q50_CORTEX_URL = os.getenv('Q50_CORTEX_URL') + + provider_q50 = IQMProvider(Q50_CORTEX_URL) + backend_q50 = provider_q50.get_backend() + + # Retrieving backend information + # print(f'Native operations: {backend_q50.operation_names}') + # print(f'Number of qubits: {backend_q50.num_qubits}') + # print(f'Coupling map: {backend_q50.coupling_map}') + + transpiled_circuit = transpile(circuit, backend_q50) + + job = backend_q50.run(transpiled_circuit, shots=shots) + result = job.result() + + # You can retrieve the job at a later date with backend.retrieve_job(job_id) + # Uncomment the following lines to get more information about your submitted job + # print("Job ID: ", job.job_id()) + # print(result.request.circuits) + # exp_result = job.result()._get_experiment(circuit) + # print("Calibration Set ID: ", exp_result.calibration_set_id) + # print(result.request.qubit_mapping) + # print(result.request.shots) + + counts = result.get_counts() + print(counts) + ``` + +=== "Multiple backends" + ```python + import os + + from qiskit import QuantumCircuit, QuantumRegister, transpile + from iqm.qiskit_iqm import IQMProvider + + shots = 1000 + + qreg = QuantumRegister(2, "QB") + circuit = QuantumCircuit(qreg, name='Bell pair circuit') + + circuit.h(qreg[0]) + circuit.cx(qreg[0], qreg[1]) + circuit.measure_all() + + # Uncomment if you wish to print the circuit + # print(circuit.draw()) + + HELMI_CORTEX_URL = os.getenv('HELMI_CORTEX_URL') + Q50_CORTEX_URL = os.getenv('Q50_CORTEX_URL') + + provider_helmi = IQMProvider(HELMI_CORTEX_URL) + backend_helmi = provider_helmi.get_backend() + + provider_q50 = IQMProvider(Q50_CORTEX_URL) + backend_q50= provider_q50.get_backend() + + + # Retrieving backend information + # print(f'Native operations: {backend.operation_names}') + # print(f'Number of qubits: {backend.num_qubits}') + # print(f'Coupling map: {backend.coupling_map}') + + transpiled_circuit_helmi = transpile(circuit, backend_helmi) + transpiled_circuit_q50 = transpile(circuit, backend_q50) + + job_helmi = backend_helmi.run(transpiled_circuit_helmi, shots=shots) + job_q50 = backend_q50.run(transpiled_circuit_q50, shots=shots) + + result_helmi = job_helmi.result() + result_q50 = job_q50.result() + + # You can retrieve the job at a later date with backend.retrieve_job(job_id) + # Uncomment the following lines to get more information about your submitted jobs + # print("Helmi Job ID: ", job_helmi.job_id()) + # print(result_helmi.request.circuits) + # exp_result_helmi = job_helmi.result()._get_experiment(circuit) + # print("Helmi Calibration Set ID: ", exp_result_helmi.calibration_set_id) + # print(result_helmi.request.qubit_mapping) + # print(result_helmi.request.shots) + + # print("Q50 job ID: ", job_q50.job_id()) + # print(result_q50.request.circuits) + # exp_result_q50 = job_q50.result()._get_experiment(circuit) + # print("Q50 Calibration Set ID: ", exp_result_q50.calibration_set_id) + # print(result_q50.request.qubit_mapping) + # print(result_q50.request.shots) + + counts_helmi = result_helmi.get_counts() + counts_q50 = result_q50.get_counts() + + print(f"Helmi results: {counts_helmi}") + print(f"Q50 results: {counts_q50}") + ``` \ No newline at end of file diff --git a/docs/computing/quantum-computing/helmi/fiqci-partition.md b/docs/computing/quantum-computing/helmi/fiqci-partition.md deleted file mode 100644 index a5a83345ad..0000000000 --- a/docs/computing/quantum-computing/helmi/fiqci-partition.md +++ /dev/null @@ -1,52 +0,0 @@ -# Specific instructions for the FiQCI partition on LUMI - -The FiQCI partition of LUMI provides access to the Helmi quantum computer. Access is granted for users belonging to projects that have been granted QPU resources. In addition to running jobs on Helmi via LUMI, users can also use the general LUMI system and software stack including using simulators. - -!!! info "View status of Helmi" - You can check the status of the connection here: [https://fiqci.fi/status](https://fiqci.fi/status) - - -## LUMI Helmi projects vs. regular LUMI projects - -Helmi projects are slightly different from standard LUMI projects. The main difference is, that you will -need to apply for quantum resources in addition to CPU, GPU, and storage. - -!!! info "Pilot Phase" - During the pilot phase, approved projects will get 24 hours of access to the FiQCI Partition. - [See the Call text for details](https://fiqci.fi/_posts/2022-11-01-Helmi-pilot/). - -## The FiQCI partition `q_fiqci` - -Access to Helmi is only available through the FiQCI partition on LUMI, which provides a direct connection between a [LUMI-C -node](https://docs.lumi-supercomputer.eu/hardware/lumic/) and Helmi. - -* [Further details on LUMI nodes](https://docs.lumi-supercomputer.eu/hardware/) - -There is one queue in the Helmi partition corresponding to FiQCI projects: `q_fiqci`. -Currently, the maximum run time of a quantum job is 2 hours. - -| Name | Max walltime | Max jobs | -| --------- | ------------ | -------- | -| _q_fiqci_ | _2 hours_ | _64_ | - - -## Storage areas - -The Helmi partition uses the same storage policies as LUMI. You can find [further details on LUMI Storage here](https://docs.lumi-supercomputer.eu/storage/). - -## Usage and Billing - -Quantum computing projects work similarly to the regular LUMI system. The main differences are: - -1. FiQCI projects use the `--partition=q_fiqci` partition instead of the regular LUMI-C `--partition=standard` and `--partition=small`. -2. The maximum job walltime is **2 hours**. -3. Usage is billed as QPU seconds **QPUs** in `q_fiqci`. -4. The LUMI-Helmi computing environment has to be loaded separately. See [Running on Helmi](./running-on-helmi.md) for details. - -Presently, running through the `q_fiqci` queue will consume QPU seconds for the amount of wall-time spent running in the `q_fiqci` queue. - -!!! success "Querying your used QPUs" - You can check your used QPUs using the `lumi-allocations` tool. - - -Helmi-specific support can be reached via the [CSC Service Desk](../../../support/contact.md). Note that presently, user support is limited to technical issues. diff --git a/docs/computing/quantum-computing/helmi/first-quantum-job.md b/docs/computing/quantum-computing/helmi/first-quantum-job.md deleted file mode 100644 index 4ae7ff976a..0000000000 --- a/docs/computing/quantum-computing/helmi/first-quantum-job.md +++ /dev/null @@ -1,234 +0,0 @@ -# Running your first quantum computing job on Helmi through LUMI - -If you've applied for a project, been accepted, setup your ssh keys and gained access to LUMI, then the next step is to run your first quantum computing job on a real quantum computer! This is a guide for exactly how to do that. The only thing you need to know is your project number! - -## Configuring the environment - -The first step after you have logged into LUMI (via `ssh lumi` on your terminal) is to configure the environment. The base environment when first logging into LUMI does not provide the necessary tools to submit quantum jobs, therefore a quantum software stack has been created which sets up the correct python virtual environments and the correct environment variables. This is accessed through the LMOD system on LUMI using *modules*. - -To use the quantum software stack you first need to load the Quantum module tree. - -```bash -module use /appl/local/quantum/modulefiles -``` - -Alternatively, you can achieve the same result by loading the Local-quantum module. - -```bash -module load Local-quantum -``` - -You can then see the list of available *modules* with `module avail`. The quantum modules should be at the top! In this walkthrough Qiskit will be used, therefore the next step is to load the module into our current environment with - -```bash -module load fiqci-vtt-qiskit -``` - -## Creating your first quantum program - -The next step is to create your quantum circuit! Here a simple bell state will be created between two qubits, demonstrating entanglement between them! For this we will be using Qiskit but the steps are very similar for Cirq. It is good practice to work in your projects scratch directory, which you can navigate to with `cd /scratch/project_xxx`, inserting your project number. - -!!! info "Tip!" - - You can quickly see your LUMI workspaces with - `module load lumi-workspaces` and - `lumi-workspaces` - -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. - -### Importing the libraries - -First let's import the right python libraries - -```python -import os -from qiskit import QuantumCircuit, QuantumRegister, transpile -from iqm.qiskit_iqm import IQMProvider -``` - -### Creating the circuit - -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. - -```python -shots = 1000 # Number of repetitions of the Quantum Circuit - -qreg = QuantumRegister(2, "qB") -circuit = QuantumCircuit(qreg, name='Bell pair 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. - -```python -circuit.h(qreg[0]) # Hadamard gate on the first qubit in the Quantum Register -circuit.cx(qreg[1], qreg[0]) # Controlled-X gate between the second qubit and first qubit -circuit.measure_all() # Measure all qubits in the Quantum Register. -``` - -Note that [`measure_all()`](https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.html#qiskit.circuit.QuantumCircuit.measure_all) creates it's own [`ClassicalRegister`](https://qiskit.org/documentation/stubs/qiskit.circuit.ClassicalRegister.html)! - -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. - -## Setting the backend - -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 any of the Quantum computing modules such as the `fiqci-vtt-qiskit` module. - -```python -HELMI_CORTEX_URL = os.getenv('HELMI_CORTEX_URL') - -provider = IQMProvider(HELMI_CORTEX_URL) -backend = provider.get_backend() -``` -### Decomposing the circuit (*Optional*) - -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 entangling gate controlled-z and the one-qubit phased-rx gate. In Qiskit these are defined in the backend and can be printed with `backend.operation_names`. - -```python -circuit_decomposed = transpile(circuit, backend=backend) -``` -You can also print your circuit like before with `print(circuit_decomposed.draw())` to see what it looks like! - -### *Optional* Qubit Mapping - -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. - -```python -qubit_mapping = { - qreg[0]: 0, - qreg[1]: 2, - } -``` - -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. - -

- Helmi's node mapping -

- - -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. - -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. - -To transpile a circuit using the specified qubit mapping you can do the following: - -```python -circuit_decomposed = transpile(circuit, backend=backend, initial_layout=qubit_mapping) -``` - -### Submitting the job - -Now we can run our quantum job! - -```python -job = backend.run(circuit_decomposed, shots=shots) -``` - -### Viewing the status of your job - -You can view the status of your job with - -```python -job.status() -``` - -### Results - -Before submitting we need to ensure we can get some results! The quantum job will return what are called **counts**. Counts are the accumulation of results from the 1000 times the circuit is submitted to the QPU. Each time the circuit is submitted a binary *state* is returned, this is then added to the tally. In this case as we are submitting a 2 qubit circuit there are 4 possible resulting states: `00, 11, 01, 10`. The expected results should be that approximately 50% of the counts should be in state `00` and 50% in state `11`. The states of the qubits are thus entangled: if one of the qubits is measured to be in state |0>, the other one will immediately also collapse to the same state, and vice versa. As real quantum computers are not perfect, you will most likely also see that some measurements find the states |01> and |10>. - -To print your results add: - -```python -counts = job.result().get_counts() -print(counts) -``` - -You can also print the entirety of `job.result()` which will contain all the information about your jobs results. - -## Save your file - -Once you've made your first quantum program remember to save! CTRL+X then Y to save your file. - -## Running the job through LUMI - -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: - -```bash -srun --account project_xxx -t 00:15:00 -c 1 -n 1 --partition q_fiqci python -u first_quantum_job.py -``` - -Remember to add your own project account! - -This submits the job *interactively* meaning that the output will be printed straight to the terminal screen. If you wish you can also submit it using `sbatch` using this skeleton batch script. Using `nano` as before create the script `batch_script.sh`. - - -```bash -#!/bin/bash -l - -#SBATCH --job-name=helmijob # Job name -#SBATCH --output=helmijob.o%j # Name of stdout output file -#SBATCH --error=helmijob.e%j # Name of stderr error file -#SBATCH --partition=q_fiqci # Partition (queue) name -#SBATCH --ntasks=1 # One task (process) -#SBATCH --mem-per-cpu=2G # memory allocation -#SBATCH --cpus-per-task=1 # Number of cores (threads) -#SBATCH --time=00:15:00 # Run time (hh:mm:ss) -#SBATCH --account=project_xxx # Project for billing - -module use /appl/local/quantum/modulefiles -module load fiqci-vtt-qiskit - -python -u first_quantum_job.py -``` -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`. - - -## Congratulations! - -Congratulations! You have just run your first job on Helmi. - -The full python script can be found below. - -```python -import os - -from qiskit import QuantumCircuit, QuantumRegister, transpile -from iqm.qiskit_iqm import IQMProvider - -shots = 1000 - -qreg = QuantumRegister(2, "QB") -circuit = QuantumCircuit(qreg, name='Bell pair circuit') - -circuit.h(qreg[0]) -circuit.cx(qreg[0], qreg[1]) -circuit.measure_all() - -# Uncomment if you wish to print the circuit -# print(circuit.draw()) - -HELMI_CORTEX_URL = os.getenv('HELMI_CORTEX_URL') - -provider = IQMProvider(HELMI_CORTEX_URL) -backend = provider.get_backend() - -# Retrieving backend information -# print(f'Native operations: {backend.operation_names}') -# print(f'Number of qubits: {backend.num_qubits}') -# print(f'Coupling map: {backend.coupling_map}') - -transpiled_circuit = transpile(circuit, backend) -job = backend.run(transpiled_circuit, shots=shots) -result = job.result() -exp_result = job.result()._get_experiment(circuit) -# You can retrieve the job at a later date with backend.retrieve_job(job_id) -# Uncomment the following lines to get more information about your submitted job -# print("Job ID: ", job.job_id()) -# print(result.request.circuits) -# print("Calibration Set ID: ", exp_result.calibration_set_id) -# print(result.request.qubit_mapping) -# print(result.request.shots) - -counts = result.get_counts() -print(counts) -``` diff --git a/docs/computing/quantum-computing/helmi/helmi-from-lumi.md b/docs/computing/quantum-computing/helmi/helmi-from-lumi.md deleted file mode 100644 index 2531550446..0000000000 --- a/docs/computing/quantum-computing/helmi/helmi-from-lumi.md +++ /dev/null @@ -1,24 +0,0 @@ -# Setting up a LUMI project and accounts for accessing Helmi - -This page goes through the steps required for setting up an account on LUMI for accessing the Helmi quantum computer. It is assumed that you have some knowledge of supercomputing systems. If not, you can start by looking at [overview of CSC supercomputers](../../../computing/index.md). - -## Access to Helmi through LUMI - -You first need to create a Helmi project according to the instructions here: [Helmi Projects on LUMI](helmi-projects.md). - -After creation of a project, the PI can invite additional standard users to the project: - -* [How to add members to project](../../../accounts/how-to-add-members-to-project.md) - -The project PI is responsible for ensuring that the [Helmi Terms of Use](https://a3s.fi/FiQCI/Helmi-Terms-of-Use-2022.pdf) are followed. - -## Connecting to LUMI - -Details for connecting to LUMI can be read through the [LUMI Documentation page](https://docs.lumi-supercomputer.eu/firststeps/). - -Details for running jobs on Helmi through lumi can found in the [Running on Helmi](running-on-helmi.md) page. - -## Support channels - -The main channel for support for Helmi use through LUMI is the [CSC Service Desk](../../../support/contact.md), reachable at servicedesk@csc.fi. - diff --git a/docs/computing/quantum-computing/helmi/helmi-projects.md b/docs/computing/quantum-computing/helmi/helmi-projects.md deleted file mode 100644 index 89a4e19e68..0000000000 --- a/docs/computing/quantum-computing/helmi/helmi-projects.md +++ /dev/null @@ -1,40 +0,0 @@ -# Helmi Projects on LUMI - -Helmi is accessed through the LUMI environment. Users accessing Helmi need to be part of a -LUMI project with allocated quantum computing resources. The first step is to create a -LUMI project. All LUMI projects require a Principal Investigator serving as the Project Manager. -A LUMI Project Manager is typically a leader of a research team or other senior researcher. - -**The connection to Helmi through LUMI is now accepting pilot phase projects**. - -!!! info "Open Call for pilot phase projects" - Pilot phase projects for researchers in Finnish higher-education institutions and research organisations is now open. - [See the Call text here](https://fiqci.fi/_posts/2022-11-01-Helmi-pilot/) - -* During the pilot phase, approved projects will get 24 hours of access to the FiQCI Quantum Partition, `q_fiqci`. -* Max run time for a single job is 15 minutes. -* You will need to read and accept the Helmi General Terms of Use and adhere to export restrictions. -* More details in the [Call text](https://fiqci.fi/_posts/2022-11-01-Helmi-pilot/). - - -Detailed instructions on the process of creating a general LUMI project via MyCSC are here: - -* [Creating a LUMI project and applying for resources](../../../accounts/how-to-create-new-project.md#how-to-create-finnish-lumi-projects) - - -Note that during the pilot phase, access is provided "as is", without guarantees of any specific functionality. -One aim of the pilot phase is to, together with the users, develop the service further and make it -as usable and powerful as possible. **All feedback is highly appreciated**, please comment on your -experience to [fiqci-feedback@postit.csc.fi](mailto:fiqci-feedback@postit.csc.fi). - -!!! info "Getting Started" - To get started with Helmi see - [Access Helmi through LUMI](helmi-from-lumi.md). - -## Further reading: - -* [Description of Helmi's Topology](helmi-specs.md). -* [Specific instructions for the LUMI Helmi partition](fiqci-partition.md) -* [Running jobs on Helmi](running-on-helmi.md) -* [LUMI Documentation page](https://docs.lumi-supercomputer.eu/) - diff --git a/docs/computing/quantum-computing/helmi/running-on-helmi.md b/docs/computing/quantum-computing/helmi/running-on-helmi.md deleted file mode 100644 index 0c8ae54eeb..0000000000 --- a/docs/computing/quantum-computing/helmi/running-on-helmi.md +++ /dev/null @@ -1,242 +0,0 @@ -# Running on Helmi - -!!! info "Give feedback!" - **All feedback is highly appreciated**, please comment on your - experience to [fiqci-feedback@postit.csc.fi](mailto:fiqci-feedback@postit.csc.fi). - -## Running Jobs - -Jobs can be submitted to the `q_fiqci` queue by specifying `--partition=q_fiqci` in batch scripts. - -Helmi currently supports submitting jobs using Qiskit or Cirq. Qiskit and Cirq scripts can only be submitted as ordinary python files. -To submit and run jobs on Helmi you need to use the correct environment on LUMI. - -* First, run `module use /appl/local/quantum/modulefiles`. The available modules will now show up on `module avail`. -* Second, depending on if you want to use the Qiskit or Cirq environment, run: - * `module load fiqci-vtt-qiskit` or - * `module load fiqci-vtt-cirq` - - -`fiqci-vtt-qiskit` and `fiqci-vtt-cirq` provide pre-made python environments to directly run on Helmi. -If you wish to add your own python packages to the pre-made python environment you can do so with `python -m pip install --user package`. - - -!!! info "Creating your own python environment" - Users can create their own python environment if they wish. The only prerequisite is to load the `helmi_standard` module. - To create your own environment the [container wrapper tool](https://docs.lumi-supercomputer.eu/software/installing/container-wrapper/) is recommended. - -The current supported software versions on helmi are: - -| Software | Module_name | Versions | -|----------|-------------|----------| -| Cirq on IQM | cirq_iqm | 15.2 | -| Qiskit on IQM | qiskit_iqm | 15.5 | -| IQM client | iqm_client | >= 20.11, <= 20.13 | - -Here is an example batch script to submit jobs on Helmi - -```bash -#!/bin/bash - -#SBATCH --job-name=helmijob # Job name -#SBATCH --account=project_ # Project for billing (slurm_job_account) -#SBATCH --partition=q_fiqci # Partition (queue) name -#SBATCH --ntasks=1 # One task (process) -#SBATCH --mem-per-cpu=2G # memory allocation -#SBATCH --cpus-per-task=1 # Number of cores (threads) -#SBATCH --time=00:15:00 # Run time (hh:mm:ss) - -module use /appl/local/quantum/modulefiles - -# uncomment correct line: -# module load fiqci-vtt-qiskit -# or -# module load fiqci-vtt-cirq - -python your_python_script.py -``` - -The batch script can then be submitted with `sbatch`. You can also submit interactive jobs through `srun`. - -```bash -srun --account=project_ -t 00:15:00 -c 1 -n 1 --partition q_fiqci python your_python_script.py -``` - -The `helmi_*` module sets up the correct python environment to use Qiskit or Cirq in conjunction with Helmi. - -!!! info "Running on Helmi" - When submitting a job on Helmi, the user's slurm_job_account (project on which the job is run) is mapped to the project_id and this information is transferred to VTT for accounting purposes. - -### Qiskit - -To load the Qiskit module use `module load fiqci-vtt-qiskit`. - -In Qiskit python scripts you will need to include the following: - -```python -import os - -from qiskit import QuantumCircuit, transpile -from iqm.qiskit_iqm import IQMProvider - -HELMI_CORTEX_URL = os.getenv('HELMI_CORTEX_URL') # This is set when loading the module - -provider = IQMProvider(HELMI_CORTEX_URL) -backend = provider.get_backend() - -shots = 1000 # Set the number of shots you wish to run with - -# Create your quantum circuit. -# Here is an example -circuit = QuantumCircuit(2, 2) -circuit.h(0) -circuit.cx(0, 1) -circuit.measure_all() - -print(circuit.draw(output='text')) - -transpiled_circuit = transpile(circuit, backend) -job = backend.run(transpiled_circuit, shots=shots) -counts = job.result().get_counts() -print(counts) -``` - -### Cirq - -To load the Cirq module use `module load fiqci-vtt-cirq`. - -```python -import os - -import cirq -from iqm.cirq_iqm import Adonis -from iqm.cirq_iqm.iqm_sampler import IQMSampler - -adonis = Adonis() - -HELMI_CORTEX_URL = os.getenv('HELMI_CORTEX_URL') # This is set when loading the module - -sampler = IQMSampler(HELMI_CORTEX_URL) - -shots = 1000 - -# Create your quantum circuit -# Here is an example -q1, q2 = cirq.NamedQubit('QB1'), cirq.NamedQubit('QB2') -circuit = cirq.Circuit() -circuit.append(cirq.H(q1)) -circuit.append(cirq.CNOT(q1, q2)) -circuit.append(cirq.measure(q1, q2, key='m')) -print(circuit) - -decomposed_circuit = adonis.decompose_circuit(circuit) -routed_circuit, initial_mapping, final_mapping = adonis.route_circuit(decomposed_circuit) - -# Optionally print mapping -# print(routed_circuit) -# print(initial_mapping) -# print(final_mapping) - -result = sampler.run(routed_circuit, repetitions=shots) -print(result.measurements['m']) -``` - -## Additional examples - -An additional [set of examples can be found here](https://github.com/FiQCI/helmi-examples). -The examples emphasize the difference between running on a simulator and a real physical quantum computer, -and how to construct your circuits for optimum results on Helmi. The repository also contains some useful -scripts for submitting jobs. - - -## Simulated test runs - -As quantum resources can be scarce, it is recommended that you prepare the codes and algorithms you intend to run on Helmi in advance. To help with this process, [`qiskit-on-iqm` provides a fake noise model backend](https://iqm-finland.github.io/qiskit-on-iqm/user_guide.html#noisy-simulation-of-quantum-circuit-execution). You can run the fake noise model backend locally on your laptop for simulation and testing. - -A set of Qiskit and Cirq examples and scripts for guidance in using the LUMI-Helmi partition are also available. [You can find these here](https://github.com/FiQCI/fiqci-examples). - -## Job Metadata - -Additional metadata about your job can be queried directly with Qiskit. For example: - -```python - -provider = IQMProvider(HELMI_CORTEX_URL) -backend = provider.get_backend() - -#Retrieving backend information -print(f'Native operations: {backend.operation_names}') -print(f'Number of qubits: {backend.num_qubits}') -print(f'Coupling map: {backend.coupling_map}') - -transpiled_circuit = transpile(circuit, backend) -job = backend.run(transpiled_circuit, shots=shots) -result = job.result() -exp_result = result._get_experiment(circuit) - -print("Job ID: ", job.job_id()) # Retrieving the submitted job id -print(result.request.circuits) # Retrieving the circuit request sent -print("Calibration Set ID: ", exp_result.calibration_set_id) # Retrieving the current calibration set id. -print(result.request.qubit_mapping) # Retrieving the qubit mapping -print(result.request.shots) # Retrieving the number of requested shots. - -#retrieve a job using the job_id from a previous session -#old_job = backend.retrieve_job(job_id) -``` -!!! info "Save your Job ID!" - Note that there is currently no method to list previous Job ID's therefore it is recommended to always print your Job ID after job submission and save it somewhere! - The same applies for the calibration set id. - - -## Figures of Merit - -The figures of merit (or quality metrics set) may be necessary for publishing work produced on Helmi. It also gives an idea as to the current status of Helmi. In `helmi-examples` there is a helper script to get the calibration data including the figures of merit. The script can be found [here](https://github.com/FiQCI/helmi-examples/blob/main/scripts/get_calibration_data.py). This file can be added to your own python scripts and will return data in json format. Note that querying the latest calibration data may give an incomplete or outdated set of figures. Therefore calibration set IDs should be saved along with Job IDs. - -Here is a brief description of the figures which are given when querying: - -| Figure | Description | | | -| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | --- | -| T1 Time (s) | The T1 time is called the longitudinal relaxation rate and describes how quickly the excited state of the qubit returns to its ground state. | | | -| T2 Time (s) | The T2 time is called the transverse relaxation rate and describes loss of coherence of a superposition state. | | | -| T2 Echo Time (s) | The T2 echo time describes the loss of coherence of the superposition state of the qubit. It is more precise than the T2 Time as it is less susceptible to low-frequency noise. | | | -| Single shot readout fidelity | This describes the fidelity when performing single shot readouts of the qubit state. Single-shot readout prepares 50% of the qubit states in the excited and 50% in the ground state. | | | -| Single shot readout 01 error | The error in assigning an excited state ('1') when the state is in the ground state ('0'). | | | -| Single shot readout 10 error | The error in assigning a ground state ('0') when the state is in the excited state ('1'). | | | -| Fidelity 1QB gates averaged | This is calculated from Randomized Benchmarking and describes the average gate fidelity when a random sequence of single qubit Clifford gates is applied. | | | -| Fidelity 2QB Cliffords averaged | This is calculated from Randomized Benchmarking, showing the average Clifford gate fidelity. | | | -| CZ gate fidelity | The controlled-z gate fidelity calculated through interleaved randomized benchmarking, where the controlled-z gate is interleaved. | | | - - -For further information on the figures of merit contact the [CSC Service Desk](../../../support/contact.md), reachable at [servicedesk@csc.fi](mailto:servicedesk@csc.fi). - - -## Using Helmi on Lumi-web interface - -The [LUMI Web interface](https://docs.lumi-supercomputer.eu/runjobs/webui/) allows users to run quantum jobs on Helmi through a web interface. Details for logging in to the LUMI web interface can be read through the [LUMI Documentation page](https://docs.lumi-supercomputer.eu/firststeps/loggingin-webui/). - -### Accessing Helmi - -After successfully authenticating, you should now have access to your dashboard. Click on the Jupyter app, select your project and the partition as q_fiqci. If you have an active reservation, you can use it by selecting it under reservation. - -It is recommended to use the 'Advanced settings'. Under the 'Custom init' option select Text, and under the 'Script to start' textbox enter the following script to configure the environment to use the quantum software stack. - -```bash -module use /appl/local/quantum/modulefiles -module load fiqci-vtt-qiskit # or module load fiqci-vtt-cirq -``` - -

- Helmi's with LUMI web -

- -Click on launch to start your Jupyter session. This will launch Jupyter using the command python -m Jupyter lab. If you are using Helmi during a quantum computing course, a custom environment may have been created specifically for the course. In this case, you can access Helmi using the Jupyter-for-courses app. - -

- Helmi's with LUMI web -

- - -## Further Reading -* [Lumi web interface](https://docs.lumi-supercomputer.eu/runjobs/webui/) -* [Jupyter on Lumi web interface](https://docs.lumi-supercomputer.eu/runjobs/webui/jupyter/) -* [Using Helmi on Lumi web interface](https://fiqci.fi/_posts/2024-08-23-Lumi_web_introduction/) diff --git a/docs/computing/quantum-computing/kvasi/kvasi-billing.md b/docs/computing/quantum-computing/kvasi/kvasi-billing.md deleted file mode 100644 index 47269c41a4..0000000000 --- a/docs/computing/quantum-computing/kvasi/kvasi-billing.md +++ /dev/null @@ -1,28 +0,0 @@ -# Kvasi billing - -Kvasi use is free of cost for, _e.g._, academic use, according to the general -[free of charge use cases](https://research.csc.fi/free-of-charge-use-cases) policy. - -For commercial use, the following options are available; to purchase services and expert support, contact CSC's Service Desk: servicedesk@csc.fi. - -## Basic package - -Full features of Kvasi available for use, limits on memory consumption. Corresponds to a simulation capacity of roughly 25 qubits. - -1. Memory restricted to 64 GB / project - -2. Core count restricted to 64 cores / project - -Cost: 1.500 € / 3 months (VAT 0%) - -## Power package - -Full features of Kvasi available for use, without memory restrictions for 72 h / month. Corresponds to a simulation capacity of up to 30 qubits _part of the time_ and roughly 25 qubits the rest of the time. - -Cost: 4.500 € / 3 months (VAT 0%) - -## Booster package - -Upgrade simulation capacity of the Basic package to correspond to the Power package for the duration of one month. - -Cost: 1.000 € / month (VAT 0%) diff --git a/docs/computing/quantum-computing/kvasi/kvasi.md b/docs/computing/quantum-computing/kvasi/kvasi.md deleted file mode 100644 index 912d470b6c..0000000000 --- a/docs/computing/quantum-computing/kvasi/kvasi.md +++ /dev/null @@ -1,64 +0,0 @@ -# Accessing Kvasi - -You first need a CSC userid for Puhti. If you do not have one, check out the -[How to get started as a new user at CSC?](../../../support/faq/how-to-get-started-at-CSC.md) FAQ. - -In order to access Kvasi, your CSC userid needs to part of the `kvasi-users` group. Send a mail to servicedesk@csc.fi and ask to be added to the **kvasi-users** group. - -When you have been added, you can use SSH to login to kvasi.csc.fi directly. - -## Setting up an SSH tunnel for the Jupyter web interface - -In order to use the Jupyter notebook environment, you need to set up an SSH tunnel, forwarding the output port of your notebook environment to your local computer. Follow these steps: - -1. Login to Kvasi with SSH: - * `ssh @kvasi.csc.fi` -2. Start the Jupyter server: `./qlm_notebooks/launch_qlm_notebooks`. This will give you two values: - * The Jupyter port number. It will be `8888`, or higher - * The token for accessing the web interface (a string of letters and numbers) - * Example output: - -``` -Jupyter port : 8888 -Jupyter token: 123456abcdef - -To access your Jupyter notebook from your local computer: - -1. Create SSH tunnel: - ssh -L 8890:localhost:8888 yourcscusername@kvasi.csc.fi - -2. Open browser link: http://127.0.0.1:8890/?token=123456abcdef -``` - -3. Start an SSH tunnel, forwarding the Jupyter port to a local port number. -You can choose, _e.g_, `8890` for the local port - * The details of how to open up the SSH tunnel depend on your SSH client. - * Using the command line, you can login once more from a second terminal, - now specifying port forwarding, using the ssh command of the output above. - -4. Open up your browser, and go to the address given by the output, for example -`http://127.0.0.1:8890/?token=123456abcdef` This should open up the web interface -to Kvasi, with two main options to explore: - * **The manual** (to the left) - * **The Jupyter notebook environment** with examples (to the right) - - -## myQLM - -myQLM is a light-weight version of the QLM ecosystem that can be run outside the Kvasi QLM. With myQLM, you can design and simulate quantum algorithms locally, on your own computer. MyQLM is well suited for getting started with quantum algorithm exploration. Advanced features of the QLM are missing, but the basic features are the same. - -myQLM is now open access, and can be downloaded for Linux and Windows here: -[myQLM docs and installation instructions](https://myqlm.github.io/index.html) - -You can also use myQLM directly from the [CSC Noppe environment](https://noppe.csc.fi). -After logging in, simply launch a new "myQLM Notebooks" environment and open it in your browser. -Training material related to previous course can be found under the Folder **CourseMaterial** - - -## Links - -* [Webinar: Quantum Computing and Programming in Two Hours (2021)](https://youtu.be/whoTr3zM3jU) -* [Webinar: Kvanttilaskentaa ja -ohjelmointia kahdessa tunnissa (2021)](https://youtu.be/EnDKcCAjRtg) -* [Webinar: What is Quantum Computing? (2019)](https://youtu.be/44F0rYmLT4Y) -* [Online: Introduction to Quantum Computing and Algorithms](https://ssl.eventilla.com/event/mZ9Pa) -* [The Quantum Learning Machine at atos.net](https://atos.net/en/solutions/quantum-learning-machine) diff --git a/docs/computing/quantum-computing/overview.md b/docs/computing/quantum-computing/overview.md index 8d2355972c..e996079445 100644 --- a/docs/computing/quantum-computing/overview.md +++ b/docs/computing/quantum-computing/overview.md @@ -10,37 +10,37 @@ computational operators. Before QPUs can be utilized, they require tailor-made p and algorithms. The [Finnish Quantum-Computing Infrastructure](https://fiqci.fi) FiQCI provides access to quantum computing resources through CSC's service portals. -## Helmi +## Quantum Computers -**5 Qubit Quantum Computer** +### Helmi (VTT Q5) -Helmi, the first Finnish quantum computer, is co-developed by VTT and IQM Quantum Computers. Presently, Helmi provides 5 qubits. With Helmi, users can run quantum programs and algorithms on a real, physical device. +Helmi, the first Finnish quantum computer, is co-developed by VTT and IQM Quantum Computers. It offers a 5-qubit system, enabling users to execute quantum programs and algorithms on a physical quantum device. Access to Helmi is provided through the LUMI supecomputer environment. Users will need to apply for a quantum computing project on LUMI, which gives access to Helmi through the LUMI job scheduler (SLURM). Applying for a project is done through [MyCSC](../../accounts/how-to-create-new-project.md). + +### VTT Q50 + +Q50 is a 53-qubit quantum computer, also co-developed by VTT and IQM Quantum Computers. + +Similar to Helmi, Q50 is accessible through the LUMI supercomputer environment. Users will need to apply for a quantum computing project on LUMI. Upon approval, Q50 can be accessed using the LUMI job scheduler (SLURM). +Refer to the [Open Call](https://fiqci.fi/publications/2025-03-04-Q50-Call-1_2025) publication for detailed instructions on how to apply for a project with Q50 access. + + For further reading: -* [A more technical description about Helmi](./helmi/helmi-specs.md). -* [Specific instructions for the LUMI Helmi partition](./helmi/fiqci-partition.md) -* [Getting started with Helmi](./helmi/helmi-from-lumi.md) +* [A more technical description about the quantum computers](./specs.md). +* [Specific instructions for the fiqci partition](./fiqci-partition.md) +* [Getting started with Helmi/Q50](./access.md) * [LUMI Documentation page](https://docs.lumi-supercomputer.eu/) -## Kvasi - -**The Quantum Learning Machine** +## Simulators -Kvasi is an advanced quantum computer simulator/emulator. With Kvasi, the user can explore and develop algorithms -for quantum computers. Read here [detailed instructions on how to access](../quantum-computing/kvasi/kvasi.md) +### Qiskit -Kvasi provides an ecosystem for developing and simulating quantum algorithms in both -ideal and realistic, noisy conditions. With Kvasi, you can optimize your algorithm -for a specific hardware (QPU), with specific qubit connectivity and basic gate operations. +The LUMI supercomputer now supports the simulation of quantum algorithms with up to 44 qubits using Qiskit, IBM’s open-source quantum computing framework. This capability enables researchers to explore and test large-scale quantum algorithms in preparation for quantum advantage. -The algorithms can be developed either at a level close to the hardware, using -the Atos Quantum Assembler (AQASM) language, or using a higher level, Python based -language and ready-made libraries. The QLM comes with several ready-made examples. -You can also download and run locally [myQLM](../quantum-computing/kvasi/kvasi.md#myqlm) - a light-weight version of the -QLM ecosystem. +For more details, refer to this [blog](https://fiqci.fi/publications/2025-04-01-LUMI-quantum-simulations-qiskit-aer) diff --git a/docs/computing/quantum-computing/projects.md b/docs/computing/quantum-computing/projects.md new file mode 100644 index 0000000000..a0927a79d3 --- /dev/null +++ b/docs/computing/quantum-computing/projects.md @@ -0,0 +1,20 @@ +# Quantum Projects on LUMI + +Access to **Helmi** and **Q50** requires a LUMI project with allocated quantum computing resources. +To get started, create a LUMI project via MyCSC. Note that Q50 projects follow a separate application procedure, refer to the [Open Call](https://fiqci.fi/publications/2025-03-04-Q50-Call-1_2025) for details. Each project must have a **Principal Investigator** as the Project Manager, typically a senior researcher. + + +Detailed instructions on the process of creating a general LUMI project via MyCSC are here: + +* [How to create a LUMI project and apply for resources](../../accounts/how-to-create-new-project.md#how-to-create-finnish-lumi-projects) + +!!! info "Getting Started" + To get started with Helmi/VTT Q50 see + [Access Helmi/Q50 through LUMI](access.md). + +## Further reading: + +* [Topology Overview](specs.md) +* [Specific instructions for the fiqci partition](fiqci-partition.md) +* [Running jobs](running-quantum-jobs.md) +* [LUMI Documentation page](https://docs.lumi-supercomputer.eu/) \ No newline at end of file diff --git a/docs/computing/quantum-computing/running-quantum-jobs.md b/docs/computing/quantum-computing/running-quantum-jobs.md new file mode 100644 index 0000000000..d66c290ff7 --- /dev/null +++ b/docs/computing/quantum-computing/running-quantum-jobs.md @@ -0,0 +1,476 @@ +# Running on Helmi and Q50 + +!!! info "Give feedback!" + **All feedback is highly appreciated**, Please share your experience + by emailing us at [fiqci-feedback@postit.csc.fi](mailto:fiqci-feedback@postit.csc.fi). + +## Running Jobs + +To submit jobs to the quantum computers (Helmi and Q50), use the q_fiqci queue by adding --partition=q_fiqci in your batch script. + +Currently, Helmi and Q50 support job submissions using Qiskit or Cirq. These scripts must be submitted as standard Python files. + +To run jobs on the quantum computers, follow these steps to set up the correct environment on LUMI: + +* Run `module use /appl/local/quantum/modulefiles`. +This command makes the available modules visible via `module avail`. + +* Load the appropriate environment module depending on your framework: + * For Qiskit: `module load fiqci-vtt-qiskit` + * For Cirq `module load fiqci-vtt-cirq` + + +The `fiqci-vtt-qiskit` and `fiqci-vtt-cirq` modules provide pre-configured Python environments for running jobs on the quantum computers. +If you need to install additional Python packages, you can do so using: + +`python -m pip install --user package`. + + +!!! info "Creating your own python environment" + If you prefer to use a custom Python environment, + we recommend using the [container wrapper tool](https://docs.lumi-supercomputer.eu/software/installing/container-wrapper/) to create and manage your environment. + +The current supported software versions are: + +| Software | Module_name | Versions | +|----------|-------------|----------| +| Cirq on IQM | cirq_iqm | >= 16.0, <= 17.0 | +| Qiskit on IQM | qiskit_iqm | >= 17.3, <= 18.0 | +| IQM client | iqm_client | >= 22.3, <= 23.0 | + +Here is an example batch script to submit a quantum job + +=== "Helmi" + ```bash + #!/bin/bash + + #SBATCH --job-name=quantumjob # Job name + #SBATCH --account=project_ # Project for billing (slurm_job_account) + #SBATCH --partition=q_fiqci # Partition (queue) name + #SBATCH --ntasks=1 # One task (process) + #SBATCH --mem-per-cpu=2G # memory allocation + #SBATCH --cpus-per-task=1 # Number of cores (threads) + #SBATCH --time=00:05:00 # Run time (hh:mm:ss) + + module use /appl/local/quantum/modulefiles + + # uncomment correct line: + # module load fiqci-vtt-qiskit + # or + # module load fiqci-vtt-cirq + export DEVICES=("Q5") + source $RUN_SETUP + python your_python_script.py + ``` + +=== "Q50" + ```bash + #!/bin/bash + + #SBATCH --job-name=quantumjob # Job name + #SBATCH --account=project_ # Project for billing (slurm_job_account) + #SBATCH --partition=q_fiqci # Partition (queue) name + #SBATCH --ntasks=1 # One task (process) + #SBATCH --mem-per-cpu=2G # memory allocation + #SBATCH --cpus-per-task=1 # Number of cores (threads) + #SBATCH --time=00:05:00 # Run time (hh:mm:ss) + + module use /appl/local/quantum/modulefiles + + # uncomment correct line: + # module load fiqci-vtt-qiskit + # or + # module load fiqci-vtt-cirq + export DEVICES=("Q50") + source $RUN_SETUP + python your_python_script.py + ``` + +=== "Multiple backends" + ```bash + #!/bin/bash + + #SBATCH --job-name=quantumjob # Job name + #SBATCH --account=project_ # Project for billing (slurm_job_account) + #SBATCH --partition=q_fiqci # Partition (queue) name + #SBATCH --ntasks=1 # One task (process) + #SBATCH --mem-per-cpu=2G # memory allocation + #SBATCH --cpus-per-task=1 # Number of cores (threads) + #SBATCH --time=00:05:00 # Run time (hh:mm:ss) + + module use /appl/local/quantum/modulefiles + + # uncomment correct line: + # module load fiqci-vtt-qiskit + # or + # module load fiqci-vtt-cirq + export DEVICES=("Q5" "Q50") + source $RUN_SETUP + python your_python_script.py + ``` + +The batch script can then be submitted with `sbatch`. You can also submit interactive jobs through `srun`. + +```bash +module use /appl/local/quantum/modulefiles +module --ignore_cache load "fiqci_vtt_qiskit" +export DEVICES=("Q50") +srun --account project_xxx -t 00:15:00 -c 1 -n 1 --partition q_fiqci bash -c "source $RUN_SETUP && python -u your_python_script.py" +``` + +The `fiqci-vtt-*` module sets up the correct python environment to use Qiskit or Cirq in conjunction with the quantum computers. + +!!! info "Running on physical Quantum computers" + When submitting a job on Helmi or Q50, the user's slurm_job_account (project on which the job is run) is mapped to the project_id and this information is transferred to VTT for accounting purposes. + To run on Q50, please specify the device using `export DEVICES=("Q50") `command + +### Qiskit + +To load the Qiskit module use `module load fiqci-vtt-qiskit`. + +In Qiskit python scripts you will need to include the following: + +=== "Helmi" + ```python + import os + + from qiskit import QuantumCircuit, transpile + from iqm.qiskit_iqm import IQMProvider + + DEVICE_CORTEX_URL = os.getenv('HELMI_CORTEX_URL') + + provider = IQMProvider(DEVICE_CORTEX_URL) + backend = provider.get_backend() + + shots = 1000 # Set the number of shots you wish to run with + + # Create your quantum circuit. + # Here is an example + circuit = QuantumCircuit(2, 2) + circuit.h(0) + circuit.cx(0, 1) + circuit.measure_all() + + print(circuit.draw(output='text')) + + transpiled_circuit = transpile(circuit, backend) + job = backend.run(transpiled_circuit, shots=shots) + counts = job.result().get_counts() + print(counts) + ``` + +=== "Q50" + ```python + import os + + from qiskit import QuantumCircuit, transpile + from iqm.qiskit_iqm import IQMProvider + + DEVICE_CORTEX_URL = os.getenv('Q50_CORTEX_URL') + + provider = IQMProvider(DEVICE_CORTEX_URL) + backend = provider.get_backend() + + shots = 1000 # Set the number of shots you wish to run with + + # Create your quantum circuit. + # Here is an example + circuit = QuantumCircuit(2, 2) + circuit.h(0) + circuit.cx(0, 1) + circuit.measure_all() + + print(circuit.draw(output='text')) + + transpiled_circuit = transpile(circuit, backend) + job = backend.run(transpiled_circuit, shots=shots) + counts = job.result().get_counts() + print(counts) + ``` + +=== "Multiple backends" + ```python + import os + + from qiskit import QuantumCircuit, transpile + from iqm.qiskit_iqm import IQMProvider + + HELMI_DEVICE_CORTEX_URL = os.getenv('HELMI_CORTEX_URL') + Q50_DEVICE_CORTEX_URL = os.getenv('Q50_CORTEX_URL') + + provider_helmi = IQMProvider(HELMI_DEVICE_CORTEX_URL) + provider_q50 = IQMProvider(Q50_DEVICE_CORTEX_URL) + + backend_helmi = provider_helmi.get_backend() + backend_q50 = provider_q50.get_backend() + + shots = 1000 # Set the number of shots you wish to run with + + # Create your quantum circuit. + # Here is an example + circuit = QuantumCircuit(2, 2) + circuit.h(0) + circuit.cx(0, 1) + circuit.measure_all() + + print(circuit.draw(output='text')) + + transpiled_circuit_helmi = transpile(circuit, backend_helmi) + transpiled_circuit_q50= transpile(circuit, backend_q50) + + job_helmi = backend_helmi.run(transpiled_circuit_helmi, shots=shots) + job_q50 = backend.run(transpiled_circuit_q50, shots=shots) + + counts_helmi = job_helmi.result().get_counts() + counts_q50 = job_q50.result().get_counts() + + print(f"Counts Helmi {counts_helmi}") + print(f"Counts Q50 {counts_q50}") + ``` + +### Cirq + +To load the Cirq module use `module load fiqci-vtt-cirq`. + +=== "Helmi" + ```python + import os + + import cirq + from iqm.cirq_iqm import Adonis + from iqm.cirq_iqm.iqm_sampler import IQMSampler + + adonis = Adonis() + + DEVICE_CORTEX_URL = os.getenv('HELMI_CORTEX_URL') + + sampler = IQMSampler(DEVICE_CORTEX_URL) + + shots = 1000 + + # Create your quantum circuit + # Here is an example + q1, q2 = cirq.NamedQubit('QB1'), cirq.NamedQubit('QB2') + circuit = cirq.Circuit() + circuit.append(cirq.H(q1)) + circuit.append(cirq.CNOT(q1, q2)) + circuit.append(cirq.measure(q1, q2, key='m')) + print(circuit) + + decomposed_circuit = adonis.decompose_circuit(circuit) + routed_circuit, initial_mapping, final_mapping = adonis.route_circuit(decomposed_circuit) + + # Optionally print mapping + # print(routed_circuit) + # print(initial_mapping) + # print(final_mapping) + + result = sampler.run(routed_circuit, repetitions=shots) + print(result.measurements['m']) + ``` + +=== "Q50" + ```python + import os + + import cirq + from iqm.cirq_iqm import Adonis + from iqm.cirq_iqm.iqm_sampler import IQMSampler + + adonis = Adonis() + + DEVICE_CORTEX_URL = os.getenv('Q50_CORTEX_URL') + + sampler = IQMSampler(DEVICE_CORTEX_URL) + + shots = 1000 + + # Create your quantum circuit + # Here is an example + q1, q2 = cirq.NamedQubit('QB1'), cirq.NamedQubit('QB2') + circuit = cirq.Circuit() + circuit.append(cirq.H(q1)) + circuit.append(cirq.CNOT(q1, q2)) + circuit.append(cirq.measure(q1, q2, key='m')) + print(circuit) + + decomposed_circuit = adonis.decompose_circuit(circuit) + routed_circuit, initial_mapping, final_mapping = adonis.route_circuit(decomposed_circuit) + + # Optionally print mapping + # print(routed_circuit) + # print(initial_mapping) + # print(final_mapping) + + result = sampler.run(routed_circuit, repetitions=shots) + print(result.measurements['m']) + ``` + +=== "Multiple backends" + ```python + import os + + import cirq + from iqm.cirq_iqm import Adonis + from iqm.cirq_iqm.iqm_sampler import IQMSampler + + adonis = Adonis() + + HELMI_DEVICE_CORTEX_URL = os.getenv('HELMI_CORTEX_URL') + Q50_DEVICE_CORTEX_URL = os.getenv('Q50_CORTEX_URL') + + sampler_helmi = IQMSampler(HELMI_DEVICE_CORTEX_URL) + sampler_q50 = IQMSampler(Q50_DEVICE_CORTEX_URL) + + shots = 1000 + + # Create your quantum circuit + # Here is an example + q1, q2 = cirq.NamedQubit('QB1'), cirq.NamedQubit('QB2') + circuit = cirq.Circuit() + circuit.append(cirq.H(q1)) + circuit.append(cirq.CNOT(q1, q2)) + circuit.append(cirq.measure(q1, q2, key='m')) + print(circuit) + + decomposed_circuit = adonis.decompose_circuit(circuit) + routed_circuit, initial_mapping, final_mapping = adonis.route_circuit(decomposed_circuit) + + # Optionally print mapping + # print(routed_circuit) + # print(initial_mapping) + # print(final_mapping) + + result_helmi = sampler_helmi.run(routed_circuit, repetitions=shots) + result_q50 = sampler_q50.run(routed_circuit, repetitions=shots) + + print(f"Results Helmi: {result_helmi.measurements['m']}") + print(f"Results Q50: {result_q50.measurements['m']}") + ``` + +## Additional examples + +An additional [set of examples can be found here](https://github.com/FiQCI/helmi-examples). +The examples emphasize the difference between running on a simulator and a real physical quantum computer, +and how to construct your circuits for optimum results on the quantum computers. The repository also contains some useful +scripts for submitting jobs. + + +## Simulated test runs + +As quantum resources can be scarce, it is recommended that you prepare the codes and algorithms you intend to run on the quantum computers in advance. To help with this process, [`qiskit-on-iqm` provides a fake noise model backend](https://iqm-finland.github.io/qiskit-on-iqm/user_guide.html#noisy-simulation-of-quantum-circuit-execution). You can run the fake noise model backend locally on your laptop for simulation and testing. + +A set of Qiskit and Cirq examples and scripts for guidance in using the `q_fiqci` partition are also available. [You can find these here](https://github.com/FiQCI/fiqci-examples). + +## Job Metadata + +Additional metadata about your job can be queried directly with Qiskit. For example: + +=== "Helmi" + ```python + + DEVICE_CORTEX_URL = os.getenv('HELMI_CORTEX_URL') + provider = IQMProvider(DEVICE_CORTEX_URL) + backend = provider.get_backend() + + #Retrieving backend information + print(f'Native operations: {backend.operation_names}') + print(f'Number of qubits: {backend.num_qubits}') + print(f'Coupling map: {backend.coupling_map}') + + transpiled_circuit = transpile(circuit, backend) + job = backend.run(transpiled_circuit, shots=shots) + result = job.result() + exp_result = result._get_experiment(circuit) + + print("Job ID: ", job.job_id()) # Retrieving the submitted job id + print(result.request.circuits) # Retrieving the circuit request sent + print("Calibration Set ID: ", exp_result.calibration_set_id) # Retrieving the current calibration set id. + print(result.request.qubit_mapping) # Retrieving the qubit mapping + print(result.request.shots) # Retrieving the number of requested shots. + + #retrieve a job using the job_id from a previous session + #old_job = backend.retrieve_job(job_id) + ``` + +=== "Q50" + ```python + + DEVICE_CORTEX_URL = os.getenv('Q50_CORTEX_URL') + provider = IQMProvider(DEVICE_CORTEX_URL) + backend = provider.get_backend() + + #Retrieving backend information + print(f'Native operations: {backend.operation_names}') + print(f'Number of qubits: {backend.num_qubits}') + print(f'Coupling map: {backend.coupling_map}') + + transpiled_circuit = transpile(circuit, backend) + job = backend.run(transpiled_circuit, shots=shots) + result = job.result() + exp_result = result._get_experiment(circuit) + + print("Job ID: ", job.job_id()) # Retrieving the submitted job id + print(result.request.circuits) # Retrieving the circuit request sent + print("Calibration Set ID: ", exp_result.calibration_set_id) # Retrieving the current calibration set id. + print(result.request.qubit_mapping) # Retrieving the qubit mapping + print(result.request.shots) # Retrieving the number of requested shots. + + #retrieve a job using the job_id from a previous session + #old_job = backend.retrieve_job(job_id) + ``` + +!!! info "Save your Job ID!" + Note that there is currently no method to list previous Job ID's therefore it is recommended to always print your Job ID after job submission and save it somewhere! + The same applies for the calibration set id. + + +## Figures of Merit + +The figures of merit (or quality metrics set) may be necessary for publishing work produced on Helmi/Q50. It also gives an idea as to the current status of the quantum computers. In `fiqci-examples` there is a helper script to get the calibration data including the figures of merit. The script can be found [here](https://github.com/FiQCI/fiqci-examples/blob/main/scripts/get_calibration_data.py). This file can be added to your own python scripts and will return data in json format. Note that querying the latest calibration data may give an incomplete or outdated set of figures. Therefore calibration set IDs should be saved along with Job IDs. + +Here is a brief description of the figures which are given when querying: + +| Figure | Description | | | +| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | --- | +| T1 Time (s) | The T1 time is called the longitudinal relaxation rate and describes how quickly the excited state of the qubit returns to its ground state. | | | +| T2 Time (s) | The T2 time is called the transverse relaxation rate and describes loss of coherence of a superposition state. | | | +| T2 Echo Time (s) | The T2 echo time describes the loss of coherence of the superposition state of the qubit. It is more precise than the T2 Time as it is less susceptible to low-frequency noise. | | | +| Single shot readout fidelity | This describes the fidelity when performing single shot readouts of the qubit state. Single-shot readout prepares 50% of the qubit states in the excited and 50% in the ground state. | | | +| Single shot readout 01 error | The error in assigning an excited state ('1') when the state is in the ground state ('0'). | | | +| Single shot readout 10 error | The error in assigning a ground state ('0') when the state is in the excited state ('1'). | | | +| Fidelity 1QB gates averaged | This is calculated from Randomized Benchmarking and describes the average gate fidelity when a random sequence of single qubit Clifford gates is applied. | | | +| Fidelity 2QB Cliffords averaged | This is calculated from Randomized Benchmarking, showing the average Clifford gate fidelity. | | | +| CZ gate fidelity | The controlled-z gate fidelity calculated through interleaved randomized benchmarking, where the controlled-z gate is interleaved. | | | + + +For further information on the figures of merit contact the [CSC Service Desk](../../support/contact.md), reachable at [servicedesk@csc.fi](mailto:servicedesk@csc.fi). + + +## Using Helmi/Q50 on Lumi-web interface + +The [LUMI Web interface](https://docs.lumi-supercomputer.eu/runjobs/webui/) allows users to run quantum jobs on Helmi and Q50 through a web interface. Details for logging in to the LUMI web interface can be read through the [LUMI Documentation page](https://docs.lumi-supercomputer.eu/firststeps/loggingin-webui/). + +### Accessing Helmi/Q50 + +After successfully authenticating, you should now have access to your dashboard. Click on the Jupyter app, select your project and the partition as q_fiqci. If you have an active reservation, you can use it by selecting it under reservation. + +It is recommended to use the `Advanced settings`. Under the `Custom init` option select Text, and under the `Script to start` textbox enter the following script to configure the environment to use the quantum software stack. + +```bash +module use /appl/local/quantum/modulefiles +module load fiqci-vtt-qiskit # or module load fiqci-vtt-cirq +``` + +!["Qcs with LUMI web"](../../img/Quantum_jobs_lumi_web.png) + + +Click on launch to start your Jupyter session. This will launch Jupyter using the command python -m Jupyter lab. If you are using Helmi/Q50 during a quantum computing course, a custom environment may have been created specifically for the course. In this case, you can access the quantum computers using the Jupyter-for-courses app. + +!["Qcs with LUMI web courses"](../../img/helmi_with_jupyter_for_courses_gui.png) + + +## Further Reading +* [Lumi web interface](https://docs.lumi-supercomputer.eu/runjobs/webui/) +* [Jupyter on Lumi web interface](https://docs.lumi-supercomputer.eu/runjobs/webui/jupyter/) +* [Using the quantum computers Lumi web interface](https://fiqci.fi/_posts/2024-08-23-Lumi_web_introduction/) diff --git a/docs/computing/quantum-computing/helmi/helmi-specs.md b/docs/computing/quantum-computing/specs.md similarity index 63% rename from docs/computing/quantum-computing/helmi/helmi-specs.md rename to docs/computing/quantum-computing/specs.md index 65b094a8d6..06ffec033a 100644 --- a/docs/computing/quantum-computing/helmi/helmi-specs.md +++ b/docs/computing/quantum-computing/specs.md @@ -1,19 +1,31 @@ -# Technical details about Helmi +# Technical details ## Architecture and Topology +### Helmi (VTT Q5) Helmi is a 5-qubit quantum computer co-developed by VTT and IQM using superconducting qubits. The qubits are arranged in a **star shaped** topology, with the central qubit being Qubit 3 (QB3) connected to the other 4 qubits. This means that any two-qubit gate will work between QB3 and any other qubit, whereas one-qubit gates can be mapped to any of the 4 surrounding qubits. -

- Helmi's node mapping -

+
!["Helmi's node mapping"](../../img/Helmi_topology.png)
+ + +#### Native Gates + +Helmi's native are are the two-qubit controlled-z gate and the one-qubit phased rx gate. + +### VTT Q50 +VTT Q50 is a 53-qubit quantum computer co-developed by VTT and IQM using superconducting qubits. +The qubits are arranged in a **Square lattice** topology, a 2D grid where each qubit interacts directly with its nearest neighbors. The device has one broken tunable coupler between qubits QB18 and QB10. + + +
!["Q50's node mapping"](../../img/VTT_Q50_topology.png)
+ ### Native Gates +Q50's native gates are the Phased x-rotation gate (prx) and controlled-z gate (cz) -Helmi's native gates are the two-qubit controlled-z gate and the one-qubit phased rx gate. ### Defining topology and gates in Qiskit and Cirq @@ -40,7 +52,7 @@ print(adonis.metadata.nx_graph) ## Further Reading -* [Specific instructions for the LUMI Helmi partition](fiqci-partition.md) +* [Specific instructions for the fiqci partition](fiqci-partition.md) * [Qiskit adapter for IQM devices](https://iqm-finland.github.io/qiskit-on-iqm/) * [Cirq adapter for IQM devices](https://iqm-finland.github.io/cirq-on-iqm/) diff --git a/docs/img/Helmi_topology.png b/docs/img/Helmi_topology.png new file mode 100644 index 0000000000..a1fcb4aaed Binary files /dev/null and b/docs/img/Helmi_topology.png differ diff --git a/docs/img/Quantum_jobs_lumi_web.png b/docs/img/Quantum_jobs_lumi_web.png new file mode 100644 index 0000000000..ffade64271 Binary files /dev/null and b/docs/img/Quantum_jobs_lumi_web.png differ diff --git a/docs/img/VTT_Q50_topology.png b/docs/img/VTT_Q50_topology.png new file mode 100644 index 0000000000..99e9c40b3a Binary files /dev/null and b/docs/img/VTT_Q50_topology.png differ diff --git a/docs/img/running_on_helmi_and_q50.png b/docs/img/running_on_helmi_and_q50.png new file mode 100644 index 0000000000..5dda83d7ff Binary files /dev/null and b/docs/img/running_on_helmi_and_q50.png differ diff --git a/docs/support/tutorials/index.md b/docs/support/tutorials/index.md index 63cdd8c6df..360810d2bb 100644 --- a/docs/support/tutorials/index.md +++ b/docs/support/tutorials/index.md @@ -3,7 +3,7 @@ ## General * [Getting started with supercomputing at CSC](hpc-quick.md) -* [Getting started with Helmi](../../computing/quantum-computing/helmi/helmi-from-lumi.md) +* [Getting started with Quantum computers](../../computing/quantum-computing/access.md) * [Managing data on Puhti and Mahti scratch disks](clean-up-data.md) * [CSC Quick reference (pdf)](../../img/csc-quick-reference/csc-quick-reference.pdf) * [Linux basics for CSC](env-guide/index.md) diff --git a/mkdocs.yml b/mkdocs.yml index 753d639ee1..beb51f3eb9 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -164,6 +164,15 @@ plugins: "cloud/rahti2/images/keeping_docker_images_small.md": "cloud/rahti/images/keeping_docker_images_small.md" "cloud/rahti2/images/overview.md": "cloud/rahti/images/overview.md" "cloud/rahti2/images/Using_Rahti_2_integrated_registry.md": "cloud/rahti/images/Using_Rahti_integrated_registry.md" + "computing/quantum-computing/helmi/helmi-projects.md": "computing/quantum-computing/projects.md" + "computing/quantum-computing/helmi/helmi-from-lumi.md": "computing/quantum-computing/access.md" + "computing/quantum-computing/helmi/first-quantum-job.md": "computing/quantum-computing/first-quantum-job.md" + "computing/quantum-computing/helmi/helmi-specs.md": "computing/quantum-computing/specs.md" + "computing/quantum-computing/helmi/fiqci-partition.md": "computing/quantum-computing/fiqci-partition.md" + "computing/quantum-computing/helmi/running-on-helmi.md": "computing/quantum-computing/running-quantum-jobs.md" + "computing/quantum-computing/kvasi/kvasi-billing.md": "computing/quantum-computing/overview.md" + "computing/quantum-computing/kvasi/kvasi.md": "computing/quantum-computing/overview.md" + markdown_extensions: - md_in_html @@ -324,16 +333,12 @@ nav: - Visual Studio Code: computing/webinterface/vscode.md - Quantum computing: - computing/quantum-computing/overview.md - - Kvasi QLM: - - Accessing Kvasi: computing/quantum-computing/kvasi/kvasi.md - - Kvasi Billing: computing/quantum-computing/kvasi/kvasi-billing.md - - Helmi: - - Helmi projects: computing/quantum-computing/helmi/helmi-projects.md - - Access Helmi through LUMI: computing/quantum-computing/helmi/helmi-from-lumi.md - - First quantum job: computing/quantum-computing/helmi/first-quantum-job.md - - Technical details: computing/quantum-computing/helmi/helmi-specs.md - - FiQCI partition: computing/quantum-computing/helmi/fiqci-partition.md - - Running on Helmi: computing/quantum-computing/helmi/running-on-helmi.md + - Projects: computing/quantum-computing/projects.md + - Access through LUMI: computing/quantum-computing/access.md + - First quantum job: computing/quantum-computing/first-quantum-job.md + - Technical details: computing/quantum-computing/specs.md + - FiQCI partition: computing/quantum-computing/fiqci-partition.md + - Running quantum jobs: computing/quantum-computing/running-quantum-jobs.md - Cloud Services: - cloud/index.md - Noppe: