Examples
ilk - Submission template
#!/bin/bash
#
# Modify this to your needs
#
#SBATCH -p ilk
#SBATCH -o <output/file/path>
#SBATCH -N 2
#SBATCH --ntasks-per-node=1
#SBATCH -c 64
#SBATCH -t 5:0:0
#SBATCH --mem-per-cpu=15G
export SLURM_WHOLE=1
export OMP_NUM_THREADS=64
export QULACS_NUM_THREADS=64
export OMP_PROC_BIND=True
module load gcc
module load qulacs/0.6.3-python-3.9.9-mpi
mpirun -npernode ${SLURM_NTASKS_PER_NODE} python qulacs_script.py
a64 - Submission template
#!/bin/bash
#
# Plantilla. no utilizar sin retocar
#
#SBATCH -p a64
#SBATCH -N 2 # Numero de nodos
#SBATCH --tasks-per-node=1 # Número de tareas por nodo
#SBATCH -c 48 # Número de hilos por tarea
#SBATCH -t 0:10:0 # Time limit
#SBATCH --mem-per-cpu=600M # Memoria por cpu
source /etc/profile.d/lmod.sh
export OMP_NUM_THREADS=48
export QULACS_NUM_THREADS=48
module load qulacs-hpcx
scontrol show hostnames
echo $SLURM_JOB_NODELIST
nodelist=$(scontrol show hostname $SLURM_NODELIST)
printf "%s\n" "${nodelist[@]}" > nodefile
# Casos grandes se benefician de
# export OMP_PROC_BIND=TRUE
# numactl -N 0-3 <antes de la llamada de python>
mpirun -npernode ${SLURM_NTASKS_PER_NODE} -hostfile nodefile python /path/to/qulacs_script.py
rm nodefile
qpu
Submission template
#!/usr/bin/env sh
#SBATCH -p qpu
#SBATCH --mem 4G
#SBATCH -t 00:10:00
module load qmio-run
python user_test-0.py
Python QASM execution
from qmio import QmioRuntimeService
from qmio.circuits import bell as circuit
service = QmioRuntimeService()
shots = 100 # Only arg requiered
repetition_period = 500*10**-6 # If None will pick internal default
optimization = 0 # Default value
res_format = "binary_count" # Default value
# Recommended usage. Context controled
with service.backend(name="qpu") as backend:
result = backend.run(circuit=circuit, shots=shots, repetition_period=repetition_period, optimization=optimization, res_format=res_format)
print(result)
Python Qiskit execution
from qiskit.circuit import QuantumCircuit
from qiskit import transpile
from qmiotools.integrations.qiskitqmio import QmioBackend
backend=QmioBackend() # loads the last calibration file from the directory $QMIO_CALIBRARTIONS
# Creates a circuit qwith 2 qubits
c=QuantumCircuit(2)
c.h(0)
c.h(0)
c.measure_all()
#Transpile the circuit using the optimization_level equal to 2
c=transpile(c,backend,optimization_level=2)
#Execute the circuit with 1000 shots. Must be executed from a node with a QPU.
job=backend.run(c,shots=1000)
#Return the results
print(job.result().get_counts())
Python TKET execution
from qmiotools.integrations.tkbackend import Qmio
# Creatre the circuit
from pytket.circuit import Circuit
bell = Circuit(32,2)
bell.H(0)
bell.CX(0,1)
bell.Measure(0,0)
bell.Measure(1,1)
# Create an instance of the Backend
Q=Qmio()
# Compile the circuit with optimisation 1 (could be 0, 1 or 2)
ibell=Q.get_compiled_circuit(bell,1)
# Execute the circuit in the QPU. This operation is synchronous
br=Q.run_circuit(ibell,n_shots=5000)