Distributed emulation
Distributed Qaptiva provides multiple emulators capable of running on multiple HPC nodes, and / or multiple GPUs (for now, only
DLinAlg and DNoisy). Emulators capable of running on multiples nodes are:
Running multi-nodes emulations
Running multi-nodes emulations requires to provide two scripts, a Python script and a Slurm script. These two scripts are:
A python script describing the quantum program to be emulated, and ressembles a program used by other Qaptiva emulators:
from qat.core import Job from qat.plugins import ScipyMinimizePlugin from qat.qpus import LinAlg variational_job = Job.load("my_variational_job.job") result = (ScipyMinimizePlugin() | LinAlg()).submit(variational_job) print(f"Minimal value: {result.value}")Note
Please note that neither the number of nodes, nor the number of processes per nodes have to be specified in this Python script. These value are inherited from the Slurm script.
A Slurm script specifying the resources to used, and executing the python script defined above. The Slurm script may look like:
#!/bin/bash #SBATCH --partition XXX // partition of the cluster to be used #SBATCH --nodes 8 // number of nodes #SBATCH --time 24:00:00 // time limit of the simulation job #SBATCH --job-name my_variational_job // name of the job #SBATCH --output slurm-%A_%x_%N_%t.out // SLURM output file format #SBATCH --error slurm-%A_%x_%N_%t.err // SLURM error file format #SBATCH --exclusive // reserve the nodes on exclusive mode module load qaptiva-hpc python3 -u my_variational_job.py # Script defined aboveFor Qaptiva HPC, we recommand:
to always allocate your nodes in exclusive mode
to use only one process per node, unless you want to use GPUs (then, one process per GPU is required)
to follow the recommandation of your HPC cluster
Your Slurm script can then be scheduled using:
sbatch my_slurm_script.sh
The output of your Python script will be dumped in a file managed by Slurm (see filename specified by --output and
--error in the Slurm script). The content of this file may look like:
Minimal value: -37.5
Note
This section also applies to single-node emulations. Nevertheless, single-node emulations can also be scheduled
with srun directly.