Start JupyterHub

Start a JupyterHub instance with at least the following settings:
  • Partition: gpu-preempt
  • Number of CPUs: 4
  • Memory Allocation: 8192
  • Number of GPUS: 1

Setup conda environment

Once your instance has started, start a Terminal (File→New→Terminal, or via the Launcher), and run the following commands:
ml load conda/latest
conda create --name qcsimulators python=3.12
conda activate qcsimulators
pip install qiskit qiskit_aer_gpu pylatexenc ipykernel matplotlib
python -m ipykernel install --user --name qcsimulators --display-name="qcsimulators"
This will create a new Python kernel qcsimulators. Feel free to choose a different name.   

Begin!

Once the environment is complete, create a new notebook (FileNewNotebook) and select the kernel you just created.    Here is a sample code snippet. It creates a maximally entangled 20-qubit GHZ (Greenberger–Horne–Zeilinger) state and simulates it on a GPU-accelerated statevector simulator using Qiskit’s AerSimulator. The statevector simulator keeps track of the full quantum state. The final measurement results are printed.  
from qiskit import QuantumCircuit, transpile
from qiskit_aer import AerSimulator
def create_ghz_circuit(n_qubits):
    circuit = QuantumCircuit(n_qubits)
    circuit.h(0)
    for qubit in range(n_qubits - 1):
        circuit.cx(qubit, qubit + 1)
    return circuit

simulator = AerSimulator(method='statevector', device='GPU')
circuit = create_ghz_circuit(n_qubits=20)
circuit = transpile(circuit, backend=simulator, optimization_level=0)
circuit.measure_all()
job = simulator.run(circuit)
result = job.result()

print(result.get_counts())
print(f'backend: {result.backend_name}')
 
The measurement will always collapse to either:
00000000000000000000 (all qubits measured as 0)
11111111111111111111 (all qubits measured as 1)
The output will be something like:
{'00000000000000000000': 519, '11111111111111111111': 505}
backend: aer_simulator_statevector_gpu