Parallel Sampling
DynexSampler is thread-safe and can be parallelized using Python’s multiprocessing module. This is especially useful for:
- Federated learning — computing multiple network layers simultaneously
- Ensemble methods — collecting diverse solutions from independent runs
- Hyperparameter search — testing multiple configurations in parallel
- Multi-model pipelines — running different models on the same problem concurrently
Basic parallel example
Federated learning pattern
In federated learning, each parallel job typically handles a different model or data partition:
Thread pool for I/O-bound workflows
For lighter workloads where GIL contention is not a concern, ThreadPoolExecutor can be used:
Use multiprocessing.Process (not threads) for CPU-intensive sampling. Python’s GIL prevents true parallelism with threads for compute-heavy workloads.
- All parallel jobs are submitted to the Dynex network simultaneously — they compete for the same worker pool
- For QPU backends, each parallel job consumes QPU resources independently
- Set
logging=False in parallel workers to avoid interleaved output
- Use
description to tag jobs for identification in the Dynex dashboard