qrunch.tools.mpi.creators

Builder classes for creating MPI-enabled quantum computing objects.

This module provides fluent builder interfaces for configuring and creating MPI-distributed tensor network contraction calculators.

Functions

mpi_creator()

Entry point for creating MPI-enabled quantum computing objects.

Classes

MpiContractionCalculatorCreator

Builder for creating MPI-enabled tensor network contraction calculators.

MpiCreator

Entry point for creating MPI-enabled quantum computing objects.

class MpiContractionCalculatorCreator

Bases: object

Builder for creating MPI-enabled tensor network contraction calculators.

This creator follows a fluent builder pattern, allowing configuration of MPI settings, contraction path finders, and calculator options before creating the final calculator instance.

Requirements:
  • Qrunch install requirements: qrunch[cuda,mpi] (or qrunch[all]).

  • A working cuda (cupy) installation.

__init__() → None

Initialize the MPI contraction calculator creator with default settings.

Return type:

None

choose_contraction_path_finder() → ContractionPathFinderSubCreator[Self]

Choose the contraction path finder algorithm.

If not called, the contraction calculator’s default path finding is used.

Return type:

ContractionPathFinderSubCreator[Self]

choose_fallback_contraction_path_finder(*, threshold: PathFinderThresholdOptions) → ContractionPathFinderSubCreator[Self]

Choose a fallback to try when the primary path exceeds either resource limit.

Without an explicit primary, greedy Boltzmann bisection is used. The fallback’s path is accepted without another threshold; finder exceptions still propagate. Only one fallback may be selected. Choose none() to remove it.

Parameters:

threshold (PathFinderThresholdOptions) – Maximum primary-path FLOPs and memory usage in bytes.

Return type:

ContractionPathFinderSubCreator[Self]

create() → MpiCutensornetTensorNetworkContractionCalculator

Create the configured MPI contraction calculator.

Uses the settings configured via the builder methods to instantiate an MpiCutensornetTensorNetworkContractionCalculator.

Return type:

MpiCutensornetTensorNetworkContractionCalculator

with_comm(comm: MPI.Comm) → Self

Set the MPI communicator to use.

Parameters:

comm (MPI.Comm) – The MPI communicator for inter-process communication.

Return type:

Self

with_options(options: MpiCutensornetTensorNetworkContractionCalculatorOptions) → Self

Set options for the contraction calculator to use.

Parameters:

options (MpiCutensornetTensorNetworkContractionCalculatorOptions) – Options for the MpiCutensornetTensorNetworkContractionCalculator to use.

Return type:

Self

with_root(root: int) → Self

Set the root rank for MPI communication.

Parameters:

root (int) – The root rank for MPI operations. Must be non-negative.

Return type:

Self

class MpiCreator

Bases: object

Entry point for creating MPI-enabled quantum computing objects.

Requirements:
  • Qrunch install requirements: qrunch[mpi] (or qrunch[all]).

__init__(*args, **kwargs)
static contraction_calculator() → MpiContractionCalculatorCreator

Start building an MPI-enabled tensor network contraction calculator.

Requirements:
  • Qrunch install requirements: qrunch[cuda] (or qrunch[all]).

  • A working cuda (cupy) installation.

Return type:

MpiContractionCalculatorCreator

mpi_creator() → MpiCreator

Entry point for creating MPI-enabled quantum computing objects.

Requirements:
  • Qrunch install requirements: qrunch[mpi] (or qrunch[all]).

Return type:

MpiCreator