BlogRunning Dynamiqs Workloads on Qubernetes

Running Dynamiqs Workloads on Qubernetes

Vlad ȘtirbuVlad Știrbu

Published on October 25, 2025.

This week I have attended the Munich Quantum Software Forum. The program included a variety of interesting talks and presentations on the latest developments in quantum software. Among the software pitches, I found the one from Alice and Bob particularly intriguing. Dynamiqs was advertised as a high-performance quantum systems simulation build on top of JAX, optimised for both CPUs, GPUs and TPUs.

This situation created the perfect opportunity to test how fast I can run a Dynamiqs workload on our Qubernetes cluster located in Finland, which happens to have the necessary GPU resources available.

In this blog post, I will share my experience and the steps I took to successfully run a Dynamiqs workload on Qubernetes.

Adapting the Dynamiqs Example

The Dynamiqs documentation provides a simple workflow example of how to use the library for quantum simulations. We will adapt this example to run it on Qubernetes. First, we need to create a Python script demo.py that contains the Dynamiqs example code:

demo.py
import dynamiqs as dq
import jax.numpy as jnp
 
# initial state
psi0 = dq.fock(2, 0)
 
# Hamiltonian
delta = 0.3  # detuning
Omega = 1.0  # Rabi frequency
H = delta * dq.sigmaz() + Omega * dq.sigmax()
 
print(f"State of type {type(psi0)} and shape {psi0.shape}.")
print(f"Hamiltonian of type {type(H)} and shape {H.shape}.")
 
# define sampling times
sim_time = 10.0  # total time of evolution
num_save = 101  # number of time slots to save
tsave = jnp.linspace(0.0, sim_time, num_save)  # can also be a list or a NumPy array
 
# define list of observables
exp_ops = [dq.sigmaz()]  # expectation value of sigma_z
 
# define method (Dormand-Prince method of order 5)
method = dq.method.Dopri5(rtol=1e-6, atol=1e-8)
 
# run simulation
result = dq.sesolve(H, psi0, tsave, exp_ops=exp_ops, method=method)
 
# print some information
print(f"`result` is of type {type(result)}.")
print(f"`result` has the following attributes:")
print(f"{[attr for attr in dir(result) if not attr.startswith('__')]}\n")
print(result)

Next we need to create a project configuration file Q8Sproject. This file specifies the dependencies and settings required to run the Dynamiqs example on CPU and GPU targets in Qubernetes.

Q8Sproject
name: dynamiqs-example
 
python_env:
  dependencies:
    - dynamiqs
 
targets:
  cpu:
    python_env:
      dependencies:
        - jax
 
  gpu:
    python_env:
      dependencies:
        - jax[cuda12]
 
docker:
    username: your_dockerhub_username
 
kubeconfig: /path/to/your/kubeconfig

The resulting project structure is as follows:

    • Q8Sproject
    • demo.py

Running the Dynamiqs Simulation

With the project set up, we can now proceed to run the Dynamiqs example on our Qubernetes cluster. The first step is to build the target gpu image and push it to Docker Hub:

q8sctl build --target gpu

Once the images are built, we can execute the demo by running the following command:

q8sctl execute --target gpu --kubeconfig kubeconfig demo.py

The command will initiate the execution of the demo.py script on the GPU target.

Challenges and Solutions

I attend quite often conferences and workshops, and I usually travel light with just my ultra-portable laptop. However, I still need to run heavy quantum simulations during these events. This is where Qubernetes comes in handy, as it allows me to offload these computations to the cloud while I work on my laptop. Not to mention, my colleagues can use the hardware capabilities of the cluster as well.

Conclusion

Running Dynamiqs workloads on Qubernetes was a straightforward process, thanks to the flexibility of the Qubernetes platform and the ease of setting up projects with Q8Sproject files. The ability to seamlessly switch between CPU and GPU targets allows for efficient utilization of available computational resources.

The code in this blog post can be found in this GitHub repository. Feel free to explore and modify it for your own experiments with Dynamiqs on Qubernetes!

Happy coding! 😊