Package: qiskit-juqcs
qiskit-juqcsQiskit provider for JUQCS (Juelich Universal Quantum Computer Simulator).This package allows a user with validJudoorcredentials to useJUQCS(Juelich Universal Quantum Computer Simulator)
for simulating quantum circuits of up to 40 qubits on HPC systems of the Juelich Supercomputing Center.Currently two modes of operation are supported by the JUQCS simulator:Sampling mode (qasm_simulator): up to 100.000 shots and up to 40 qubits.Statevector mode (statevector_simulator): up to 20 qubits.Installationpipinstallgit+https://jugit.fz-juelich.de/qip/juniq-platform/qiskit-juqcs.gitorpipinstallgit+ssh://git@jugit.fz-juelich.de/qip/juniq-platform/qiskit-juqcs.gitFirst stepsIf you are using this package from JUNIQ-Cloud this step will be taken care of automatically, you may skip to the next section.If you are manually installing this package on your local machine you will be prompted to provide yourJudoorusername and password when first importing the module. These credentials will be stored in your machine so authentication against JUNIQ-service will happen automatically the next time. Every time it is imported, the package checks with JUNIQ-service if the credentials are valid. In case you provided the wrong credentials or you have updated them since the last time you used the package you will be prompted to provide them again.NOTEThe credentials will not be updated until you import the module again in a new Python session.Usage exampleThis section shows how to submit a circuit for simulation to JUQCS.Import Qiskit and create the circuit which we want to simulate:importqiskitcircuit=qiskit.QuantumCircuit(5)circuit.h(0)circuit.cx(0,1)circuit.cx(0,2)circuit.measure_all()Import the Juqcs provider and choose a backend from'statevector_simulator'or'qasm_simulator':fromjuqcsimportJuqcsbackend=Juqcs.get_backend('qasm_simulator')NOTESince each simulator returns a different type of output, different limitations for the maximum qubit size apply (20 qubits for'statevector_simulator'and 40 qubits for'qasm_simulator').So far the process has not deviated from the usage of a typical Qiskit backend, but the following step is unique to the JUQCS backends:backend.allocate(minutes=30,max_qubits=5,reservation=None)NOTEThis function may take a few minutes to return, depending largely on the load of the HPC system at the time of submission.Since the JUQCS simulator is deployed on an HPC system whose compute resources are shared with many other users, we now need to request the HPC system for permission to simulate our circuits. In this step we are making two "promises" to the HPC system, and the success of our simulation experiment depends on us keeping these promises:We promise that the biggest circuit that we want to simulate under this allocation will have at mostint(max_qubits)qubits. If we try to submit a bigger circuit the HPC system would not have allocated sufficient compute resources for us, so the simulation would fail. We only need to include this parameter if we want to simulate circuits larger than 32 qubits, since any circuit up to and including this size requires exactly the same amount of compute resources.We promise that we will be done with our simulation experiments withinint(minutes)minutes. By default, this parameter is set to 60 minutes, and the longest running allocation we can create is 24 hours (=1440 minutes). After this time is exceeded our allocation will expire, so circuit simulation submissions beyond this point would fail. In order to fix this we would need to create a new allocation.NOTEOptionally we can passstr(reservation)to our allocation request if we have been given an HPC reservation ID (e.g. when attending a training course at JSC). If you do not have a reservation ID do not worry, JUQCS will work without one too.We can make sure that the allocation has been successfully created for us by callingbackend.status().status_msg. If a valid allocation is available, we will see a message like'Resource allocation #{allocation ID} of {number} qubits available until {expiration time}.'.Now we can use our JUQCS backend just as any other typical Qiskit backend, e.g.:job=qiskit.execute(circuit,backend=backend,shots=1000,seed=10)result=job.result()print(result.get_counts())Whenjob.result()is called withpartial=Trueas argument, this method will attempt to retrieve partial results of failed jobs. In this case, precaution should be taken when accessing individual experiments, as doing so might cause an exception. Thesuccessattribute of the returned Result instance can be used to verify whether it contains partial results.Once we are finished with our experiments it is good practice to callbackend.deallocate().In case our allocation is still running this will revoke the allocation, so that we only get charged for the time our allocation was running, instead of for the time we promised the HPC system we would need the allocation for. If the allocation is not running anymore this function will not have any effect, so it's better to call it anyway to be on the safe side!Release History0.4.0Client-side changes to execute JUQCS on JURECA-dc.0.3.0Now using juniq-service:juqcs-service script bundle.Authentication mechanism reworked.Improved error handling and reporting.Several bugs fixed.0.2.0First public release.MetaCarlos Gonzalez Calaza -c.gonzalez.calaza@fz-juelich.deDistributed under the MIT license. SeeLICENSEfor more information.https://gitlab.com/juniq-platform/qiskit-juqcs