← Back to projects

quantum tensor simulator

contracting quantum circuits, in parallel, across a cluster.

group project, with Tabish Noman Khan and Arqam Zia

Quantum circuits are naturally tensor networks, and contracting a tensor network efficiently is most of what makes simulating a quantum circuit tractable at all. For a Parallel & Distributed Computing course, the three of us took a serial reference implementation and rebuilt its contraction as a distributed, multithreaded pipeline.

source

the pipeline

  1. community detection

    METIS partitions the tensor network into communities, tightly connected clusters of tensors, chosen to minimise the connections between them.

  2. community contraction

    Each community contracts independently and in parallel. MPI spreads the communities across processes; OpenMP and native Julia threads parallelise inside each one.

  3. final merge

    The contracted communities get merged and contracted again, globally, with coordinated parallelism, into the final result.

what the driver script looks like

The entry point reads almost like a lab notebook: build a circuit, convert it to a tensor network, hand it to the contraction algorithm with a community count, and let MPI take it from there.

circuit = create_ghz_circuit(999)
tnc = convert_to_tnc(circuit)

num_communities = 8
input_state = "0"^999
output_state = "1"^999

result = ComParCPU_MPI(circuit, input_state, output_state, num_communities;
    timings=true, decompose=true)
openmpi.jl, the driver

credit

This extends Alfred Miquel's Multistage_contraction, adding the distributed and multithreaded execution layer on top of its serial structure. Built and benchmarked together with Tabish Noman Khan and Arqam Zia.

Julia, MPI, OpenMP, METIS