{"id":13776721,"url":"https://github.com/Interlin-q/Interlin-q","last_synced_at":"2025-05-11T10:31:16.743Z","repository":{"id":43602209,"uuid":"307312695","full_name":"Interlin-q/Interlin-q","owner":"Interlin-q","description":"A Quantum Interconnect Simulator for Distributed Quantum Algorithms","archived":false,"fork":false,"pushed_at":"2021-09-26T12:29:05.000Z","size":3454,"stargazers_count":45,"open_issues_count":10,"forks_count":11,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-11T21:22:43.920Z","etag":null,"topics":["distributed-quantum-computing","quantum","quantum-computing","simulator","unitaryfund"],"latest_commit_sha":null,"homepage":"https://interlin-q.github.io/Interlin-q/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Interlin-q.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-10-26T08:55:37.000Z","updated_at":"2025-02-18T21:56:05.000Z","dependencies_parsed_at":"2022-09-10T15:02:18.053Z","dependency_job_id":null,"html_url":"https://github.com/Interlin-q/Interlin-q","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Interlin-q%2FInterlin-q","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Interlin-q%2FInterlin-q/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Interlin-q%2FInterlin-q/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Interlin-q%2FInterlin-q/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Interlin-q","download_url":"https://codeload.github.com/Interlin-q/Interlin-q/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253551671,"owners_count":21926333,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["distributed-quantum-computing","quantum","quantum-computing","simulator","unitaryfund"],"created_at":"2024-08-03T18:00:32.111Z","updated_at":"2025-05-11T10:31:13.094Z","avatar_url":"https://github.com/Interlin-q.png","language":"Python","funding_links":[],"categories":["Quantum simulators"],"sub_categories":[],"readme":"[![Unitary Fund](https://img.shields.io/badge/Supported%20By-UNITARY%20FUND-brightgreen.svg?style=for-the-badge)](http://unitary.fund)\n\n# Interlin-q\n\nThis is a distributed quantum-enabled simulator which imitates the master-slave centralised-control distributed quantum computing system with interconnect communication between the nodes. Using this simulator, one can input any monolithic circuit as well as a distributed quantum computing topology and see the execution of the distributed algorithm happening in real time. The simulator maps the monolithic circuit to a distributed quantum computing achitecture and uses a master-slave relation with a centralized controller communicating to computing nodes in the network. Interlin-q can be used for designing and analysing novel distributed quantum algorithms for various distributed quantum computing architectures.\n\nThe method used to accomplish this is based on the following paper:\n\n```\nDistributed Quantum Computing and Network Control for Accelerated VQE\nStephen DiAdamo, Marco Ghibaudi, James Cruise (arXiv: 2101.02504)\n```\n\nThe simulated architecture can be seen in the image below:\n\n![Simulated Architecture](images/simulated_architechture.png)\n\n## Setup, tests and documentation\n\nSee https://interlin-q.github.io/Interlin-q for documentation. To setup Interlin-q, run the below command.\n\n```\npip install -r requirements.txt\n```\n\nTo run tests, run the below command.\n\n```\nnose2\n```\n\n## Quick Start Guide\n\n### Quick Example\n\nA basic template of a distributed CNOT gate between two different computing hosts is shown in the file ```examples/template.py```, where the control qubit in first computing host is set in |1\u003e state and the target qubit in the second computing host is set in |0\u003e state.\n\n```\ndef create_circuit(q_map):\n    layers = []\n    computing_host_ids = list(q_map.keys())\n\n    # Prepare the qubits on both computing hosts\n    ops = []\n    for host_id in computing_host_ids:\n        op = Operation(\n            name=Constants.PREPARE_QUBITS,\n            qids=q_map[host_id],\n            computing_host_ids=[host_id])\n        ops.append(op)\n    layers.append(Layer(ops))\n\n    # Circuit input should be added below\n    # Put qubit \"q_0_0\" in |1\u003e state\n    op = Operation(\n        name=Constants.SINGLE,\n        qids=[q_map[computing_host_ids[0]][0]],\n        gate=Operation.X,\n        computing_host_ids=[computing_host_ids[0]])\n    ops.append(op)\n    layers.append(Layer(ops))\n\n    # Apply cnot gate from \"q_0_0\" to \"q_1_0\"\n    control_qubit_id = q_map[computing_host_ids[0]][0]\n    target_qubit_id = q_map[computing_host_ids[1]][0]\n\n    op = Operation(\n        name=Constants.TWO_QUBIT,\n        qids=[control_qubit_id, target_qubit_id],\n        gate=Operation.CNOT,\n        computing_host_ids=computing_host_ids)\n    layers.append(Layer([op]))\n\n    # Measure the qubits\n    ops = []\n    for host_id in computing_host_ids:\n        op = Operation(\n            name=Constants.MEASURE,\n            qids=[q_map[host_id][0]],\n            cids=[q_map[host_id][0]],\n            computing_host_ids=[host_id])\n        ops.append(op)\n    layers.append(Layer(ops))\n\n    circuit = Circuit(q_map, layers)\n    return circuit\n\ndef controller_host_protocol(host, q_map):\n    \"\"\"\n    Protocol for the controller host\n    \"\"\"\n    circuit = create_circuit(q_map)\n    host.generate_and_send_schedules(circuit)\n    host.receive_results()\n\n    results = host.results\n    computing_host_ids = host.computing_host_ids\n\n    print('Final results: \\n')\n    for computing_host_id in computing_host_ids:\n        bits = results[computing_host_id]['bits']\n        for bit_id, bit in bits.items():\n            print(\"{0}: {1}\".format(bit_id, bit))\n\ndef computing_host_protocol(host):\n    \"\"\"\n    Protocol for the computing hosts\n    \"\"\"\n    host.receive_schedule()\n    host.send_results()\n\ndef main():\n    # initialize network\n    network = Network.get_instance()\n    network.start()\n\n    clock = Clock()\n    controller_host = ControllerHost(host_id=\"host_1\", clock=clock)\n\n    # Here the number of computing hosts and number of qubits per computing hosts\n    # can be customised\n    computing_hosts, q_map = controller_host.create_distributed_network(\n        num_computing_hosts=2,\n        num_qubits_per_host=2)\n    controller_host.start()\n\n    network.add_host(controller_host)\n    for host in computing_hosts:\n        network.add_host(host)\n\n    print('starting...')\n    t = controller_host.run_protocol(controller_host_protocol, (q_map,))\n    threads = [t]\n    for host in computing_hosts:\n        t = host.run_protocol(computing_host_protocol)\n        threads.append(t)\n\n    for thread in threads:\n        thread.join()\n    network.stop(True)\n    exit()\n\nif __name__ == '__main__':\n    main()\n```\n\nIn the template, the monolothic circuit can be added in the `create_circuit` function, which will automatically be distributed by the controller host and performed by the computing hosts. The operations needed to perform the monolithic circuit should be added layer by layer. The specific topology required to perform the circuit can be customised by changing the number of computing hosts required to perform the circuit and as well as changing the number of qubits required per computing hosts.\n\n### Distributed Quantum Phase Estimation Tutorial\n\nA tutorial of Distributed Quantum Phase Estimation algorithm can be found [here](examples/QPE/distributed_quantum_phase_estimation_notebook.ipynb).\n\n## Contributing\n\nWe welcome contributors. Feel free to open an issue on this repository or add a pull request to submit your patch/contribution. Adding test cases for any contributions is a requirement for any pull request to be merged.\n\n## Citing\n```\n@article{parekh2021quantum,\n  title={Quantum Algorithms and Simulation for Parallel and Distributed Quantum Computing},\n  author={Parekh, Rhea and Ricciardi, Andrea and Darwish, Ahmed and DiAdamo, Stephen},\n  journal={arXiv preprint arXiv:2106.06841},\n  year={2021}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FInterlin-q%2FInterlin-q","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FInterlin-q%2FInterlin-q","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FInterlin-q%2FInterlin-q/lists"}