Processes (qiskit_addon_sqd.processes)

Support for collective multi-process execution.

This module exists to support coordinated parallel execution across multiple isolated processes, with explicit global synchronization and communication (e.g., MPI-style SPMD collectives).

The current implementation relies on MPI, but the public interface is designed to support other collective-execution backends in the future.

is_mpi_execution()[source]

Check if running in MPI mode.

Returns:

True if MPI is detected.

Return type:

bool

process_index()[source]

Get the index of the current process.

Returns:

Process index (0 for the control process).

Return type:

int

process_count()[source]

Get the total number of collective processes.

Returns:

Number of collective processes (1 if not in distributed mode).

Return type:

int

is_control_process()[source]

Return True if the current process is the control process.

Returns:

True if this is rank 0 or if not in distributed mode.

Return type:

bool

broadcast(obj, root=0)[source]

Broadcast a picklable object to all processes.

Parameters:
  • obj (Any) – Object to broadcast (only used on the root process).

  • root (int) – Root process index (default: 0 = broadcast from the control process).

Returns:

The broadcasted object on all ranks.

Return type:

Any

barrier()[source]

Synchronize all processes.

This is a no-op if not in distributed mode.

Return type:

None